消息异步处理

This commit is contained in:
meixiongfeng 2023-03-10 16:44:40 +08:00
parent 99bff176d7
commit a54a70ce83
4 changed files with 45 additions and 32 deletions

View File

@ -116,25 +116,29 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
} else { } else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId()) 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.Rtype53, 1) // 推送 世界任务消息
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype52, utils.ToInt32(_hero.HeroID), 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype53, 1))
// 检查是不是满级技能 // 检查是不是满级技能
maxLv := true maxLv := true
for _, skill := range _hero.NormalSkill { for _, skill := range _hero.NormalSkill {
skillMaxLv := this.module.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID)) skillMaxLv := this.module.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID))
if skill.SkillLv < skillMaxLv { // 找到没有满级的技能id if skill.SkillLv < skillMaxLv { // 找到没有满级的技能id
maxLv = false maxLv = false
break
} }
} }
if maxLv { if maxLv {
szTask = append(szTask, comm.GettaskParam(comm.Rtype54, 1))
this.module.ModuleRtask.SendToRtask(session, comm.Rtype54, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype57, 1))
this.module.ModuleRtask.SendToRtask(session, comm.Rtype57, 1)
} }
cfg := this.module.configure.GetHeroConfig(_hero.HeroID) if cfg := this.module.configure.GetHeroConfig(_hero.HeroID); cfg != nil {
if cfg != nil { szTask = append(szTask, comm.GettaskParam(comm.Rtype55, cfg.Color, 1))
this.module.ModuleRtask.SendToRtask(session, comm.Rtype55, cfg.Color, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype56, 1, 1, cfg.Job))
this.module.ModuleRtask.SendToRtask(session, comm.Rtype56, 1, 1, cfg.Job)
} }
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
return return
} }

View File

@ -83,15 +83,22 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
} else { } else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId()) 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.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star) // 推送 世界任务消息
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype6, utils.ToInt32(_hero.HeroID), _hero.Star))
szTask = append(szTask, comm.GettaskParam(comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star))
if _hero.Star == 4 { if _hero.Star == 4 {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype26, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype26, 1))
} else if _hero.Star == 5 { } else if _hero.Star == 5 {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype27, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype27, 1))
} else if _hero.Star == 6 { } else if _hero.Star == 6 {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype28, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype28, 1))
} }
this.module.ModuleRtask.SendToRtask(session, comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star) szTask = append(szTask, comm.GettaskParam(comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star)
return return
} }

View File

@ -572,27 +572,30 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
} }
if curLv-preLv > 0 { // 升级了 统计任务 if curLv-preLv > 0 { // 升级了 统计任务
// 推送 var szTask []*comm.TaskParam
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv) szTask = append(szTask, comm.GettaskParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype113, utils.ToInt32(hero.HeroID), curLv-preLv) szTask = append(szTask, comm.GettaskParam(comm.Rtype113, utils.ToInt32(hero.HeroID), curLv-preLv))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype4, utils.ToInt32(hero.HeroID), hero.Lv) szTask = append(szTask, comm.GettaskParam(comm.Rtype4, utils.ToInt32(hero.HeroID), hero.Lv))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype23, 1, hero.Star, hero.Lv) szTask = append(szTask, comm.GettaskParam(comm.Rtype23, 1, hero.Star, hero.Lv))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype24, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype24, 1))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)) szTask = append(szTask, comm.GettaskParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
cfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID)
if cfg != nil { if cfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID); cfg != nil {
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype32, 1, cfg.Color, hero.Lv) szTask = append(szTask, comm.GettaskParam(comm.Rtype32, 1, cfg.Color, hero.Lv))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, hero.JuexingLv) szTask = append(szTask, comm.GettaskParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, hero.JuexingLv))
//xx英雄满级、共鸣、觉醒至最高状态 //xx英雄满级、共鸣、觉醒至最高状态
nextAwaken := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) nextAwaken := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒 if nextAwaken == nil { // 达到满级觉醒
if hero.Lv == this.moduleHero.configure.GetHeroMaxLv(hero.Star) { if hero.Lv == this.moduleHero.configure.GetHeroMaxLv(hero.Star) {
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype37, 1, cfg.Color) szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype38, 1) szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
} }
} }
} }
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype33, 1, 1, hero.Lv) szTask = append(szTask, comm.GettaskParam(comm.Rtype33, 1, 1, hero.Lv))
go this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
//this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype33, 1, 1, hero.Lv)
} }
} }
return return

View File

@ -95,12 +95,11 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
// 查品质 // 查品质
cfg := this.configure.GetHeroConfig(heroCfgId) cfg := this.configure.GetHeroConfig(heroCfgId)
if cfg != nil { if cfg != nil {
var szTask []*comm.TaskParam var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype1, utils.ToInt32(heroCfgId))) szTask = append(szTask, comm.GettaskParam(comm.Rtype1, utils.ToInt32(heroCfgId)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype30, cfg.Color)) szTask = append(szTask, comm.GettaskParam(comm.Rtype30, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype31, cfg.Color)) szTask = append(szTask, comm.GettaskParam(comm.Rtype31, cfg.Color))
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...) go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
} }
return return
@ -759,7 +758,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
} }
szTask = append(szTask, comm.GettaskParam(comm.Rtype89, drawCount)) szTask = append(szTask, comm.GettaskParam(comm.Rtype89, drawCount))
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...) go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
} }
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) { func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {