From fdcd38e6223b2c77329bd1d1dc141ee05219fbc6 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 15 Jun 2023 18:47:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api_activationfetter.go | 3 +- modules/library/model_library.go | 42 +++++++++++++++++++++++++ modules/library/module.go | 6 ++++ modules/mline/api_challenge.go | 12 ++++--- 4 files changed, 57 insertions(+), 6 deletions(-) diff --git a/modules/library/api_activationfetter.go b/modules/library/api_activationfetter.go index 5d01e2313..412c4ff38 100644 --- a/modules/library/api_activationfetter.go +++ b/modules/library/api_activationfetter.go @@ -1,6 +1,7 @@ package library import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" ) @@ -42,7 +43,7 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library if len(fetter.Herofetter) != len(c) { errdata = &pb.ErrorData{ Code: pb.ErrorCode_LibraryNoData, - Title: pb.ErrorCode_LibraryNoData.ToString(), + Title: fmt.Sprintf("羁绊英雄数据数量不足,needLen :%d,curLen :%d", len(c), len(fetter.Herofetter)), } return } diff --git a/modules/library/model_library.go b/modules/library/model_library.go index e4d371fad..81d9d9055 100644 --- a/modules/library/model_library.go +++ b/modules/library/model_library.go @@ -81,3 +81,45 @@ func (this *modelLibrary) checkReddot19105(uid string) bool { } return false } + +// 有可激活 +func (this *modelLibrary) checkReddot19109(uid string) bool { + list := this.getLibraryList(uid) + for _, v := range list { + if v.Fidlv == 0 { + c, _ := this.module.configure.GetFriendData(v.Fid, 1) + if len(v.Herofetter) == len(c) { + return true + } + } + } + return false +} + +// 有升级的情况 非常耗性能o(╯□╰)o不建议使用 +func (this *modelLibrary) checkReddot19110(uid string) bool { + list := this.getLibraryList(uid) + for _, v := range list { + if v.Fidlv > 0 { + var totalFetterLv int32 // 羁绊累计等级 + for _, oid := range v.Herofetter { + if _d := this.module.modelFetter.getOneHeroFetter(uid, oid); _d != nil { + totalFetterLv += _d.Favorlv + } + } + for i := 1; ; i++ { + c, _err := this.module.configure.GetFriendData(v.Fid, int32(i)) + if _err != nil || len(c) == 0 { + break + } + if c[0].FavorabilityLv > totalFetterLv { + break + } + if _, ok := v.Prize[c[0].FriendId]; !ok { + return true + } + } + } + } + return false +} diff --git a/modules/library/module.go b/modules/library/module.go index 622e338fb..317028352 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -303,6 +303,12 @@ func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( case comm.Reddot19103: reddot[comm.Reddot19103] = this.modelFetter.checkReddot19103(session.GetUserId()) break + case comm.Reddot19109: + reddot[comm.Reddot19109] = this.modelLibrary.checkReddot19109(session.GetUserId()) + break + case comm.Reddot19110: + reddot[comm.Reddot19110] = this.modelLibrary.checkReddot19110(session.GetUserId()) + break } } return diff --git a/modules/mline/api_challenge.go b/modules/mline/api_challenge.go index b674005dc..508ea1c3f 100644 --- a/modules/mline/api_challenge.go +++ b/modules/mline/api_challenge.go @@ -28,6 +28,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge stageConf *cfg.GameMainStageData // 当前章节数据 preStageConf *cfg.GameMainStageData // 上一章节数据 err error + bNew bool // 是否是新章节 ) if errdata = this.ChallengeCheck(session, req); errdata != nil { @@ -86,7 +87,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge Award: map[int32]bool{}, Ps: map[int32]int32{}, } - this.module.modelMline.addNewChapter(session.GetUserId(), curChapter) + bNew = true } if v1, ok := curChapter.Ps[req.StageId]; ok && v1 != 0 { if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点 @@ -113,10 +114,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge } curChapter.Ps[req.StageId] = ps - - this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{ - "ps": curChapter.Ps, - }) + if bNew { + this.module.modelMline.addNewChapter(session.GetUserId(), curChapter) // 首次打新的章节 + } else { + this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, map[string]interface{}{"ps": curChapter.Ps}) + } } errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ Ptype: pb.PlayType_mainline,