羁绊红点

This commit is contained in:
meixiongfeng 2023-06-15 16:24:30 +08:00
parent 5091d2c9b9
commit 2e31065499
7 changed files with 82 additions and 8 deletions

View File

@ -455,6 +455,11 @@ const (
Reddot24 ReddotType = 10024 //熊猫武馆----可升级红点 Reddot24 ReddotType = 10024 //熊猫武馆----可升级红点
Reddot25 ReddotType = 10025 //熊猫武馆----可领取奖励红点 Reddot25 ReddotType = 10025 //熊猫武馆----可领取奖励红点
Reddot33 ReddotType = 10033 //附魔副本 有挑战次数 Reddot33 ReddotType = 10033 //附魔副本 有挑战次数
Reddot19103 ReddotType = 19103 // 当好感度奖励可以领取时,出现好感度奖励领取红点
Reddot19105 ReddotType = 19105 //当英雄等级解锁到一定程度,下方传记解锁新的传记的时候
Reddot19109 ReddotType = 19109 // 当存在好感度羁绊可以激活的时候
Reddot19110 ReddotType = 19110 // 当存在好感度羁绊可以升级的时候,好感度羁绊界面激活
) )
type TaskType int32 type TaskType int32

View File

@ -420,6 +420,7 @@ type (
// 任务完成通知 // 任务完成通知
TaskFinishNotify(uid string, taskId, fetterId int32) error TaskFinishNotify(uid string, taskId, fetterId int32) error
IGetReddot
} }
// 个人成长任务 // 个人成长任务
IGrowtask interface { IGrowtask interface {

View File

@ -37,6 +37,16 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library
} }
return 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 fetter.Fidlv = 1
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)

View File

@ -70,3 +70,15 @@ func (this *modelFetter) GetFetterByHeroId(uid, cid string) *pb.DBHeroFetter {
} }
return nil 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
}

View File

@ -59,3 +59,25 @@ func (this *modelLibrary) getOneLibrary(uid, oid string) *pb.DBLibrary {
} }
return fetter 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
}

View File

@ -291,3 +291,19 @@ func (this *Library) QueryFavorabilityByRace(uid string, race int32) int32 {
} }
return 0 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
}

View File

@ -4,6 +4,8 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" 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 break
} }
} }
if curChapter == nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return
}
if stageConf.Previoustage != 0 { // 前置关卡是0 不需要做校验 直接通过 if stageConf.Previoustage != 0 { // 前置关卡是0 不需要做校验 直接通过
preStageConf, err = this.module.configure.GetMainStageConf(stageConf.Previoustage) preStageConf, err = this.module.configure.GetMainStageConf(stageConf.Previoustage)
@ -78,8 +73,21 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
break 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 v1, ok := curChapter.Ps[req.StageId]; ok && v1 != 0 {
if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点 if errdata = this.module.ConsumeRes(session, stageConf.PsMg, true); errdata != nil { // 扣1点
return return