diff --git a/modules/gourmet/module.go b/modules/gourmet/module.go index 3eb7b7ae6..22aea7359 100644 --- a/modules/gourmet/module.go +++ b/modules/gourmet/module.go @@ -9,6 +9,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" + "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" "math/rand" ) @@ -42,7 +43,7 @@ func (this *Gourmet) OnInstallComp() { } //红点查询 -func (this *Gourmet) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Gourmet) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { return } diff --git a/modules/hunting/module.go b/modules/hunting/module.go index d29081b5d..2bf432385 100644 --- a/modules/hunting/module.go +++ b/modules/hunting/module.go @@ -168,12 +168,15 @@ func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, repor } //红点查询 -func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot14102: - reddot[comm.Reddot14102] = this.modelHunting.checkReddot32(session) + reddot[comm.Reddot14102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot14102), + Activated: this.modelHunting.checkReddot32(session), + } break } } diff --git a/modules/library/module.go b/modules/library/module.go index 317028352..2b0f3df07 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -293,21 +293,33 @@ func (this *Library) QueryFavorabilityByRace(uid string, race int32) int32 { } // 红点 -func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Library) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot19105: - reddot[comm.Reddot19105] = this.modelLibrary.checkReddot19105(session.GetUserId()) + reddot[comm.Reddot19105] = &pb.ReddotItem{ + Rid: int32(comm.Reddot19105), + Activated: this.modelLibrary.checkReddot19105(session.GetUserId()), + } break case comm.Reddot19103: - reddot[comm.Reddot19103] = this.modelFetter.checkReddot19103(session.GetUserId()) + reddot[comm.Reddot19103] = &pb.ReddotItem{ + Rid: int32(comm.Reddot19103), + Activated: this.modelFetter.checkReddot19103(session.GetUserId()), + } break case comm.Reddot19109: - reddot[comm.Reddot19109] = this.modelLibrary.checkReddot19109(session.GetUserId()) + reddot[comm.Reddot19109] = &pb.ReddotItem{ + Rid: int32(comm.Reddot19109), + Activated: this.modelLibrary.checkReddot19109(session.GetUserId()), + } break case comm.Reddot19110: - reddot[comm.Reddot19110] = this.modelLibrary.checkReddot19110(session.GetUserId()) + reddot[comm.Reddot19110] = &pb.ReddotItem{ + Rid: int32(comm.Reddot19110), + Activated: this.modelLibrary.checkReddot19110(session.GetUserId()), + } break } } diff --git a/modules/mail/module.go b/modules/mail/module.go index 58d9d527c..553537e76 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -102,22 +102,34 @@ func (this *Mail) SendNewMail(mail *pb.DBMailData, uid ...string) bool { } //红点查询 -func (this *Mail) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Mail) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot12101: if isredot := this.modelMail.checkReddot26(session.GetUserId()); isredot { - reddot[comm.Reddot12101] = true + reddot[comm.Reddot12101] = &pb.ReddotItem{ + Rid: int32(comm.Reddot12101), + Activated: true, + } } else { - reddot[comm.Reddot12101] = false + reddot[comm.Reddot12101] = &pb.ReddotItem{ + Rid: int32(comm.Reddot12101), + Activated: false, + } } break case comm.Reddot12102: if isredot := this.modelMail.checkReddot30(session.GetUserId()); isredot { - reddot[comm.Reddot12102] = true + reddot[comm.Reddot12102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot12101), + Activated: true, + } } else { - reddot[comm.Reddot12102] = false + reddot[comm.Reddot12102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot12101), + Activated: false, + } } break } diff --git a/modules/mline/module.go b/modules/mline/module.go index 3065ee45b..2bf28d953 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -50,11 +50,14 @@ func (this *Mline) Start() (err error) { } //红点查询 -func (this *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { if v == comm.Reddot24100 { - reddot[comm.Reddot24100] = this.CheckPoint(session.GetUserId()) + reddot[comm.Reddot24100] = &pb.ReddotItem{ + Rid: int32(comm.Reddot24100), + Activated: this.CheckPoint(session.GetUserId()), + } break } } diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index d83d347e5..8927db281 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -145,12 +145,15 @@ func (this *Pagoda) SetPagodaRankList(tableName string, score int64, uid string) } //红点查询 -func (this *Pagoda) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Pagoda) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot6: - reddot[comm.Reddot6] = this.CheckPoint6(session.GetUserId()) + reddot[comm.Reddot6] = &pb.ReddotItem{ + Rid: int32(comm.Reddot6), + Activated: this.CheckPoint6(session.GetUserId()), + } break } diff --git a/modules/smithy/module.go b/modules/smithy/module.go index 72540b167..7d189d37f 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -122,18 +122,27 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { return } -func (this *Smithy) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Smithy) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot17102: // 铁匠铺手册台 - reddot[comm.Reddot17102] = this.modelAtlas.checkReddot17102(session.GetUserId()) + reddot[comm.Reddot17102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot17102), + Activated: this.modelAtlas.checkReddot17102(session.GetUserId()), + } break case comm.Reddot17107: // 铁匠铺手册台收藏家奖励按钮上 - reddot[comm.Reddot17107] = this.modelTask.checkReddot17107(session.GetUserId()) + reddot[comm.Reddot17107] = &pb.ReddotItem{ + Rid: int32(comm.Reddot17107), + Activated: this.modelTask.checkReddot17107(session.GetUserId()), + } break case comm.Reddot17106: // - reddot[comm.Reddot17106] = this.modelAtlas.checkReddot17106(session.GetUserId()) + reddot[comm.Reddot17106] = &pb.ReddotItem{ + Rid: int32(comm.Reddot17106), + Activated: this.modelAtlas.checkReddot17106(session.GetUserId()), + } break } diff --git a/modules/viking/module.go b/modules/viking/module.go index d16ee5938..2541f2552 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -176,12 +176,15 @@ func (this *Viking) CheckRank(uid string, boosID int32, difficulty int32, report } //红点查询 -func (this *Viking) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { - reddot = make(map[comm.ReddotType]bool) +func (this *Viking) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) { + reddot = make(map[comm.ReddotType]*pb.ReddotItem) for _, v := range rid { switch v { case comm.Reddot13102: - reddot[comm.Reddot13102] = this.modelViking.checkReddot31(session) + reddot[comm.Reddot13102] = &pb.ReddotItem{ + Rid: int32(comm.Reddot13102), + Activated: this.modelViking.checkReddot31(session), + } break } diff --git a/modules/worldtask/api_mine.go b/modules/worldtask/api_mine.go index 15a333d15..b2454e142 100644 --- a/modules/worldtask/api_mine.go +++ b/modules/worldtask/api_mine.go @@ -47,8 +47,8 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( //查询当前所有任务组下的完成条件数据 var condIds []int32 - condMap := make(map[int32][]int32) - for k, v := range myWorldtask.CurrentTasks { + // condMap := make(map[int32][]int32) + for _, v := range myWorldtask.CurrentTasks { for _, t := range v.TaskMap { cfg, err := this.module.configure.getWorldtaskById(t.TaskId) if err != nil { @@ -62,7 +62,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( if (len(cfg.Completetask) >= 1 && cfg.Completetask[0] > 0) && len(cfg.Completetask) > 0 { condIds = append(condIds, cfg.Completetask...) - condMap[k] = cfg.Completetask + // condMap[k] = cfg.Completetask } } @@ -82,19 +82,21 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( return } - for k, v := range condMap { - if mw, ok := myWorldtask.CurrentTasks[k]; ok { - for _, task := range mw.TaskMap { - for _, cond := range conds { - if _, ok := utils.Findx(v, cond.Conid); ok { - task.Conds = append(task.Conds, cond) - } + // for k, v := range condMap { + for _, mw := range myWorldtask.CurrentTasks { + for _, task := range mw.TaskMap { + task.Conds = make([]*pb.ConIProgress, 0) + _cfg, _ := this.module.configure.getWorldtaskById(task.TaskId) + for _, cond := range conds { + if _, ok := utils.Findx(_cfg.Completetask, cond.Conid); ok { + task.Conds = append(task.Conds, cond) } } } - } + // } + rsp := &pb.WorldtaskMineResp{ Task: myWorldtask, } diff --git a/modules/worldtask/configure.go b/modules/worldtask/configure.go index 4313cf712..b2b9ae2e9 100644 --- a/modules/worldtask/configure.go +++ b/modules/worldtask/configure.go @@ -20,7 +20,7 @@ const ( type configureComp struct { modules.MCompConfigure lock sync.RWMutex - worldtaskConf map[int32]*cfg.GameWorldTaskData //key 条件ID + worldtaskConf map[int32]*cfg.GameWorldTaskData //key 条件ID } func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {