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["baglimit"] = caravan.Baglimit
caravan.Allgoods = nil
caravan.Period = nil
this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update)
session.SendMsg(string(this.module.GetType()), "buyorsell", &pb.CaravanBuyOrSellResp{
Data: caravan,

View File

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

View File

@ -124,7 +124,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
"curcity": list.Curcity,
"eventid": list.Eventid,
})
resp.Data = list
resp.Curcity = list.Curcity
resp.Newtask = bNewTask
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)
// 任务超时发送任务失败推送
resp := &pb.CaravanTaskCompletePush{}
resp.Data = data
resp.Eventid = data.Eventid
resp.Tasktime = data.Tasktime
resp.Eventid = data.Eventid
resp.BSuccess = false
bTimeOut = true
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 {
this.CleanCaravanTask(session.GetUserId(), list) //任务完成 清理任务数据
resp = &pb.CaravanTaskCompletePush{}
resp.Data = list
resp.BSuccess = true
var (
atno []*pb.UserAtno

View File

@ -225,23 +225,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
}
return
} 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 {
errdata = &pb.ErrorData{
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 {
return
}
return
}
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
szMap = this.chessboard.HitElem(color, curid)
} else if conf.Skilltouch == 102 {
this.chessboard.ShuffleElem() // 初始化棋盘
this.chessboard.ShuffleElem()
szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Plat,
})
} else if conf.Skilltouch == 103 {
//this.chessboard.HitCrossElem() // 初始化棋盘
this.chessboard.HitCrossElem(color, curid) // 消除十字
szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Plat,
})
@ -979,6 +961,19 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
v.ChangeType = 1
}
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{
Mpadata: szMap,

View File

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