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 a603c3c33..9c80b4807 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -44,8 +44,11 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code 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 + } } - } 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 2bfa3e9b8..f1cf72096 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -33,6 +33,10 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) 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 }