抽卡返回 碎片等资源
This commit is contained in:
parent
595c870b5e
commit
353c4d0585
@ -538,6 +538,7 @@
|
||||
10,
|
||||
20,
|
||||
30
|
||||
]
|
||||
],
|
||||
"generaltp": "500000"
|
||||
}
|
||||
]
|
@ -1425,7 +1425,7 @@
|
||||
"hid": "23003",
|
||||
"name": {
|
||||
"key": "hero_23003",
|
||||
"text": "泰德·邓普顿"
|
||||
"text": "黛塔黛恩"
|
||||
},
|
||||
"star": 3,
|
||||
"color": 2,
|
||||
|
@ -6247,6 +6247,50 @@
|
||||
"text": "波比的天赋点不足"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "500000",
|
||||
"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_15005",
|
||||
"ico": "ytx_js_15005",
|
||||
"intr": {
|
||||
"key": "itemdesc_500000",
|
||||
"text": "亚力克斯天赋点"
|
||||
},
|
||||
"sale": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 1000
|
||||
}
|
||||
],
|
||||
"synthetize_deplete": [],
|
||||
"decompose_deplete": [],
|
||||
"tipstxt": {
|
||||
"key": "itemtipstxt_500000",
|
||||
"text": "波比的天赋点不足"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "1000001",
|
||||
"name": {
|
||||
|
@ -51,7 +51,7 @@ type (
|
||||
QueryHeroAmount(uId string, heroCfgId string) (amount uint32)
|
||||
|
||||
// 批量创建英雄
|
||||
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode)
|
||||
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, code pb.ErrorCode)
|
||||
// 获取英雄
|
||||
// heroId 英雄ID
|
||||
GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
||||
|
@ -161,58 +161,6 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
||||
return
|
||||
}
|
||||
|
||||
// 该方法适用创建初始英雄 叠加英雄 count叠加数量
|
||||
func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) {
|
||||
heros := make([]*pb.DBHero, 0)
|
||||
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
|
||||
return
|
||||
}
|
||||
}
|
||||
for _, h := range heros {
|
||||
if h.HeroID == heroCfgId &&
|
||||
h.IsOverlying {
|
||||
h.SameCount += count
|
||||
data := map[string]interface{}{
|
||||
"sameCount": h.SameCount, //叠加数
|
||||
}
|
||||
hero = h
|
||||
|
||||
if this.moduleHero.IsCross() {
|
||||
if model, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil {
|
||||
this.moduleHero.Errorln(err)
|
||||
} else {
|
||||
if err := model.ChangeList(uid, h.Id, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := this.ChangeList(uid, h.Id, data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return this.initHeroOverlying(uid, heroCfgId, count)
|
||||
}
|
||||
|
||||
//获取一个英雄(参数唯一objID)
|
||||
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
||||
hero := &pb.DBHero{}
|
||||
@ -863,13 +811,13 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
|
||||
}
|
||||
|
||||
// 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片
|
||||
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, err error) {
|
||||
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, err error) {
|
||||
heros := make([]*pb.DBHero, 0)
|
||||
uid := session.GetUserId()
|
||||
|
||||
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)
|
||||
@ -894,19 +842,67 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: "hero",
|
||||
T: hero.HeroID,
|
||||
N: 1,
|
||||
O: hero.Id,
|
||||
})
|
||||
}
|
||||
|
||||
// 转碎片处理
|
||||
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...)
|
||||
// 如果技能是满级 则转成其他道具
|
||||
if this.checkHeroAllSkillMax(hero) {
|
||||
list := this.moduleHero.configure.GetGlobalConf().Moonshopmoney
|
||||
if list != nil {
|
||||
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
|
||||
for pos, v := range list {
|
||||
if int32(pos)+3 == heroCfg.Star && v > 0 {
|
||||
res := make([]*cfg.Gameatn, 0)
|
||||
|
||||
res = append(res, &cfg.Gameatn{
|
||||
A: "attr",
|
||||
T: "moongold",
|
||||
N: v * count,
|
||||
})
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: "attr",
|
||||
T: "moongold",
|
||||
N: v * count,
|
||||
})
|
||||
this.moduleHero.DispenseRes(session, res, true)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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...)
|
||||
for _, v := range heroCfg.Herofrag {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
}
|
||||
this.moduleHero.DispenseRes(session, res, true)
|
||||
}
|
||||
this.moduleHero.DispenseRes(session, res, true)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 校验当前技能是否是满级
|
||||
func (this *ModelHero) checkHeroAllSkillMax(hero *pb.DBHero) bool {
|
||||
for _, v := range hero.NormalSkill {
|
||||
if this.moduleHero.configure.GetHeroSkillMaxLvConfig(uint32(v.SkillID)) > v.SkillLv {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ func (this *Hero) Start() (err error) {
|
||||
}
|
||||
|
||||
//创建单个叠加英雄
|
||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, code pb.ErrorCode) {
|
||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
hero, bFirst, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||
hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||
if err == nil && bFirst {
|
||||
//go func(uid string, heroCfgId string) { // 携程处理 图鉴数据
|
||||
if db.IsCross() {
|
||||
@ -256,7 +256,7 @@ func (this *Hero) EventUserOffline(session comm.IUserSession) {
|
||||
}
|
||||
|
||||
// 批量创建多个英雄
|
||||
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode) {
|
||||
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, code pb.ErrorCode) {
|
||||
var (
|
||||
changeList []*pb.DBHero
|
||||
firstGet []string
|
||||
@ -266,7 +266,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
||||
if num == 0 { // 数量为0 不做处理
|
||||
continue
|
||||
}
|
||||
if hero, bFirst, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
||||
if hero, bFirst, atno, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
||||
this.Errorf("create hero %s failed", heroCfgId)
|
||||
continue
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
this.Debugf("发放道具资源: %v [%v]", items, code)
|
||||
}
|
||||
if len(heros) > 0 { //卡片资源
|
||||
_, code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||
_, _, code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||
this.Debugf("发放英雄资源: %v [%v]", heros, code)
|
||||
}
|
||||
if len(equips) > 0 {
|
||||
@ -576,14 +576,9 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea
|
||||
}
|
||||
}
|
||||
if len(heros) > 0 { //卡片资源
|
||||
hero, code := this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||
this.Debugf("发放英雄资源: %v [%v]", heros, code)
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: "hero",
|
||||
T: hero.HeroID,
|
||||
N: int32(len(heros)),
|
||||
O: hero.Id,
|
||||
})
|
||||
hero, atn, code := this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||
this.Debugf("发放英雄资源: %v [%v]", hero, code)
|
||||
atno = append(atno, atn...)
|
||||
}
|
||||
if len(equips) > 0 {
|
||||
change, code := this.ModuleEquipment.AddNewEquipments(session, equips, bPush)
|
||||
|
@ -174,6 +174,7 @@ type GameGlobalData struct {
|
||||
RotateAngle float32
|
||||
RotateDizzyTime float32
|
||||
Moonshopmoney []int32
|
||||
Generaltp string
|
||||
}
|
||||
|
||||
const TypeId_GameGlobalData = 477542761
|
||||
@ -736,6 +737,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; if _v.Generaltp, _ok_ = _buf["generaltp"].(string); !_ok_ { err = errors.New("generaltp error"); return } }
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user