上传武馆红点
This commit is contained in:
parent
67f57d95ea
commit
6f9a040dcf
@ -57,13 +57,72 @@ func (this *modelMartialhall) queryUserMartialhall(uid string) (result *pb.DBMar
|
|||||||
return
|
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 (
|
var (
|
||||||
err error
|
err error
|
||||||
mart *pb.DBMartialhall
|
mart *pb.DBMartialhall
|
||||||
mdata *cfg.GameKungfuMasterworkerData
|
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
|
return false
|
||||||
}
|
}
|
||||||
if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil {
|
if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil {
|
||||||
|
@ -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)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) {
|
||||||
reddot[int32(k)] = v
|
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})
|
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
|
||||||
return
|
return
|
||||||
|
@ -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) {
|
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) {
|
||||||
reddot[int32(k)] = v
|
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})
|
session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user