diff --git a/modules/horoscope/configure.go b/modules/horoscope/configure.go index e9e4eaa23..07d24e141 100644 --- a/modules/horoscope/configure.go +++ b/modules/horoscope/configure.go @@ -69,7 +69,7 @@ func (this *configureComp) getHeroConfig(id string) (result *cfg.GameHeroData, e v interface{} ok bool ) - if v, err = this.GetConfigure(game_horoscope); err != nil { + if v, err = this.GetConfigure(game_hero); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameHero).GetDataMap()[id]; !ok { @@ -79,3 +79,20 @@ func (this *configureComp) getHeroConfig(id string) (result *cfg.GameHeroData, e } return } + +//查询下一个节点 +func (this *configureComp) getHoroscopes() (result *cfg.GameHoroscope, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(game_horoscope); err != nil { + this.module.Errorln(err) + } else { + if result, ok = v.(*cfg.GameHoroscope); !ok { + err = fmt.Errorf("on found game_horoscope 类型异常") + this.module.Errorln(err) + } + } + return +} diff --git a/modules/horoscope/modelhoroscope.go b/modules/horoscope/modelhoroscope.go index 6662532da..ce6875567 100644 --- a/modules/horoscope/modelhoroscope.go +++ b/modules/horoscope/modelhoroscope.go @@ -139,3 +139,29 @@ func (this *modelHoroscope) compute(info *pb.DBHoroscope, hero *pb.DBHero) (err } return } + +func (this *modelHoroscope) reddot(session comm.IUserSession) bool { + var ( + info *pb.DBHoroscope + horoscope *cfg.GameHoroscope + code pb.ErrorCode + err error + ) + if info, err = this.queryInfo(session.GetUserId()); err != nil { + return false + } + if horoscope, err = this.module.configure.getHoroscopes(); err != nil { + return false + } + + for _, v := range horoscope.GetDataList() { + + if lv, ok := info.Nodes[v.NodeId]; !ok && v.Lv > lv { + + if code = this.module.CheckRes(session, v.CostItem); code == pb.ErrorCode_Success { + return true + } + } + } + return false +} diff --git a/modules/horoscope/module.go b/modules/horoscope/module.go index deccbd596..71506aa44 100644 --- a/modules/horoscope/module.go +++ b/modules/horoscope/module.go @@ -59,11 +59,14 @@ func (this *Horoscope) ComputeHeroNumeric(uid string, hero ...*pb.DBHero) { } //红点需求 -func (this *Horoscope) Reddot(uid string, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) { +func (this *Horoscope) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) { result = make(map[comm.ReddotType]bool) for _, v := range rid { switch v { case comm.Reddot17: + if isredot := this.modelHoroscope.reddot(session); isredot { + result[comm.Reddot17] = true + } break } } diff --git a/modules/martialhall/modelMartialhall.go b/modules/martialhall/modelMartialhall.go index 4b014b73a..2f9875221 100644 --- a/modules/martialhall/modelMartialhall.go +++ b/modules/martialhall/modelMartialhall.go @@ -57,13 +57,72 @@ func (this *modelMartialhall) queryUserMartialhall(uid string) (result *pb.DBMar return } -func (this *modelMartialhall) checkReddot(uid string) bool { +//可领取红点 +func (this *modelMartialhall) checkReddot23(seesion comm.IUserSession) bool { + var ( + err error + mart *pb.DBMartialhall + mdata *cfg.GameKungfuMasterworkerData + code pb.ErrorCode + ) + if mart, err = this.module.modelMartialhall.queryUserMartialhall(seesion.GetUserId()); err != nil { + return false + } + if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil { + return false + } + if code = this.module.CheckRes(seesion, mdata.Deplete); code != pb.ErrorCode_Success { + return false + } + if mart.Pillar1.State == pb.PillarState_NoUse { + return true + } + if mart.Pillar2.State == pb.PillarState_NoUse { + return true + } + if mart.Pillar3.State == pb.PillarState_NoUse { + return true + } + if mart.Pillar4.State == pb.PillarState_NoUse { + return true + } + if mart.Pillar5.State == pb.PillarState_NoUse { + return true + } + return false +} + +//可领取红点 +func (this *modelMartialhall) checkReddot24(seesion comm.IUserSession) bool { + var ( + err error + mart *pb.DBMartialhall + mdata *cfg.GameKungfuMasterworkerData + code pb.ErrorCode + ) + if mart, err = this.module.modelMartialhall.queryUserMartialhall(seesion.GetUserId()); err != nil { + return false + } + if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil { + return false + } + if mdata.LevelDeplete != nil && len(mdata.LevelDeplete) > 0 { + if code = this.module.CheckRes(seesion, mdata.LevelDeplete); code != pb.ErrorCode_Success { + return false + } + + } + return false +} + +//可领取红点 +func (this *modelMartialhall) checkReddot25(seesion comm.IUserSession) bool { var ( err error mart *pb.DBMartialhall mdata *cfg.GameKungfuMasterworkerData ) - if mart, err = this.module.modelMartialhall.queryUserMartialhall(uid); err != nil { + if mart, err = this.module.modelMartialhall.queryUserMartialhall(seesion.GetUserId()); err != nil { return false } if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil { diff --git a/modules/martialhall/module.go b/modules/martialhall/module.go index 40cb48538..c8305cedb 100644 --- a/modules/martialhall/module.go +++ b/modules/martialhall/module.go @@ -51,8 +51,26 @@ func (this *Martialhall) OnInstallComp() { } //红点查询 -func (this *Martialhall) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Martialhall) 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.Reddot23: + if isredot := this.modelMartialhall.checkReddot23(session); isredot { + reddot[comm.Reddot23] = true + } + break + case comm.Reddot24: + if isredot := this.modelMartialhall.checkReddot24(session); isredot { + reddot[comm.Reddot24] = true + } + break + case comm.Reddot25: + if isredot := this.modelMartialhall.checkReddot25(session); isredot { + reddot[comm.Reddot25] = true + } + break + } + } return } diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go index dca87e97c..9c80b4807 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -40,12 +40,16 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { reddot[int32(k)] = v } + case int32(comm.Reddot17): + for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) { + reddot[int32(k)] = v + } + case int32(comm.Reddot23), int32(comm.Reddot24), int32(comm.Reddot25): + for k, v := range this.module.martialhall.Reddot(session, comm.Reddot2) { + reddot[int32(k)] = v + } } - } - // for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) { - // reddot[int32(k)] = v - // } session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot}) return } diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index 28b81215a..f1cf72096 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -30,6 +30,13 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) { reddot[int32(k)] = v } + for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) { + reddot[int32(k)] = v + } + for k, v := range this.module.martialhall.Reddot(session, comm.Reddot23, comm.Reddot24, comm.Reddot25) { + reddot[int32(k)] = v + } + session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot}) return } diff --git a/modules/reddot/module.go b/modules/reddot/module.go index 9d5334943..64da2c262 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -23,6 +23,7 @@ type Reddot struct { mainline comm.IMainline pagoda comm.IPagoda martialhall comm.IMartialhall + horoscope comm.IHoroscope api_comp *apiComp } @@ -52,6 +53,10 @@ func (this *Reddot) Start() (err error) { return } this.martialhall = module.(comm.IMartialhall) + if module, err = this.service.GetModule(comm.ModuleHoroscope); err != nil { + return + } + this.horoscope = module.(comm.IHoroscope) return }