This commit is contained in:
meixiongfeng 2022-11-21 11:45:01 +08:00
commit aa24b4d317
8 changed files with 149 additions and 10 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}