多余英雄转碎片处理
This commit is contained in:
parent
5c4b5ffd0c
commit
4a3296a4db
File diff suppressed because it is too large
Load Diff
@ -6332,5 +6332,49 @@
|
|||||||
"key": "itemtipstxt_10017",
|
"key": "itemtipstxt_10017",
|
||||||
"text": "体力药剂不足"
|
"text": "体力药剂不足"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "625001",
|
||||||
|
"name": {
|
||||||
|
"key": "itemname_90001",
|
||||||
|
"text": "阿宝碎片"
|
||||||
|
},
|
||||||
|
"usetype": 3,
|
||||||
|
"color": 5,
|
||||||
|
"bagtype": 1,
|
||||||
|
"index": 99,
|
||||||
|
"special_type": 0,
|
||||||
|
"time": 0,
|
||||||
|
"effects": "effect_ui_wuping_2",
|
||||||
|
"box_id": 0,
|
||||||
|
"synthetize_num": 0,
|
||||||
|
"access": [
|
||||||
|
155
|
||||||
|
],
|
||||||
|
"use_skip": 155,
|
||||||
|
"upper_limit": 999,
|
||||||
|
"uselv": 0,
|
||||||
|
"isani": 0,
|
||||||
|
"star": 0,
|
||||||
|
"race": 0,
|
||||||
|
"img": "ytx_js_25001",
|
||||||
|
"ico": "ytx_js_25001",
|
||||||
|
"intr": {
|
||||||
|
"key": "itemdesc_625001",
|
||||||
|
"text": "阿宝天赋点"
|
||||||
|
},
|
||||||
|
"sale": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "gold",
|
||||||
|
"n": 1000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synthetize_deplete": [],
|
||||||
|
"decompose_deplete": [],
|
||||||
|
"tipstxt": {
|
||||||
|
"key": "itemtipstxt_625001",
|
||||||
|
"text": "阿宝的天赋点不足"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -135,7 +135,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
|||||||
)
|
)
|
||||||
hero = this.InitHero(uid, heroCfgId)
|
hero = this.InitHero(uid, heroCfgId)
|
||||||
if hero != nil {
|
if hero != nil {
|
||||||
hero.SameCount = count
|
hero.SameCount = 1 // 新需求 不需要判断叠加
|
||||||
if this.moduleHero.IsCross() {
|
if this.moduleHero.IsCross() {
|
||||||
if model, err = this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil {
|
if model, err = this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil {
|
||||||
this.moduleHero.Errorln(err)
|
this.moduleHero.Errorln(err)
|
||||||
@ -171,8 +171,11 @@ func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count i
|
|||||||
this.moduleHero.Errorf("err:%v", err)
|
this.moduleHero.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, obj := range heros {
|
||||||
if len(heros) >= 0 {
|
if obj.HeroID == heroCfgId { // z
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, h := range heros {
|
for _, h := range heros {
|
||||||
if h.HeroID == heroCfgId &&
|
if h.HeroID == heroCfgId &&
|
||||||
h.IsOverlying {
|
h.IsOverlying {
|
||||||
@ -199,7 +202,7 @@ func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count i
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return this.initHeroOverlying(uid, heroCfgId, count)
|
return this.initHeroOverlying(uid, heroCfgId, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -881,3 +884,48 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片
|
||||||
|
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, 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)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if err = dbModel.GetList(uid, &heros); err != nil {
|
||||||
|
this.moduleHero.Errorf("err:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err = this.GetList(uid, &heros); err != nil {
|
||||||
|
this.moduleHero.Errorf("err:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, obj := range heros {
|
||||||
|
if obj.HeroID == heroCfgId { // z
|
||||||
|
bNew = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bNew { // 没有当前英雄
|
||||||
|
count -= 1
|
||||||
|
hero, err = this.initHeroOverlying(uid, heroCfgId, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转碎片处理
|
||||||
|
if count > 0 {
|
||||||
|
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
|
||||||
|
if heroCfg != nil {
|
||||||
|
res := make([]*cfg.Gameatn, 0)
|
||||||
|
for i := 0; i < int(count); i++ {
|
||||||
|
res = append(res, heroCfg.Herofrag...)
|
||||||
|
}
|
||||||
|
this.moduleHero.DispenseRes(session, res, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (this *Hero) Start() (err error) {
|
|||||||
//创建单个叠加英雄
|
//创建单个叠加英雄
|
||||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
||||||
var err error
|
var err error
|
||||||
hero, err = this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
hero, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
//go func(uid string, heroCfgId string) { // 携程处理 图鉴数据
|
//go func(uid string, heroCfgId string) { // 携程处理 图鉴数据
|
||||||
if db.IsCross() {
|
if db.IsCross() {
|
||||||
|
@ -43,6 +43,8 @@ type GameHeroData struct {
|
|||||||
Angle int32
|
Angle int32
|
||||||
Deviation int32
|
Deviation int32
|
||||||
Show int32
|
Show int32
|
||||||
|
Herofrag []*Gameatn
|
||||||
|
Heroskillup []*Gameatn
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeId_GameHeroData = 1513828672
|
const TypeId_GameHeroData = 1513828672
|
||||||
@ -129,6 +131,34 @@ func (_v *GameHeroData)Deserialize(_buf map[string]interface{}) (err error) {
|
|||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["angle"].(float64); !_ok_ { err = errors.New("angle error"); return }; _v.Angle = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["angle"].(float64); !_ok_ { err = errors.New("angle error"); return }; _v.Angle = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["deviation"].(float64); !_ok_ { err = errors.New("deviation error"); return }; _v.Deviation = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["deviation"].(float64); !_ok_ { err = errors.New("deviation error"); return }; _v.Deviation = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["show"].(float64); !_ok_ { err = errors.New("show error"); return }; _v.Show = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["show"].(float64); !_ok_ { err = errors.New("show error"); return }; _v.Show = int32(_tempNum_) }
|
||||||
|
{
|
||||||
|
var _arr_ []interface{}
|
||||||
|
var _ok_ bool
|
||||||
|
if _arr_, _ok_ = _buf["herofrag"].([]interface{}); !_ok_ { err = errors.New("herofrag error"); return }
|
||||||
|
|
||||||
|
_v.Herofrag = make([]*Gameatn, 0, len(_arr_))
|
||||||
|
|
||||||
|
for _, _e_ := range _arr_ {
|
||||||
|
var _list_v_ *Gameatn
|
||||||
|
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||||
|
_v.Herofrag = append(_v.Herofrag, _list_v_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var _arr_ []interface{}
|
||||||
|
var _ok_ bool
|
||||||
|
if _arr_, _ok_ = _buf["heroskillup"].([]interface{}); !_ok_ { err = errors.New("heroskillup error"); return }
|
||||||
|
|
||||||
|
_v.Heroskillup = make([]*Gameatn, 0, len(_arr_))
|
||||||
|
|
||||||
|
for _, _e_ := range _arr_ {
|
||||||
|
var _list_v_ *Gameatn
|
||||||
|
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||||
|
_v.Heroskillup = append(_v.Heroskillup, _list_v_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user