英雄转换碎片

This commit is contained in:
meixiongfeng 2023-02-01 17:04:27 +08:00
parent 16388621e7
commit 4f6aafdcde
3 changed files with 19 additions and 9 deletions

View File

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

View File

@ -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
}
}
// 转碎片处理

View File

@ -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 { //推送