新增远征狩猎红点

This commit is contained in:
meixiongfeng 2022-12-01 17:34:45 +08:00
parent 8b3e0b900f
commit 7f7f264c65
6 changed files with 64 additions and 8 deletions

View File

@ -342,6 +342,7 @@ const (
Reddot29 ReddotType = 10029 //公会----申请红点
Reddot30 ReddotType = 10030 //邮件-----未读邮件红点
Reddot31 ReddotType = 10031 //维京远征 有挑战次数
Reddot32 ReddotType = 10032 //狩猎 有挑战次数
)
type TaskType int32

View File

@ -23,6 +23,7 @@ type (
Imail interface {
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服
IReddot
}
//道具背包接口
IItems interface {

View File

@ -59,3 +59,21 @@ func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err
err = nil
return result, err
}
// 红点检测
func (this *modelHunting) checkReddot32(uid string) bool {
conf := this.module.configure.GetGlobalConf()
if conf == nil {
return false
}
costRes := conf.HuntingCos
if costRes == nil {
return false
}
amount := int32(this.module.ModuleItems.QueryItemAmount(uid, costRes.T)) // 获取当前数量
if amount > 0 {
return true
}
return false
}

View File

@ -139,3 +139,17 @@ func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunti
this.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
}
}
//红点查询
func (this *Hunting) 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.Reddot32:
reddot[comm.Reddot32] = this.modelHunting.checkReddot32(session.GetUserId())
break
}
}
return
}

View File

@ -57,8 +57,17 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code
for k, v := range this.module.gourmet.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot26:
for k, v := range this.module.gourmet.Reddot(session, _rid) {
case comm.Reddot26, comm.Reddot30:
for k, v := range this.module.mail.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot31:
for k, v := range this.module.viking.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot32:
for k, v := range this.module.hunting.Reddot(session, _rid) {
reddot[int32(k)] = v
}
}

View File

@ -27,8 +27,10 @@ type Reddot struct {
arena comm.IArena
gourmet comm.IGourmet
sociaty comm.ISociaty
// mail comm.Imail
api_comp *apiComp
mail comm.Imail
viking comm.IViking
hunting comm.IHunting
api_comp *apiComp
}
//模块名
@ -74,10 +76,21 @@ func (this *Reddot) Start() (err error) {
return
}
this.sociaty = module.(comm.ISociaty)
// if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
// return
// }
// this.mail = module.(comm.Imail)
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
return
}
this.mail = module.(comm.Imail)
if module, err = this.service.GetModule(comm.ModuleViking); err != nil {
return
}
this.viking = module.(comm.IViking)
if module, err = this.service.GetModule(comm.ModuleHunting); err != nil {
return
}
this.hunting = module.(comm.IHunting)
return
}