From 2e31065499ddbc0f5a6d539590db0687a19e58d7 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 15 Jun 2023 16:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=81=E7=BB=8A=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 5 +++++ comm/imodule.go | 1 + modules/library/api_activationfetter.go | 10 ++++++++++ modules/library/model_fetter.go | 12 ++++++++++++ modules/library/model_library.go | 22 ++++++++++++++++++++++ modules/library/module.go | 16 ++++++++++++++++ modules/mline/api_challenge.go | 24 ++++++++++++++++-------- 7 files changed, 82 insertions(+), 8 deletions(-) diff --git a/comm/const.go b/comm/const.go index 9da21a8ce..85fb801eb 100644 --- a/comm/const.go +++ b/comm/const.go @@ -455,6 +455,11 @@ const ( Reddot24 ReddotType = 10024 //熊猫武馆----可升级红点 Reddot25 ReddotType = 10025 //熊猫武馆----可领取奖励红点 Reddot33 ReddotType = 10033 //附魔副本 有挑战次数 + + Reddot19103 ReddotType = 19103 // 当好感度奖励可以领取时,出现好感度奖励领取红点 + Reddot19105 ReddotType = 19105 //当英雄等级解锁到一定程度,下方传记解锁新的传记的时候 + Reddot19109 ReddotType = 19109 // 当存在好感度羁绊可以激活的时候 + Reddot19110 ReddotType = 19110 // 当存在好感度羁绊可以升级的时候,好感度羁绊界面激活 ) type TaskType int32 diff --git a/comm/imodule.go b/comm/imodule.go index 41299d8b0..64a013788 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -420,6 +420,7 @@ type ( // 任务完成通知 TaskFinishNotify(uid string, taskId, fetterId int32) error + IGetReddot } // 个人成长任务 IGrowtask interface { diff --git a/modules/library/api_activationfetter.go b/modules/library/api_activationfetter.go index 2416e8d49..5d01e2313 100644 --- a/modules/library/api_activationfetter.go +++ b/modules/library/api_activationfetter.go @@ -37,6 +37,16 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library } return } + // 检查是否有这几个英雄 + c, _ := this.configure.GetFriendData(fetter.Fid, 1) + if len(fetter.Herofetter) != len(c) { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_LibraryNoData, + Title: pb.ErrorCode_LibraryNoData.ToString(), + } + return + } + fetter.Fidlv = 1 mapData := make(map[string]interface{}, 0) diff --git a/modules/library/model_fetter.go b/modules/library/model_fetter.go index 9afb299ef..067e302e2 100644 --- a/modules/library/model_fetter.go +++ b/modules/library/model_fetter.go @@ -70,3 +70,15 @@ func (this *modelFetter) GetFetterByHeroId(uid, cid string) *pb.DBHeroFetter { } return nil } +func (this *modelFetter) checkReddot19103(uid string) bool { + list := this.getHeroFetterList(uid) + for _, v := range list { + + for i := 1; i <= int(v.Favorlv); i++ { + if _, ok := v.Lvprize[int32(i)]; !ok { // 找到了没有领奖的数据 + return true + } + } + } + return false +} diff --git a/modules/library/model_library.go b/modules/library/model_library.go index 5bc5b22ce..e4d371fad 100644 --- a/modules/library/model_library.go +++ b/modules/library/model_library.go @@ -59,3 +59,25 @@ func (this *modelLibrary) getOneLibrary(uid, oid string) *pb.DBLibrary { } return fetter } + +func (this *modelLibrary) checkReddot19105(uid string) bool { + listLabriary := this.getLibraryList(uid) + for _, v := range listLabriary { + var ( + minlv int32 // 获取最小等级 + ) + for _, v1 := range v.Herofetter { + if fet := this.module.modelFetter.getOneHeroFetter(uid, v1); fet != nil { + if minlv == 0 || minlv > fet.Favorlv { + minlv = fet.Favorlv + } + } + } + for i := 1; i <= int(minlv); i++ { + if _, ok := v.Prize[int32(i)]; !ok { // 找到了没有领奖的数据 + return true + } + } + } + return false +} diff --git a/modules/library/module.go b/modules/library/module.go index 7b40b5984..622e338fb 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -291,3 +291,19 @@ func (this *Library) QueryFavorabilityByRace(uid string, race int32) int32 { } return 0 } + +// 红点 +func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { + reddot = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot19105: + reddot[comm.Reddot19105] = this.modelLibrary.checkReddot19105(session.GetUserId()) + break + case comm.Reddot19103: + reddot[comm.Reddot19103] = this.modelFetter.checkReddot19103(session.GetUserId()) + break + } + } + return +} diff --git a/modules/mline/api_challenge.go b/modules/mline/api_challenge.go index 238da5c4f..b674005dc 100644 --- a/modules/mline/api_challenge.go +++ b/modules/mline/api_challenge.go @@ -4,6 +4,8 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" + + "go.mongodb.org/mongo-driver/bson/primitive" ) //参数校验 @@ -47,13 +49,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge break } } - if curChapter == nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_MainlineNotFindChapter, - Title: pb.ErrorCode_MainlineNotFindChapter.ToString(), - } - return - } if stageConf.Previoustage != 0 { // 前置关卡是0 不需要做校验 直接通过 preStageConf, err = this.module.configure.GetMainStageConf(stageConf.Previoustage) @@ -78,8 +73,21 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge break } } - } + } + if curChapter == nil { + curChapter = &pb.DBMline{ + Id: primitive.NewObjectID().Hex(), + Uid: session.GetUserId(), + CType: stageConf.Episodetype, + ChapterId: stageConf.Chapterid, + StageId: stageConf.Id, + Star: map[int32]int32{}, + Award: map[int32]bool{}, + Ps: map[int32]int32{}, + } + this.module.modelMline.addNewChapter(session.GetUserId(), curChapter) + } if v1, ok := curChapter.Ps[req.StageId]; ok && v1 != 0 { if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点 return