From 08b16d62e7f1f820023970e87c819ad03766fc15 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 15:22:49 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=9F=8B=E7=82=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 5 ++--- modules/modulebase.go | 15 -------------- modules/user/module.go | 47 ++++++++++++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/comm/const.go b/comm/const.go index 51303339f..c3d4ffff2 100644 --- a/comm/const.go +++ b/comm/const.go @@ -741,11 +741,9 @@ const ( Rtype101 TaskType = 101 //获得X星职业武器N件(历史)(从创号开始记录,每获得1件X星职业武器则进度+1) Rtype102 TaskType = 102 //阵营饰品强化成功N次(历史)(从创号开始记录,强化成功进度+1) Rtype103 TaskType = 103 //获得X星阵营饰品N件(历史)(从创号开始记录,每获得1件X星阵营饰品则进度+1) - //消费N个钻石(历史)(从创号开始记录,每次消耗钻石增加消耗额的进度) - Rtype104 TaskType = 104 + Rtype104 TaskType = 104 //消费N个钻石(历史)(从创号开始记录,每次消耗钻石增加消耗额的进度) Rtype105 TaskType = 105 //商店刷新N次(从接到任务开始,每次刷新商店进度+1) Rtype106 TaskType = 106 //跨服聊天发言N次(从接到任务开始,每次跨服发言成功进度+1) - Rtype108 TaskType = 108 //助战英雄被使用X次(从接到任务开始,每被使用1次则进度+1) Rtype109 TaskType = 109 //加入公会(打开任务时,检查是否加入了公会,加入则完成) Rtype110 TaskType = 110 //激活X个英雄图鉴(打开任务时,检查英雄图鉴激活数量并计入进度,达到了任务所需个数则完成任务。) @@ -842,6 +840,7 @@ const ( Rtype211 TaskType = 211 // 向指定X城市,贩卖价值X虚拟币以上的对应城市急需货物 Rtype212 TaskType = 212 // 接取任务后,商队抵达指定城市 Rtype213 TaskType = 213 // 消耗X体力 + Rtype214 TaskType = 214 // 获得x充值积分 ) const ( MailLineEasy int32 = 1 // 简单 diff --git a/modules/modulebase.go b/modules/modulebase.go index b1367d20e..049a0679b 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -394,17 +394,6 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn this.Warn("资源不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v}) return } - // 统计今天消耗的体力 - if k == "ps" && v < 0 { - if userexpand, err := this.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { - userexpand.ConsumPs += (-v) - this.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ - "consumPs": userexpand.ConsumPs, - }) - - go this.ModuleUiGame.HDPSTodayConsum(session.GetUserId(), userexpand.ConsumPs) // - } - } } for k, v := range items { amount := this.ModuleItems.QueryItemAmount(session.GetUserId(), k) @@ -426,10 +415,6 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn return } this.Debug("消耗玩家资源", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "attrs", Value: attrs}) - if count, ok := attrs[comm.ResDiamond]; ok { - // this.ModuleBuried.SendToRtask(session, comm.Rtype104, -count) - go this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype104, -count)) - } } if len(items) > 0 { _, errdata = this.ModuleItems.AddItems(session, items, bPush) diff --git a/modules/user/module.go b/modules/user/module.go index 8d7a5644a..0660b99ce 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -441,7 +441,6 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha } return } - this.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype68, -(add))) } change.Gold += int64(add) case comm.ResExp: @@ -546,6 +545,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha return } change.Ps += add + userEx.ConsumPs += -add } else { if change.Ps+add > ggd.PsUl { change.Ps = ggd.PsUl @@ -652,6 +652,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha comm.ResFriend: change.Friend, comm.SociatyCoin: change.Guildcoin, comm.ArenaCoin: change.Arenacoin, + "consumPs": userEx.ConsumPs, } if err := this.modelUser.updateUserAttr(uid, update); err != nil { @@ -696,27 +697,47 @@ func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add // 用户资源 func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string]int32, bPush bool) (errdata *pb.ErrorData) { + var ( + expChange bool + vipExpChange bool + tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) + _change *pb.UserResChangedPush + ) for key, add := range attrs { - var _change *pb.UserResChangedPush _change, errdata = this.change(session, key, add) if errdata != nil { return } - - if _change == nil { - continue - } - - if bPush { //推送玩家账号信息变化消息 - session.SendMsg(string(this.GetType()), "reschanged", _change) - } if key == comm.ResExp { - this.ModuleUser.EventUserChanged(session) + expChange = true } else if key == comm.VipExp { - this.ModuleUser.EventUserVipChanged(session) + vipExpChange = true + } + if key == comm.ResPs && add < 0 { //消耗体力 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype213, -add)) + } + if key == comm.ResGold && add < 0 { //消耗体力 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype68, -add)) + } + if key == comm.ResDiamond && add < 0 { //消耗钻石 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype104, -add)) + } + if key == comm.Integral && add > 0 { //积分获取 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype214, add)) } } - + if bPush { //推送玩家账号信息变化消息 + session.SendMsg(string(this.GetType()), "reschanged", _change) + } + if expChange { + this.ModuleUser.EventUserChanged(session) + } + if vipExpChange { + this.ModuleUser.EventUserVipChanged(session) + } + if len(tasks) > 0 { + go this.ModuleBuried.TriggerBuried(session.Clone(), tasks...) + } return } From 972b5a4df745377989b97122d3602f38954ee736 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 15:46:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_buriedcondi.json | 8 +-- bin/json/game_buriedtype.json | 15 ++++-- bin/json/game_pushgift.json | 42 ++++++++-------- modules/pushgiftbag/module.go | 58 ++++++++++++++++++---- sys/configure/structs/Game.BuffType.go | 5 ++ sys/configure/structs/Game.PropertyType.go | 3 +- sys/configure/structs/Game.PushGiftData.go | 25 +++++++--- 7 files changed, 109 insertions(+), 47 deletions(-) diff --git a/bin/json/game_buriedcondi.json b/bin/json/game_buriedcondi.json index 77b53212d..ad7d952d8 100644 --- a/bin/json/game_buriedcondi.json +++ b/bin/json/game_buriedcondi.json @@ -26331,7 +26331,7 @@ "key": "buried_buried_condi_tasktxt_938", "text": "当日消耗100点体力" }, - "type": 303, + "type": 213, "valid": 0, "head": { "a": "attr", @@ -26397,7 +26397,7 @@ "key": "buried_buried_condi_tasktxt_941", "text": "当日消耗30点体力" }, - "type": 303, + "type": 213, "valid": 0, "head": { "a": "attr", @@ -26551,7 +26551,7 @@ "key": "buried_buried_condi_tasktxt_941", "text": "当日消耗100点体力" }, - "type": 303, + "type": 213, "valid": 0, "head": { "a": "attr", @@ -26705,7 +26705,7 @@ "key": "buried_buried_condi_tasktxt_941", "text": "当日消耗300点体力" }, - "type": 303, + "type": 213, "valid": 0, "head": { "a": "attr", diff --git a/bin/json/game_buriedtype.json b/bin/json/game_buriedtype.json index 18adca6ec..931b7d50f 100644 --- a/bin/json/game_buriedtype.json +++ b/bin/json/game_buriedtype.json @@ -1196,29 +1196,34 @@ ] }, { - "id": 300, + "id": 210, "insert": 1, "filter": [ "eq" ] }, { - "id": 301, + "id": 211, "insert": 1, "filter": [ "eq" ] }, { - "id": 302, + "id": 212, "insert": 1, "filter": [ "eq" ] }, { - "id": 303, - "insert": 1, + "id": 213, + "insert": 2, + "filter": [] + }, + { + "id": 214, + "insert": 2, "filter": [] } ] \ No newline at end of file diff --git a/bin/json/game_pushgift.json b/bin/json/game_pushgift.json index 1168ea860..755a498b9 100644 --- a/bin/json/game_pushgift.json +++ b/bin/json/game_pushgift.json @@ -10,10 +10,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000004 ], - "condition": 60000004, + "condition_or": [], "lbid": [ { "a": "attr", @@ -38,10 +38,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000005 ], - "condition": 60000005, + "condition_or": [], "lbid": [ { "a": "attr", @@ -66,10 +66,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000006 ], - "condition": 60000006, + "condition_or": [], "lbid": [ { "a": "attr", @@ -94,10 +94,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000007 ], - "condition": 60000007, + "condition_or": [], "lbid": [ { "a": "attr", @@ -122,10 +122,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000008 ], - "condition": 60000008, + "condition_or": [], "lbid": [ { "a": "attr", @@ -150,10 +150,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 60000009 ], - "condition": 60000009, + "condition_or": [], "lbid": [ { "a": "attr", @@ -178,10 +178,10 @@ "text": "月末狂欢,冰点特价" }, "resource": "", - "integral": [ - 3000 + "condition": [ + 70000001 ], - "condition": 70000001, + "condition_or": [], "lbid": [ { "a": "attr", diff --git a/modules/pushgiftbag/module.go b/modules/pushgiftbag/module.go index 0f8c83d47..b5a13ceca 100644 --- a/modules/pushgiftbag/module.go +++ b/modules/pushgiftbag/module.go @@ -95,14 +95,16 @@ func (this *PushGiftbag) Delivery(session comm.IUserSession, pid string) (errdat // 埋点通知 func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.ConIProgress) { var ( - confs []*cfg.GamePushGiftData - info *pb.DBPushGiftbag - user *pb.DBUser - condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress) - targets map[int32]*cfg.GamePushGiftData = make(map[int32]*cfg.GamePushGiftData) - item []*pb.DBPushGiftbagItem - ok bool - err error + confs []*cfg.GamePushGiftData + info *pb.DBPushGiftbag + user *pb.DBUser + condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress) + comdisScils []int32 = make([]int32, 0) + targets map[int32]*cfg.GamePushGiftData = make(map[int32]*cfg.GamePushGiftData) + conIProgress *pb.ConIProgress + item []*pb.DBPushGiftbagItem + ok bool + err error ) this.Debug("收到子任务进度变化推送", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "condis", Value: condis}) if confs, err = this.configure.getGamePushGift(); err != nil { @@ -122,8 +124,44 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C } for _, v := range confs { - if _, ok = condisMap[v.Condition]; ok && user.Integral >= int64(v.Integral[0]) && user.Integral <= int64(v.Integral[1]) { - targets[v.Id] = v + for _, v1 := range v.Condition { + if _, ok = condisMap[v1]; ok { + targets[v.Id] = v + comdisScils = append(comdisScils, v.Condition...) + break + } + } + } + + for _, v := range comdisScils { + if _, ok = condisMap[v]; !ok { //条件不全需要查询全部条件 + if condis, err = this.ModuleBuried.CheckCondition(session.GetUserId(), comdisScils...); err != nil { + this.Error("校验玩家子任务进度数据 失败", log.Field{Key: "err", Value: err.Error()}) + return + } + condisMap = make(map[int32]*pb.ConIProgress) + for _, v := range condis { + condisMap[v.Conid] = v + } + break + } + } + + for k, v := range targets { + for _, cid := range v.Condition { + if conIProgress, ok = condisMap[cid]; !ok || conIProgress.State == pb.BuriedItemFinishState_buried_unfinish { //未完成 + delete(targets, k) + } + } + for _, cid := range v.ConditionOr { + if conIProgress, ok = condisMap[cid]; ok && conIProgress.State == pb.BuriedItemFinishState_buried_finish { //完成一个即可 + ok = true + break + } + ok = false + } + if !ok { + delete(targets, k) } } diff --git a/sys/configure/structs/Game.BuffType.go b/sys/configure/structs/Game.BuffType.go index 708c19488..d1b179343 100644 --- a/sys/configure/structs/Game.BuffType.go +++ b/sys/configure/structs/Game.BuffType.go @@ -86,4 +86,9 @@ const ( GameBuffType_SHILED_CAN_ADD = 93 GameBuffType_SPECIAL_SHIELD = 94 GameBuffType_PROB_RESISTBUFF = 95 + GameBuffType_HAS_BUFF_MODIFY_EFFECT_RESIST = 96 + GameBuffType_ADJUST_PRO_BY_DMG = 97 + GameBuffType_BE_DMG_ADD_ONCE_PER_PERSON = 98 + GameBuffType_IGNORE_EFFECT_RESIST = 99 + GameBuffType_IGNORE_IMMUNITY = 100 ) diff --git a/sys/configure/structs/Game.PropertyType.go b/sys/configure/structs/Game.PropertyType.go index dd4c311e8..f402697f4 100644 --- a/sys/configure/structs/Game.PropertyType.go +++ b/sys/configure/structs/Game.PropertyType.go @@ -118,5 +118,6 @@ const ( GamePropertyType_Shield_Per = 106 GamePropertyType_Base_Shield = 107 GamePropertyType_Ext_Shield = 108 - GamePropertyType_Max = 109 + GamePropertyType_TreCrit = 109 + GamePropertyType_Max = 110 ) diff --git a/sys/configure/structs/Game.PushGiftData.go b/sys/configure/structs/Game.PushGiftData.go index 3de203688..5af4d6dad 100644 --- a/sys/configure/structs/Game.PushGiftData.go +++ b/sys/configure/structs/Game.PushGiftData.go @@ -15,8 +15,8 @@ type GamePushGiftData struct { Name string Title string Resource string - Integral []int32 - Condition int32 + Condition []int32 + ConditionOr []int32 Lbid []*Gameatn Time int32 Rebate int32 @@ -39,18 +39,31 @@ func (_v *GamePushGiftData)Deserialize(_buf map[string]interface{}) (err error) { var _arr_ []interface{} var _ok_ bool - if _arr_, _ok_ = _buf["integral"].([]interface{}); !_ok_ { err = errors.New("integral error"); return } + if _arr_, _ok_ = _buf["condition"].([]interface{}); !_ok_ { err = errors.New("condition error"); return } - _v.Integral = make([]int32, 0, len(_arr_)) + _v.Condition = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.Integral = append(_v.Integral, _list_v_) + _v.Condition = append(_v.Condition, _list_v_) + } + } + + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["condition_or"].([]interface{}); !_ok_ { err = errors.New("condition_or error"); return } + + _v.ConditionOr = make([]int32, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } + _v.ConditionOr = append(_v.ConditionOr, _list_v_) } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["condition"].(float64); !_ok_ { err = errors.New("condition error"); return }; _v.Condition = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool From d247d3e72344339971c5d0b0d8d54b4000531f1f Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 16:02:02 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E7=A4=BC=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pushgiftbag/module.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/pushgiftbag/module.go b/modules/pushgiftbag/module.go index b5a13ceca..033ea550d 100644 --- a/modules/pushgiftbag/module.go +++ b/modules/pushgiftbag/module.go @@ -167,17 +167,25 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C if len(targets) > 0 { item = make([]*pb.DBPushGiftbagItem, 0) - for _, v := range info.Item { - if _, ok = targets[v.Id]; ok { - v.Stime = configure.Now().Unix() - } else { + for _, target := range targets { + ok = false + for _, v := range info.Item { + if target.Id == v.Id { + v.Stime = configure.Now().Unix() + ok = true + break + } + } + if !ok { item = append(item, &pb.DBPushGiftbagItem{ - Id: v.Id, + Id: target.Id, Stime: configure.Now().Unix(), }) } } - info.Item = append(info.Item, item...) + if len(item) > 0 { + info.Item = append(info.Item, item...) + } session.SendMsg(string(this.GetType()), "chanage", &pb.PushGiftbagChanagePush{Item: info.Item}) } } From 1d4c478bd8097d30bdf2df9993c779b0a32ce29f Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 16:26:04 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=B7=A5=E4=BC=9A=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/buried/module.go | 2 +- modules/pushgiftbag/module.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/buried/module.go b/modules/buried/module.go index baf6e0793..2b127710a 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -596,7 +596,7 @@ func (this *Buried) trigger(session comm.IUserSession, burieds ...*pb.BuriedPara } else { this.wtask.BuriedsNotify(session, changes) this.smithy.BuriedsNotify(session, changes) - this.sociaty.BuriedsNotify(session, changes) + // this.sociaty.BuriedsNotify(session, changes) } } diff --git a/modules/pushgiftbag/module.go b/modules/pushgiftbag/module.go index 033ea550d..363c09e3b 100644 --- a/modules/pushgiftbag/module.go +++ b/modules/pushgiftbag/module.go @@ -186,6 +186,9 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C if len(item) > 0 { info.Item = append(info.Item, item...) } + this.model.Change(session.GetUserId(), map[string]interface{}{ + "item": info.Item, + }) session.SendMsg(string(this.GetType()), "chanage", &pb.PushGiftbagChanagePush{Item: info.Item}) } } From f3c14c4eb74e729314b5d3e1c5f4ce176d7883ef Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 16:51:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/storyline/api_complete.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/storyline/api_complete.go b/modules/storyline/api_complete.go index 509c3452f..09a21d86f 100644 --- a/modules/storyline/api_complete.go +++ b/modules/storyline/api_complete.go @@ -146,6 +146,21 @@ func (this *apiComp) Complete(session comm.IUserSession, req *pb.StorylineComple } else if conf.Leveltype == 4 { item.Level[req.Level] = 1 item.Chapter[conf.Chapter] = configure.Now().Unix() + } else if conf.Leveltype == 5 { + if req.Report != nil { + if errdata, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil { + return + } + if !iswin { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + Message: "battle no win!", + } + return + } + } + item.Level[req.Level] = 1 } else { item.Level[req.Level] = 1 }