This commit is contained in:
liwei1dao 2023-12-21 11:42:21 +08:00
commit 837bce0066
6 changed files with 68 additions and 60 deletions

View File

@ -235,6 +235,8 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
update["items"] = caravan.Items update["items"] = caravan.Items
update["baglimit"] = caravan.Baglimit update["baglimit"] = caravan.Baglimit
caravan.Allgoods = nil
caravan.Period = nil
this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update) this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update)
session.SendMsg(string(this.module.GetType()), "buyorsell", &pb.CaravanBuyOrSellResp{ session.SendMsg(string(this.module.GetType()), "buyorsell", &pb.CaravanBuyOrSellResp{
Data: caravan, Data: caravan,

View File

@ -78,7 +78,9 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory
} }
return return
} }
resp.Data = list resp.Eventid = list.Eventid
resp.Taskid = list.Taskid
resp.Tasktime = list.Tasktime
session.SendMsg(string(this.module.GetType()), "getstory", resp) session.SendMsg(string(this.module.GetType()), "getstory", resp)
return return
} }

View File

@ -124,7 +124,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
"curcity": list.Curcity, "curcity": list.Curcity,
"eventid": list.Eventid, "eventid": list.Eventid,
}) })
resp.Data = list resp.Curcity = list.Curcity
resp.Newtask = bNewTask resp.Newtask = bNewTask
session.SendMsg(string(this.module.GetType()), "gotocity", resp) session.SendMsg(string(this.module.GetType()), "gotocity", resp)
// 任务统计 // 任务统计

View File

@ -328,7 +328,9 @@ func (this *Caravan) CheckCaravanTask(session comm.IUserSession, data *pb.DBCara
this.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update) this.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update)
// 任务超时发送任务失败推送 // 任务超时发送任务失败推送
resp := &pb.CaravanTaskCompletePush{} resp := &pb.CaravanTaskCompletePush{}
resp.Data = data resp.Eventid = data.Eventid
resp.Tasktime = data.Tasktime
resp.Eventid = data.Eventid
resp.BSuccess = false resp.BSuccess = false
bTimeOut = true bTimeOut = true
if len(list.Unreword) == 2 && list.Unreword[0] == 1 { // 类型为1 的 直接扣除虚拟币 if len(list.Unreword) == 2 && list.Unreword[0] == 1 { // 类型为1 的 直接扣除虚拟币
@ -380,7 +382,7 @@ func (this *Caravan) TaskComplete(session comm.IUserSession, taskid ...int32) {
if conf, err := this.configure.GetCaravanEventById(list.Eventid); err == nil { if conf, err := this.configure.GetCaravanEventById(list.Eventid); err == nil {
this.CleanCaravanTask(session.GetUserId(), list) //任务完成 清理任务数据 this.CleanCaravanTask(session.GetUserId(), list) //任务完成 清理任务数据
resp = &pb.CaravanTaskCompletePush{} resp = &pb.CaravanTaskCompletePush{}
resp.Data = list
resp.BSuccess = true resp.BSuccess = true
var ( var (
atno []*pb.UserAtno atno []*pb.UserAtno

View File

@ -225,23 +225,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
} }
return return
} else if req.Itype > 0 { //玩家卡牌技能 } else if req.Itype > 0 { //玩家卡牌技能
var (
conf *cfg.GamePlayerSkillData
err error
list *pb.DBXXLData
)
if conf, err = this.module.configure.GetGamePlaySkill(req.Itype); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, // 配置校验
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
if list, err = this.module.model.getEntertainmList(session.GetUserId()); err == nil {
this.module.Debugf("%v,%v", conf, list)
}
if curPlayer.Skill[req.Itype] <= 0 { if curPlayer.Skill[req.Itype] <= 0 {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_EntertainNoSkillCard, // 技能卡不足 Code: pb.ErrorCode_EntertainNoSkillCard, // 技能卡不足
@ -253,7 +236,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil { if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
return return
} }
return return
} }
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 { if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
@ -953,12 +935,12 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
if conf.Skilltouch == 101 { // 技能类型为1 if conf.Skilltouch == 101 { // 技能类型为1
szMap = this.chessboard.HitElem(color, curid) szMap = this.chessboard.HitElem(color, curid)
} else if conf.Skilltouch == 102 { } else if conf.Skilltouch == 102 {
this.chessboard.ShuffleElem() // 初始化棋盘 this.chessboard.ShuffleElem()
szMap = append(szMap, &pb.MapData{ szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Plat, Data: this.chessboard.Plat,
}) })
} else if conf.Skilltouch == 103 { } else if conf.Skilltouch == 103 {
//this.chessboard.HitCrossElem() // 初始化棋盘 this.chessboard.HitCrossElem(color, curid) // 消除十字
szMap = append(szMap, &pb.MapData{ szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Plat, Data: this.chessboard.Plat,
}) })
@ -979,6 +961,19 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
v.ChangeType = 1 v.ChangeType = 1
} }
this.NexPower = this.curPower this.NexPower = this.curPower
if conf.Number == 2 { // 只有2类型扣除
if list, err := this.module.model.getEntertainmList(curPlayer.Userinfo.Uid); err == nil {
if _, ok := list.Skill[skillid]; ok {
list.Skill[skillid] -= 1
if list.Skill[skillid] < 0 {
list.Skill[skillid] = 0
}
this.module.model.modifyEntertainmList(curPlayer.Userinfo.Uid, map[string]interface{}{
"skill": list.Skill,
})
}
}
}
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
Mpadata: szMap, Mpadata: szMap,

View File

@ -1329,49 +1329,56 @@ func (this *MapData) ShuffleElem() {
} }
func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) { func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData) {
var ids []int // 十字id var (
var energy int32 ids []int // 十字id
var curScore int32 energy int32
curScore int32
xc map[int]struct{}
)
x := int(curid / Width) x := int(curid / Width)
y := int(curid % Height) y := int(curid % Height)
xc = make(map[int]struct{}, 0)
for i := 0; i < Height; i++ { // 上 for i := 0; i < Height; i++ { // 上下
if y+i < Height {
ids = append(ids, x*Width+(y+i))
}
if y-i > 0 { if y-i > 0 {
ids = append(ids, (x-1)*Width+(y)) ids = append(ids, x*Width+(y-i))
} }
} }
if this.Plat[curid].Special == 0 {
if this.Plat[curid].Color == color { for i := 0; i < Height; i++ { // 左右
if x+i < Width {
ids = append(ids, (x+i)*Width+(y))
}
if x-i >= 0 {
ids = append(ids, (x-i)*Width+(y))
}
}
for _, v := range ids {
if this.Plat[curid].Special == 0 {
xc[v] = struct{}{}
} else {
for key := range this.SpecialElem(int(v), this.Plat[v].Special) {
xc[key] = struct{}{}
}
}
}
for id := range xc {
if this.Plat[id].Color == color {
energy++ energy++
} }
curScore = this.Plat[curid].Score curScore += this.Plat[id].Score
this.Plat[curid] = &pb.GirdeData{} this.Plat[id] = &pb.GirdeData{}
if this.DropGirde() { this.operElem = append(this.operElem, int32(id))
szMap = append(szMap, &pb.MapData{ }
Data: this.GetPalatData(), if this.DropGirde() {
CurSocre: curScore, szMap = append(szMap, &pb.MapData{
CurEnergy: 0, Data: this.GetPalatData(),
}) CurSocre: curScore,
} CurEnergy: energy,
sz, _ := this.CheckMap(color, false) })
szMap = append(szMap, sz...)
} else {
x := this.SpecialElem(int(curid), this.Plat[curid].Special)
for id := range x {
if this.Plat[id].Color == color {
energy++
}
curScore += this.Plat[id].Score
this.Plat[id] = &pb.GirdeData{}
this.operElem = append(this.operElem, int32(id))
}
if this.DropGirde() {
szMap = append(szMap, &pb.MapData{
Data: this.GetPalatData(),
CurSocre: curScore,
CurEnergy: energy,
})
}
} }
return return
} }