From 8cc6973ac284dce2df105c954f47c06c5decee25 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 23 Dec 2022 19:56:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E6=8E=89waring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/enchant/api_getlist.go | 12 ++++++------ modules/hunting/api_getlist.go | 6 +++--- modules/viking/api_getlist.go | 6 +++--- modules/viking/module.go | 4 +--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/enchant/api_getlist.go b/modules/enchant/api_getlist.go index 0aab71377..25b202d74 100644 --- a/modules/enchant/api_getlist.go +++ b/modules/enchant/api_getlist.go @@ -48,15 +48,15 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListRe code = pb.ErrorCode_ConfigNoFound return } - iContt := conf.EnchantbossInitial + iCont := conf.EnchantbossInitial atn := conf.EnchantbossCos - if iContt > 0 { - - this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{ + if iCont > 0 { + res := &cfg.Gameatn{ A: atn.A, T: atn.T, - N: iContt, - }}, true) + N: iCont, + } + this.module.DispenseRes(session, []*cfg.Gameatn{res}, true) } } else if err != nil { code = pb.ErrorCode_DBError diff --git a/modules/hunting/api_getlist.go b/modules/hunting/api_getlist.go index 0f045710c..0c96149aa 100644 --- a/modules/hunting/api_getlist.go +++ b/modules/hunting/api_getlist.go @@ -54,12 +54,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListRe iCont := conf.HuntingNum atn := conf.HuntingCos if iCont > 0 { - - this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{ + res := &cfg.Gameatn{ A: atn.A, T: atn.T, N: iCont, - }}, true) + } + this.module.DispenseRes(session, []*cfg.Gameatn{res}, true) } } else if err != nil { diff --git a/modules/viking/api_getlist.go b/modules/viking/api_getlist.go index d98f3e058..884cd0b9f 100644 --- a/modules/viking/api_getlist.go +++ b/modules/viking/api_getlist.go @@ -54,12 +54,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq iCont := conf.VikingNum atn := conf.VikingExpeditionCos if iCont > 0 { - - this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{ + res := &cfg.Gameatn{ A: atn.A, T: atn.T, N: iCont, - }}, true) + } + this.module.DispenseRes(session, []*cfg.Gameatn{res}, true) } } diff --git a/modules/viking/module.go b/modules/viking/module.go index 5b106895b..a1a52d707 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -178,9 +178,7 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (code pb.ErrorCo } mapData["boss"] = list.Boss code = this.ModifyVikingData(session.GetUserId(), mapData) - for k := range list.Boss { - list.Boss[k] += 1 - } + session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) return } From 203e75da21f649a8721cea00a63b45eec294af3e Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 26 Dec 2022 15:28:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=88=98=E6=96=97=E5=A5=96=E5=8A=B1?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/viking/api_challengeover.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index a5b66cd5a..d88f0c34a 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -5,6 +5,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + "strconv" "google.golang.org/protobuf/proto" ) @@ -21,11 +22,10 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Vikin ///挑战完成 func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChallengeOverReq) (code pb.ErrorCode, data proto.Message) { var ( - mapData map[string]interface{} - newChallenge bool // 新的关卡 - reward []*cfg.Gameatn - asset []*pb.UserAssets - bWin bool // 战斗是否胜利 + mapData map[string]interface{} + reward []*cfg.Gameatn + asset []*pb.UserAssets + bWin bool // 战斗是否胜利 ) mapData = make(map[string]interface{}, 0) reward = make([]*cfg.Gameatn, 0) @@ -63,9 +63,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal if !ok { // 类型校验 viking.Boss[req.BossId] = 1 } - if value == req.Difficulty { - newChallenge = true - } else if value < req.Difficulty { + if value < req.Difficulty { code = pb.ErrorCode_HuntingLvErr return } @@ -90,11 +88,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal mapData["recoveryTime"] = viking.RecoveryTime } } - if bWin { - this.module.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, viking, req.Report) - } - mapData["bossTime"] = viking.BossTime // 更新时间 - if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励 + key := strconv.Itoa(int(req.BossId)) + "_" + strconv.Itoa(int(req.Difficulty)) + if viking.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励 viking.Boss[req.BossId]++ mapData["boss"] = viking.Boss if code = this.module.DispenseRes(session, vikingCfg.Firstprize, true); code != pb.ErrorCode_Success { @@ -107,7 +102,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal N: v.N, }) } - } else { + } + if bWin { + this.module.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, viking, req.Report) reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励 if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { return @@ -120,6 +117,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal }) } } + mapData["bossTime"] = viking.BossTime // 更新时间 + code = this.module.ModifyVikingData(session.GetUserId(), mapData) // 发放通关随机奖励 session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{