1.公告消息推送

2.维京红点推送
This commit is contained in:
meixiongfeng 2022-11-28 15:32:36 +08:00
parent 91a9c65d03
commit 3ae9372f52
16 changed files with 103 additions and 4 deletions

View File

@ -336,6 +336,7 @@ const (
Reddot28 ReddotType = 10028 //任务----周常活跃奖励红点 Reddot28 ReddotType = 10028 //任务----周常活跃奖励红点
Reddot29 ReddotType = 10029 //公会----申请红点 Reddot29 ReddotType = 10029 //公会----申请红点
Reddot30 ReddotType = 10030 //邮件-----未读邮件红点 Reddot30 ReddotType = 10030 //邮件-----未读邮件红点
Reddot31 ReddotType = 10031 //维京远征 有挑战次数
) )
type TaskType int32 type TaskType int32

View File

@ -240,9 +240,11 @@ type (
} }
IViking interface { IViking interface {
CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录 CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录
IReddot
} }
IHunting interface { IHunting interface {
CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录 CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录
IReddot
} }
// 公会 // 公会
ISociaty interface { ISociaty interface {

View File

@ -1,6 +1,7 @@
package hero package hero
import ( import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
) )
@ -10,6 +11,7 @@ type apiComp struct {
modules.MCompGate modules.MCompGate
service core.IService service core.IService
module *Hero module *Hero
chat comm.IChat
} }
const ( //消息回复的头名称 const ( //消息回复的头名称
@ -42,6 +44,10 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core.
func (this *apiComp) Start() (err error) { func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start() err = this.MCompGate.Start()
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
return
}
this.chat = module.(comm.IChat)
return return
} }

View File

@ -104,6 +104,14 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
chanegCard = append(chanegCard, _hero) chanegCard = append(chanegCard, _hero)
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero})
//英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级!
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem11, nil, _hero.JuexingLv, 0, user.Name, _hero.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
//任务相关 //任务相关
this.module.ModuleRtask.SendToRtask(session, comm.Rtype34, 1, _hero.JuexingLv) this.module.ModuleRtask.SendToRtask(session, comm.Rtype34, 1, _hero.JuexingLv)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype119, _hero.JuexingLv) this.module.ModuleRtask.SendToRtask(session, comm.Rtype119, _hero.JuexingLv)

View File

@ -230,6 +230,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
code = this.module.CreateRepeatHeros(session, _mapAddHero, true) code = this.module.CreateRepeatHeros(session, _mapAddHero, true)
///英雄招募 【玩家名称】在招募中获得了【英雄名称】!
for hid := range _mapAddHero {
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, hid)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
}
rsp.Heroes = szCards rsp.Heroes = szCards
session.SendMsg(string(this.module.GetType()), DrawCard, rsp) session.SendMsg(string(this.module.GetType()), DrawCard, rsp)

View File

@ -149,6 +149,12 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR
this.module.DispenseRes(session, resonConfig.Prize, true) this.module.DispenseRes(session, resonConfig.Prize, true)
session.SendMsg(string(this.module.GetType()), Resonance, &pb.HeroResonanceResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), Resonance, &pb.HeroResonanceResp{Hero: _hero})
//英雄共鸣 【玩家名称】已将【英雄名称】共鸣至满级!
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem10, nil, _hero.ResonateNum, 0, user.Name, _hero.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
// 任务相关 // 任务相关
this.module.ModuleRtask.SendToRtask(session, comm.Rtype39, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype39, 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype127, _hero.Star, utils.ToInt32(_hero.HeroID), _hero.ResonateNum) //A星英雄共鸣N级 this.module.ModuleRtask.SendToRtask(session, comm.Rtype127, _hero.Star, utils.ToInt32(_hero.HeroID), _hero.ResonateNum) //A星英雄共鸣N级

View File

@ -163,7 +163,12 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
ChangeList = append(ChangeList, _hero) ChangeList = append(ChangeList, _hero)
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: ChangeList}) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: ChangeList})
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
//英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级!
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem9, nil, _hero.Lv, 0, user.Name, _hero.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
this.module.ModuleRtask.SendToRtask(session, comm.Rtype52, utils.ToInt32(_hero.HeroID), 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype52, utils.ToInt32(_hero.HeroID), 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype53, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype53, 1)
// 检查是不是满级技能 // 检查是不是满级技能
@ -175,6 +180,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
} }
} }
if maxLv { if maxLv {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype54, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype54, 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype57, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype57, 1)
} }

View File

@ -169,6 +169,12 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero})
//英雄升星 【玩家名称】已将【英雄名称】培养至6星
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem8, nil, _hero.Lv, 0, user.Name, _hero.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
this.module.ModuleRtask.SendToRtask(session, comm.Rtype6, utils.ToInt32(_hero.HeroID), _hero.Star) this.module.ModuleRtask.SendToRtask(session, comm.Rtype6, utils.ToInt32(_hero.HeroID), _hero.Star)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star) this.module.ModuleRtask.SendToRtask(session, comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star)
if _hero.Star == 4 { if _hero.Star == 4 {

View File

@ -136,6 +136,12 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
if newhero != nil { if newhero != nil {
_changeHero = append(_changeHero, newhero) // 原来的英雄 只是数量变化了 _changeHero = append(_changeHero, newhero) // 原来的英雄 只是数量变化了
} }
//英雄升级 【玩家名称】已将【英雄名称】培养至60级
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem7, nil, _hero.Lv, 0, user.Name, _hero.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: _changeHero})
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero})
return return

View File

@ -22,6 +22,7 @@ type apiComp struct {
configure *configureComp configure *configureComp
module *Hunting module *Hunting
friend comm.IFriend friend comm.IFriend
chat comm.IChat
} }
//组件初始化接口 //组件初始化接口
@ -40,5 +41,9 @@ func (this *apiComp) Start() (err error) {
return return
} }
this.friend = module.(comm.IFriend) this.friend = module.(comm.IFriend)
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
return
}
this.chat = module.(comm.IChat)
return return
} }

View File

@ -66,6 +66,10 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
BossType: req.BossType, BossType: req.BossType,
Difficulty: req.Difficulty, Difficulty: req.Difficulty,
}) })
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
return return
} }

View File

@ -147,6 +147,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
} }
} }
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData) code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem6, nil, pagoda.PagodaId, 0, user.Name)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
} }

View File

@ -22,6 +22,7 @@ type apiComp struct {
configure *configureComp configure *configureComp
module *Viking module *Viking
friend comm.IFriend friend comm.IFriend
chat comm.IChat
} }
//组件初始化接口 //组件初始化接口
@ -40,5 +41,10 @@ func (this *apiComp) Start() (err error) {
return return
} }
this.friend = module.(comm.IFriend) this.friend = module.(comm.IFriend)
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
return
}
this.chat = module.(comm.IChat)
return return
} }

View File

@ -121,7 +121,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
Data: viking, Data: viking,
Asset: asset, Asset: asset,
}) })
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
// 随机任务统计 // 随机任务统计
this.module.ModuleRtask.SendToRtask(session, comm.Rtype73, req.Difficulty, req.BossId, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype73, req.Difficulty, req.BossId, 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype74, req.Difficulty, req.BossId) this.module.ModuleRtask.SendToRtask(session, comm.Rtype74, req.Difficulty, req.BossId)

View File

@ -63,3 +63,15 @@ func (this *modelViking) getVikingList(uid string) (result *pb.DBViking, err err
func (this *modelViking) modifyVikingDataByObjId(uid string, data map[string]interface{}) error { func (this *modelViking) modifyVikingDataByObjId(uid string, data map[string]interface{}) error {
return this.Change(uid, data) return this.Change(uid, data)
} }
// 红点检测
func (this *modelViking) checkReddot31(uid string) bool {
list, err := this.module.modelViking.getVikingList(uid)
if err != nil {
return false
}
if list.LeftCount > 0 {
return true
}
return false
}

View File

@ -144,3 +144,17 @@ func (this *Viking) CheckRank(uid string, boosID int32, difficulty int32, viking
this.modulerank.SetRankListData("vikingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID) this.modulerank.SetRankListData("vikingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
} }
} }
//红点查询
func (this *Viking) 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.Reddot31:
reddot[comm.Reddot31] = this.modelViking.checkReddot31(session.GetUserId())
break
}
}
return
}