From 4f6aafdcde45f57bdce6191de9c91cd27e9c529d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 1 Feb 2023 17:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E8=BD=AC=E6=8D=A2=E7=A2=8E?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 4 ++++ modules/hero/model_hero.go | 13 ++++++++----- modules/hero/module.go | 11 +++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/comm/const.go b/comm/const.go index 5ba030703..5a9efeef1 100644 --- a/comm/const.go +++ b/comm/const.go @@ -561,6 +561,10 @@ const ( Rtype155 TaskType = 155 //调整助战英雄n次 Rtype156 TaskType = 156 //完成工会任务n次 Rtype157 TaskType = 157 //战斗在xx系统中完成xx事件 + Rtype158 TaskType = 158 //主线第X章关卡总星数达到N星 + Rtype159 TaskType = 159 //主线第X章关卡全部达到三星 + Rtype160 TaskType = 160 //主线总星数达到X星 + Rtype161 TaskType = 161 //在自动战斗过程中完成另一场战斗 ) const ( diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 682f8d478..6ab0b28eb 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -886,10 +886,9 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { } // 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片 -func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, err error) { +func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, err error) { heros := make([]*pb.DBHero, 0) uid := session.GetUserId() - bNew := false // 新活得的英雄 if this.moduleHero.IsCross() { if dbModel, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) @@ -905,14 +904,18 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c } } for _, obj := range heros { - if obj.HeroID == heroCfgId { // z - bNew = true + if obj.HeroID == heroCfgId { + hero = obj + bFirst = false break } } - if !bNew { // 没有当前英雄 + if hero != nil { // 没有当前英雄 count -= 1 hero, err = this.initHeroOverlying(uid, heroCfgId, 1) + if err != nil { + return + } } // 转碎片处理 diff --git a/modules/hero/module.go b/modules/hero/module.go index a1ea27bb4..9c977d6b3 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -77,9 +77,12 @@ func (this *Hero) Start() (err error) { //创建单个叠加英雄 func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) { - var err error - hero, err = this.modelHero.createHero(session, heroCfgId, num) - if err == nil { + var ( + err error + bFirst bool + ) + hero, bFirst, err = this.modelHero.createHero(session, heroCfgId, num) + if err == nil && bFirst { //go func(uid string, heroCfgId string) { // 携程处理 图鉴数据 if db.IsCross() { this.moduleFetter.SendRpcAddHero(session, heroCfgId) @@ -295,9 +298,9 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string] this.ModuleUser.ChangeUserExpand(session.GetUserId(), initUpdate) firstGet = append(firstGet, heroCfgId) } + changeList = append(changeList, hero) } } - changeList = append(changeList, hero) } if bPush && len(changeList) > 0 { //推送