This commit is contained in:
liwei1dao 2022-10-25 16:54:57 +08:00
commit 65b421cbd4
20 changed files with 2383 additions and 801 deletions

View File

@ -0,0 +1,567 @@
[
{
"id": 1,
"type": [
0
],
"talentid": 40101,
"before": [
0
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 20000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
1,
1
]
},
{
"id": 2,
"type": [
0
],
"talentid": 40102,
"before": [
0
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 20000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
1,
3
]
},
{
"id": 3,
"type": [
0
],
"talentid": 40103,
"before": [
0
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 20000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
1,
5
]
},
{
"id": 4,
"type": [
1
],
"talentid": 10101,
"before": [
1
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
3,
1
]
},
{
"id": 5,
"type": [
1
],
"talentid": 10102,
"before": [
4
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
5,
1
]
},
{
"id": 6,
"type": [
1
],
"talentid": 10103,
"before": [
5
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
7,
1
]
},
{
"id": 7,
"type": [
1
],
"talentid": 10104,
"before": [
6,
23
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
9,
1
]
},
{
"id": 8,
"type": [
1
],
"talentid": 10105,
"before": [
7
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
11,
1
]
},
{
"id": 9,
"type": [
1
],
"talentid": 10106,
"before": [
8
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
13,
1
]
},
{
"id": 10,
"type": [
2
],
"talentid": 20101,
"before": [
2
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
3,
3
]
},
{
"id": 11,
"type": [
2
],
"talentid": 20102,
"before": [
10
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
5,
3
]
},
{
"id": 12,
"type": [
2
],
"talentid": 20103,
"before": [
11,
5,
18
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
7,
3
]
},
{
"id": 13,
"type": [
2
],
"talentid": 20104,
"before": [
23,
24
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
9,
3
]
},
{
"id": 14,
"type": [
2
],
"talentid": 20105,
"before": [
7,
13,
20
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
11,
3
]
},
{
"id": 15,
"type": [
2
],
"talentid": 20106,
"before": [
14
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
13,
3
]
},
{
"id": 16,
"type": [
2
],
"talentid": 20107,
"before": [
10
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
4,
2
]
},
{
"id": 17,
"type": [
3
],
"talentid": 30101,
"before": [
3
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
3,
5
]
},
{
"id": 18,
"type": [
3
],
"talentid": 30102,
"before": [
17
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
5,
5
]
},
{
"id": 19,
"type": [
3
],
"talentid": 30103,
"before": [
18
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
7,
5
]
},
{
"id": 20,
"type": [
3
],
"talentid": 30104,
"before": [
24
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
9,
5
]
},
{
"id": 21,
"type": [
3
],
"talentid": 30105,
"before": [
20
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
11,
5
]
},
{
"id": 22,
"type": [
3
],
"talentid": 30106,
"before": [
21
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 15000
}
],
"position": [
13,
5
]
},
{
"id": 23,
"type": [
999
],
"talentid": 99101,
"before": [
6,
12
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 40000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
8,
2
]
},
{
"id": 24,
"type": [
999
],
"talentid": 99102,
"before": [
12,
19
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 40000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
8,
4
]
},
{
"id": 25,
"type": [
999
],
"talentid": 99103,
"before": [
9,
15,
22
],
"thing": [
{
"a": "attr",
"t": "glod",
"n": 40000
},
{
"a": "attr",
"t": "diamond",
"n": 5000
}
],
"position": [
15,
3
]
}
]

View File

@ -0,0 +1,434 @@
[
{
"skillid": 40101,
"skilltyp": 0,
"skillname": "生命核心",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_icon_006",
"hp": -1,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 40102,
"skilltyp": 0,
"skillname": "攻击核心",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_icon_004",
"hp": -1,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 40103,
"skilltyp": 0,
"skillname": "防御核心",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_icon_005",
"hp": -1,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10101,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10102,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10103,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10104,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10105,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10106,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10107,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10108,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10109,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 10110,
"skilltyp": 1,
"skillname": "生命天赋",
"skilltxt": "这是生命天赋的描述tips",
"skillicon": "jn_dzj_0001",
"hp": 1800,
"atk": -1,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 20101,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0002",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20102,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0003",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20103,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0004",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20104,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0005",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20105,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0006",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20106,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0007",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20107,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0008",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20108,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0009",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20109,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0010",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 20110,
"skilltyp": 1,
"skillname": "攻击天赋",
"skilltxt": "这是攻击天赋的描述tips",
"skillicon": "jn_dzj_0011",
"hp": -1,
"atk": -1,
"def": 1500,
"crt": -1,
"speed": -1
},
{
"skillid": 30101,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0012",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30102,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0013",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30103,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0014",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30104,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0015",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30105,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0016",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30106,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0017",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30107,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0018",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30108,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0019",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30109,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0020",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 30110,
"skilltyp": 1,
"skillname": "防御天赋",
"skilltxt": "这是防御天赋的描述tips",
"skillicon": "jn_dzj_0021",
"hp": -1,
"atk": 1500,
"def": -1,
"crt": -1,
"speed": -1
},
{
"skillid": 99101,
"skilltyp": 2,
"skillname": "攻速天赋",
"skilltxt": "这是攻速天赋的描述tips",
"skillicon": "jn_icon_027",
"hp": -1,
"atk": -1,
"def": -1,
"crt": -1,
"speed": 3000
},
{
"skillid": 99102,
"skilltyp": 2,
"skillname": "攻速天赋",
"skilltxt": "这是攻速天赋的描述tips",
"skillicon": "jn_icon_027",
"hp": -1,
"atk": -1,
"def": -1,
"crt": -1,
"speed": 4000
},
{
"skillid": 99103,
"skilltyp": 2,
"skillname": "暴击天赋",
"skilltxt": "这是暴击天赋的描述tips",
"skillicon": "jn_icon_008",
"hp": -1,
"atk": -1,
"def": -1,
"crt": 10000,
"speed": -1
}
]

View File

@ -155,6 +155,9 @@ const (
///竞技场
TableArena = "arena"
// 天赋
TableTalent = "herotalent"
)
//RPC服务接口定义处

View File

@ -106,9 +106,7 @@ func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.GameInitial, err
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_initial); err != nil {
return
} else {
if v, err = this.GetConfigure(game_initial); err == nil {
if configure, ok = v.(*cfg.GameInitial); !ok {
err = fmt.Errorf("%T no is *cfg.Game_comInitial", v)
return
@ -122,15 +120,13 @@ func (this *MCompConfigure) GetGlobalAtnConf(key string) *cfg.GameComAtnData {
configure *cfg.GameComAtn
ok bool
)
if v, err := this.GetConfigure(game_comatn); err != nil {
return nil
} else {
if configure, ok = v.(*cfg.GameComAtn); !ok {
err = fmt.Errorf("%T no is *cfg.Game_comatn", v)
return nil
if v, err := this.GetConfigure(game_comatn); err == nil {
if configure, ok = v.(*cfg.GameComAtn); ok {
return configure.Get(key)
}
}
return configure.Get(key)
fmt.Errorf("%T no is *cfg.GameComAtnData", key)
return nil
}
// 主角等级经验配置列表
@ -241,7 +237,7 @@ func (this *MCompConfigure) GetColor(id int32) (item *cfg.GameGameColorData, err
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_gamecolor); err != nil {
if v, err = this.GetConfigure(game_gamecolor); err == nil {
return
} else {
if item, ok = v.(*cfg.GameGameColor).GetDataMap()[id]; !ok {

View File

@ -13,20 +13,23 @@ type apiComp struct {
}
const ( //消息回复的头名称
StrengthenUplv = "strengthenuplv"
HeroSubTypeInfo = "info" //英雄卡片信息
HeroSubTypeList = "list" //英雄列表
HeroSubTypeChouka = "chouka" //抽卡
ResonanceUseEnergy = "resonanceuseenergy" // 使用共鸣能量
Resonance = "resonance" // 英雄共鸣属性
ResonanceReset = "resonancereset" // 共鸣重置
StrengthenUpSkill = "strengthenupskill" // 技能强化
StrengthenUpStar = "strengthenupstar" // 英雄升星
Awaken = "awaken" // 英雄觉醒
HeroLock = "lock" // 英雄锁定
DrawCard = "drawcard" // 抽卡
DrawCardFloor = "drawcardfloor" // 抽卡保底
HeroFusionResp = "fusion"
StrengthenUplv = "strengthenuplv"
HeroSubTypeInfo = "info" //英雄卡片信息
HeroSubTypeList = "list" //英雄列表
HeroSubTypeChouka = "chouka" //抽卡
ResonanceUseEnergy = "resonanceuseenergy" // 使用共鸣能量
Resonance = "resonance" // 英雄共鸣属性
ResonanceReset = "resonancereset" // 共鸣重置
StrengthenUpSkill = "strengthenupskill" // 技能强化
StrengthenUpStar = "strengthenupstar" // 英雄升星
Awaken = "awaken" // 英雄觉醒
HeroLock = "lock" // 英雄锁定
DrawCard = "drawcard" // 抽卡
DrawCardFloor = "drawcardfloor" // 抽卡保底
HeroFusionResp = "fusion"
HeroTalentLearnResp = "talentlearn" // 天赋学习
HeroTalentListResp = "talentlist" // 天赋列表
HeroTalentResetResp = "talentreset" // 天赋重置
)
//组件初始化接口

View File

@ -149,7 +149,6 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
_hero.HeroID = hid
_heroMap["heroID"] = _hero.HeroID
}
}
// 保存数据
err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)

View File

@ -0,0 +1,115 @@
package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) TalentLearnCheck(session comm.IUserSession, req *pb.HeroTalentLearnReq) (code pb.ErrorCode) {
if req.TalentID <= 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
// 天赋学习
func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLearnReq) (code pb.ErrorCode, data proto.Message) {
var (
talent *pb.DBHeroTalent
err error
chanegCard []*pb.DBHero // 推送属性变化
)
chanegCard = make([]*pb.DBHero, 0)
if code = this.TalentLearnCheck(session, req); code != pb.ErrorCode_Success {
return
}
if req.ObjId != "" {
if talent, err = this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId); err != nil {
code = pb.ErrorCode_SystemError
return
}
this.module.Debugf("%v", talent)
} else {
if req.Heroid == "" { // 英雄id不能为空
code = pb.ErrorCode_ReqParameterError
return
}
// 数据校验
list, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
for _, v := range list {
if v.HeroId == req.Heroid {
talent = v
break
}
}
if talent == nil {
// 创建一条数据
talent, err = this.module.modelTalent.CreateHeroTalent(session.GetUserId(), req.Heroid)
if err != nil {
this.module.Errorf("create talent data failed:%v", err)
}
}
}
talentConf := this.module.configure.GetHeroTalent(req.TalentID)
if talentConf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// 校验
if len(talentConf.Before) == 1 && talentConf.Before[0] == 0 { // 前置解锁技能为0
if _, ok := talent.Talent[req.TalentID]; ok {
code = pb.ErrorCode_TalentRepeatLearn // 重复激活
return
}
} else {
for _, v := range talentConf.Before {
if _, ok := talent.Talent[v]; !ok {
code = pb.ErrorCode_TalentUnLockerBefore // 前置技能不满足
return
}
}
}
// 校验消耗
if code = this.module.CheckRes(session, talentConf.Thing); code != pb.ErrorCode_Success {
return
}
if code = this.module.DispenseRes(session, talentConf.Thing, true); code != pb.ErrorCode_Success {
return
}
// 校验通过可以加
talent.Talent[req.TalentID] = 1
update := make(map[string]interface{}, 0)
update["talent"] = talent.Talent
if err = this.module.modelTalent.ChangeHeroTalent(talent, update); err != nil {
this.module.Errorf("update failed :%v", err)
}
talentSkill := this.module.configure.GetHeroTalentSkill(talentConf.Talentid)
if talentSkill == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// 同步修改属性
heroList := this.module.GetHeroList(session.GetUserId())
for _, v := range heroList {
if v.HeroID == talent.HeroId { // 找到对应的英雄ID
this.module.modelHero.setTalentProperty(v, talentSkill)
chanegCard = append(chanegCard, v) // 添加推送属性变化信息
}
}
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
session.SendMsg(string(this.module.GetType()), HeroTalentLearnResp, &pb.HeroTalentLearnResp{
Telnet: talent,
TalentID: req.TalentID, // 返回刚学习过的天赋ID
})
return
}

View File

@ -0,0 +1,20 @@
package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) TalentListCheck(session comm.IUserSession, req *pb.HeroTalentListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) TalentList(session comm.IUserSession, req *pb.HeroTalentListReq) (code pb.ErrorCode, data proto.Message) {
rsp := &pb.HeroTalentListResp{}
rsp.Telnet, _ = this.module.modelTalent.GetHerotalent(session.GetUserId())
session.SendMsg(string(this.module.GetType()), HeroTalentListResp, rsp)
return
}

View File

@ -0,0 +1,55 @@
package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) TalentResetCheck(session comm.IUserSession, req *pb.HeroTalentResetReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentResetReq) (code pb.ErrorCode, data proto.Message) {
var (
heroList []*pb.DBHero
chanegCard []*pb.DBHero // 推送属性变化
)
chanegCard = make([]*pb.DBHero, 0)
heroList = this.module.GetHeroList(session.GetUserId())
rsp := &pb.HeroTalentResetResp{}
globalCnf := this.module.configure.GetGlobalAtnConf("talent_reset") // 获取重置消耗
if globalCnf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// 检查消耗够不够
if code = this.module.CheckRes(session, globalCnf.Var); code != pb.ErrorCode_Success {
return
}
if code = this.module.ConsumeRes(session, globalCnf.Var, true); code != pb.ErrorCode_Success {
return
}
list, _ := this.module.modelTalent.GetHerotalent(session.GetUserId())
for _, v := range list {
if len(v.Talent) > 0 {
update := make(map[string]interface{}, 0)
szTalent := map[int32]int32{}
update["talent"] = szTalent
this.module.modelTalent.ChangeHeroTalent(v, update)
for _, hero := range heroList {
if hero.HeroID == v.HeroId {
this.module.modelHero.cleanTalentProperty(hero)
chanegCard = append(chanegCard, hero) // 添加推送属性变化信息
}
}
}
}
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
session.SendMsg(string(this.module.GetType()), HeroTalentResetResp, rsp)
return
}

View File

@ -11,22 +11,24 @@ import (
)
const (
new_hero = "game_hero.json" //英雄
hero_stargrow = "game_herostargrow.json" //英雄品质系数
hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数
hero_starup = "game_herostarup.json" // 升星
hero_levelup = "game_herolevelup.json" //英雄等级基础属性
hero_exp = "game_heroexp.json" // 升级
hero_skillup = "game_heroskilllevel.json" // 英雄技能升级
game_skillatk = "game_skillatk.json" // 英雄技能
hero_resonance = "game_heroresonance.json" // 英雄共鸣
hero_comatn = "game_comatn.json" // 英雄共鸣重置
hero_awaken = "game_heroawaken.json" // 英雄觉醒
hero_drawcard = "game_drawcard.json" // 抽卡
hero_drawupdraw = "game_drawupdraw.json" // 抽卡概率调整
hero_drawcost = "game_drawcost.json" // 抽卡消耗
hero_fusion = "game_herofusion.json" // 卡牌融合
hero_starupsp = "game_herostarupsp.json" // 精灵升星
new_hero = "game_hero.json" //英雄
hero_stargrow = "game_herostargrow.json" //英雄品质系数
hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数
hero_starup = "game_herostarup.json" // 升星
hero_levelup = "game_herolevelup.json" //英雄等级基础属性
hero_exp = "game_heroexp.json" // 升级
hero_skillup = "game_heroskilllevel.json" // 英雄技能升级
game_skillatk = "game_skillatk.json" // 英雄技能
hero_resonance = "game_heroresonance.json" // 英雄共鸣
hero_comatn = "game_comatn.json" // 英雄共鸣重置
hero_awaken = "game_heroawaken.json" // 英雄觉醒
hero_drawcard = "game_drawcard.json" // 抽卡
hero_drawupdraw = "game_drawupdraw.json" // 抽卡概率调整
hero_drawcost = "game_drawcost.json" // 抽卡消耗
hero_fusion = "game_herofusion.json" // 卡牌融合
hero_starupsp = "game_herostarupsp.json" // 精灵升星
hero_talentskill = "game_talentskill.json" // 天赋
hero_talent = "game_herotalent.json" // 天赋详细数据
)
///配置管理组件
@ -46,20 +48,21 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Hero)
err = this.LoadMultiConfigure(map[string]interface{}{
new_hero: cfg.NewGameHero,
hero_stargrow: cfg.NewGameHeroStargrow,
hero_levelgrow: cfg.NewGameHeroLevelgrow,
hero_levelup: cfg.NewGameHeroLevelup,
hero_exp: cfg.NewGameHeroExp,
hero_skillup: cfg.NewGameHeroSkillLevel,
game_skillatk: cfg.NewGameSkillAtk,
hero_comatn: cfg.NewGameComAtn,
hero_drawcard: cfg.NewGameDrawCard,
hero_fusion: cfg.NewGameHerofusion,
hero_starupsp: cfg.NewGameHeroStarupSp,
new_hero: cfg.NewGameHero,
hero_stargrow: cfg.NewGameHeroStargrow,
hero_levelgrow: cfg.NewGameHeroLevelgrow,
hero_levelup: cfg.NewGameHeroLevelup,
hero_exp: cfg.NewGameHeroExp,
hero_skillup: cfg.NewGameHeroSkillLevel,
game_skillatk: cfg.NewGameSkillAtk,
hero_comatn: cfg.NewGameComAtn,
hero_drawcard: cfg.NewGameDrawCard,
hero_fusion: cfg.NewGameHerofusion,
hero_starupsp: cfg.NewGameHeroStarupSp,
hero_talentskill: cfg.NewGameTalentSkill,
hero_talent: cfg.NewGameHeroTalent,
})
this.drawCardCfg = make(map[string]map[int32][]*cfg.GameDrawCardData, 0)
configure.RegisterConfigure(hero_drawcard, cfg.NewGameDrawCard, this.SetHeroDrawConfig)
this.awakenMap = make(map[int64]*cfg.GameHeroAwakenData, 0)
configure.RegisterConfigure(hero_awaken, cfg.NewGameHeroAwaken, func() {
@ -105,8 +108,11 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
}
})
hid := this.GetHeroSpriteStar("43901")
fmt.Printf("%s", hid)
// 测试接口 功能完成后删
// _data := this.GetHeroTalentSkill(20101)
// _data1 := this.GetHeroTalent(1)
// this.module.Debugf("%v,%v", _data, _data1)
return
}
@ -356,7 +362,6 @@ func (this *configureComp) GetHeroSkillMaxLvConfig(skillId uint32) int32 {
if v, err := this.GetConfigure(game_skillatk); err == nil {
if configure, ok := v.(*cfg.GameSkillAtk); ok {
//return configure.Get(int32(skillId)).MaxLV
for _, v1 := range configure.GetDataList() {
if v1.Id == int32(skillId) {
return v1.MaxLV
@ -373,16 +378,12 @@ func (this *configureComp) GetHeroResonanceRestConfig() (data *cfg.GameComAtnDat
v interface{}
)
if v, err = this.GetConfigure(hero_comatn); err == nil {
if configure, ok := v.(*cfg.GameComAtn); !ok {
err = fmt.Errorf("%T no is *cfg.GamecomAtn", v)
return
} else {
if configure, ok := v.(*cfg.GameComAtn); ok {
data = configure.Get("hero_reset")
return
}
} else {
err = fmt.Errorf("%T no is *cfg.game_comatn", v)
}
this.module.Errorf("cfg.GameComAtnData GetHeroResonanceRestConfig:id = hero_reset")
return
}
@ -390,29 +391,44 @@ func (this *configureComp) GetHeroResonanceRestConfig() (data *cfg.GameComAtnDat
func (this *configureComp) GetHeroFucionConfig(cid string) (data *cfg.GameHerofusionData) {
if v, err := this.GetConfigure(hero_fusion); err == nil {
if configure, ok := v.(*cfg.GameHerofusion); !ok {
err = fmt.Errorf("%T no is *cfg.GameHerofusionData", v)
return
} else {
if configure, ok := v.(*cfg.GameHerofusion); ok {
data = configure.Get(cid)
return
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHerofusionData", v)
}
this.module.Errorf("cfg.GameHerofusionData GetHeroFucionConfig:id = %s", cid)
return
}
func (this *configureComp) GetHeroSpriteStar(cid string) (hid string) {
if v, err := this.GetConfigure(hero_starupsp); err == nil {
if configure, ok := v.(*cfg.GameHeroStarupSp); !ok {
err = fmt.Errorf("%T no is *cfg.GameHerofusionData", v)
return
} else {
hid = configure.Get(cid).Starid
return
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHerofusionData", v)
}
return
this.module.Errorf("cfg.GameHeroStarupSpData GetHeroSpriteStar:id = %s", cid)
return ""
}
func (this *configureComp) GetHeroTalent(id int32) (data *cfg.GameHeroTalentData) {
if v, err := this.GetConfigure(hero_talent); err == nil {
if configure, ok := v.(*cfg.GameHeroTalent); ok {
data = configure.Get(id)
return
}
}
this.module.Errorf("cfg.GameHeroTalentData GetHeroTalent:id = %d", id)
return nil
}
func (this *configureComp) GetHeroTalentSkill(skillId int32) (data *cfg.GameTalentSkillData) {
if v, err := this.GetConfigure(hero_talentskill); err == nil {
if configure, ok := v.(*cfg.GameTalentSkill); ok {
data = configure.Get(skillId)
return
}
}
this.module.Errorf("cfg.GameTalentSkillData GetHeroTalentSkill:skillId = %d", skillId)
return nil
}

View File

@ -274,11 +274,11 @@ func (this *ModelHero) setJuexingProperty(hero *pb.DBHero, key string, value int
case comm.Speed:
hero.JuexProperty[comm.Speed] += value
case comm.ResonanceHpPro:
hero.JuexProperty[comm.Hp] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Hp])))
hero.JuexProperty[comm.Hp] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Hp])))
case comm.ResonanceAtkPro:
hero.JuexProperty[comm.Atk] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Atk])))
hero.JuexProperty[comm.Atk] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Atk])))
case comm.ResonanceDefPro:
hero.JuexProperty[comm.Def] += int32(math.Floor((1.0 + float64(value)/1000) * float64(hero.Property[comm.Def])))
hero.JuexProperty[comm.Def] += int32(math.Floor((float64(value) / 1000)) * float64(hero.Property[comm.Def]))
}
}
@ -694,3 +694,44 @@ func (this *ModelHero) InitTempHero(heroCfgId string, star, lv int32) *pb.DBHero
this.initHeroSkill(newHero)
return newHero
}
//设置天赋属性
func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameTalentSkillData) {
if conf == nil || hero == nil {
return
}
if conf.Hp != -1 {
hero.TalentProperty[comm.Hp] += int32(math.Floor((float64(conf.Hp) / 1000) * float64(hero.Property[comm.Hp])))
}
if conf.Atk != -1 {
hero.TalentProperty[comm.Atk] += int32(math.Floor((float64(conf.Atk) / 1000) * float64(hero.Property[comm.Atk])))
}
if conf.Def != -1 {
hero.TalentProperty[comm.Def] += int32(math.Floor((float64(conf.Def) / 1000) * float64(hero.Property[comm.Def])))
}
if conf.Crt != -1 {
hero.TalentProperty[comm.Cri] += int32(math.Floor((float64(conf.Crt) / 1000) * float64(hero.Property[comm.Cri])))
}
if conf.Speed != -1 {
hero.TalentProperty[comm.Speed] += int32(math.Floor((float64(conf.Speed) / 1000) * float64(hero.Property[comm.Speed])))
}
_heroMap := make(map[string]interface{}, 0)
_heroMap["talentProperty"] = hero.TalentProperty
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
this.moduleHero.Errorf("mergeenegryProperty err %v", err)
}
}
// 重置天赋属性
func (this *ModelHero) cleanTalentProperty(hero *pb.DBHero) {
if hero == nil {
return
}
hero.TalentProperty = map[string]int32{}
_heroMap := make(map[string]interface{}, 0)
_heroMap["talentProperty"] = hero.TalentProperty
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
this.moduleHero.Errorf("mergeenegryProperty err %v", err)
}
}

View File

@ -0,0 +1,65 @@
package hero
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// 英雄天赋组件
type ModelTalent struct {
modules.MCompModel
module *Hero
}
func (this *ModelTalent) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableTalent
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Hero)
return
}
//获取用户天赋数据
func (this *ModelTalent) GetHerotalent(uid string) (result []*pb.DBHeroTalent, err error) {
result = make([]*pb.DBHeroTalent, 0)
if err = this.GetList(uid, result); err != nil && err != redis.RedisNil {
return
}
err = nil
return result, err
}
//修改天赋数据
func (this *ModelTalent) ChangeHeroTalent(talent *pb.DBHeroTalent, update map[string]interface{}) (err error) {
if talent == nil || len(update) == 0 {
return errors.New("err")
}
if err := this.ChangeList(talent.Uid, talent.Id, update); err != nil {
this.module.Debugf("ChangeHeroTalent err %v", err)
}
return nil
}
// 通过objId 查询天赋数据
func (this *ModelTalent) GetHerotalentByObjId(uid string, oid string) (talent *pb.DBHeroTalent, err error) {
result := &pb.DBHeroTalent{}
err = this.GetListObj(uid, oid, result)
return
}
// 创建一条新的英雄天赋数据
func (this *ModelTalent) CreateHeroTalent(uid, heroId string) (talent *pb.DBHeroTalent, err error) {
talent = &pb.DBHeroTalent{
Id: primitive.NewObjectID().Hex(),
Uid: "",
HeroId: heroId,
Talent: map[int32]int32{},
}
err = this.AddList(uid, talent.Id, talent)
return
}

View File

@ -23,10 +23,10 @@ type Hero struct {
api *apiComp
configure *configureComp
modelHero *ModelHero
modelRecord *ModelRecord
modelRecord *ModelRecord // 英雄抽卡保底,次数等数据
modelTalent *ModelTalent // 天赋系统
moduleFetter comm.IHeroFetter
service core.IService
service core.IService
}
//模块名
@ -47,8 +47,8 @@ func (this *Hero) OnInstallComp() {
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelHero = this.RegisterComp(new(ModelHero)).(*ModelHero)
this.modelRecord = this.RegisterComp(new(ModelRecord)).(*ModelRecord)
this.modelTalent = this.RegisterComp(new(ModelTalent)).(*ModelTalent)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *Hero) Start() (err error) {
var module core.IModule

View File

@ -45,11 +45,11 @@ func (this *ModuleBase) NewOptions() (options core.IModuleOptions) {
//模块初始化接口
func (this *ModuleBase) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
this.module = module
this.options = options.(IOptions)
this.options.GetLog().SetName("module." + string(module.GetType()))
err = this.ModuleBase.Init(service, module, options)
return
}

View File

@ -156,6 +156,7 @@ type DBHero struct {
Suite2Star int32 `protobuf:"varint,28,opt,name=suite2Star,proto3" json:"suite2Star" bson:"suite2Star"`
Suite1Lv int32 `protobuf:"varint,29,opt,name=suite1Lv,proto3" json:"suite1Lv" bson:"suite1Lv"`
Suite2Lv int32 `protobuf:"varint,30,opt,name=suite2Lv,proto3" json:"suite2Lv" bson:"suite2Lv"`
TalentProperty map[string]int32 `protobuf:"bytes,31,rep,name=talentProperty,proto3" json:"talentProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"talentProperty"` // // 天赋属性
}
func (x *DBHero) Reset() {
@ -400,6 +401,13 @@ func (x *DBHero) GetSuite2Lv() int32 {
return 0
}
func (x *DBHero) GetTalentProperty() map[string]int32 {
if x != nil {
return x.TalentProperty
}
return nil
}
type Floor struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -623,7 +631,7 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x73,
0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b,
0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xab, 0x0a, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f,
0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xb3, 0x0b, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01,
@ -686,8 +694,20 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x1a, 0x0a, 0x08, 0x73, 0x75, 0x69, 0x74, 0x65, 0x31, 0x4c, 0x76, 0x18, 0x1d, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x73, 0x75, 0x69, 0x74, 0x65, 0x31, 0x4c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x73,
0x75, 0x69, 0x74, 0x65, 0x32, 0x4c, 0x76, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73,
0x75, 0x69, 0x74, 0x65, 0x32, 0x4c, 0x76, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65,
0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x75, 0x69, 0x74, 0x65, 0x32, 0x4c, 0x76, 0x12, 0x43, 0x0a, 0x0e, 0x74, 0x61, 0x6c, 0x65, 0x6e,
0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x1b, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x50,
0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x74, 0x61,
0x6c, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d,
0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64,
0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65,
0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65,
@ -749,7 +769,7 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte {
}
var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_hero_hero_db_proto_goTypes = []interface{}{
(HeroType)(0), // 0: HeroType
(*SkillData)(nil), // 1: SkillData
@ -853,7 +873,7 @@ func file_hero_hero_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_hero_hero_db_proto_rawDesc,
NumEnums: 1,
NumMessages: 11,
NumMessages: 12,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameHeroTalent struct {
_dataMap map[int32]*GameHeroTalentData
_dataList []*GameHeroTalentData
}
func NewGameHeroTalent(_buf []map[string]interface{}) (*GameHeroTalent, error) {
_dataList := make([]*GameHeroTalentData, 0, len(_buf))
dataMap := make(map[int32]*GameHeroTalentData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameHeroTalentData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameHeroTalent{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameHeroTalent) GetDataMap() map[int32]*GameHeroTalentData {
return table._dataMap
}
func (table *GameHeroTalent) GetDataList() []*GameHeroTalentData {
return table._dataList
}
func (table *GameHeroTalent) Get(key int32) *GameHeroTalentData {
return table._dataMap[key]
}

View File

@ -0,0 +1,97 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameHeroTalentData struct {
Id int32
Type []int32
Talentid int32
Before []int32
Thing []*Gameatn
Position []int32
}
const TypeId_GameHeroTalentData = 1749022668
func (*GameHeroTalentData) GetTypeId() int32 {
return 1749022668
}
func (_v *GameHeroTalentData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["type"].([]interface{}); !_ok_ { err = errors.New("type error"); return }
_v.Type = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Type = append(_v.Type, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["talentid"].(float64); !_ok_ { err = errors.New("talentid error"); return }; _v.Talentid = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["before"].([]interface{}); !_ok_ { err = errors.New("before error"); return }
_v.Before = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Before = append(_v.Before, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["thing"].([]interface{}); !_ok_ { err = errors.New("thing error"); return }
_v.Thing = 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.Thing = append(_v.Thing, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["position"].([]interface{}); !_ok_ { err = errors.New("position error"); return }
_v.Position = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Position = append(_v.Position, _list_v_)
}
}
return
}
func DeserializeGameHeroTalentData(_buf map[string]interface{}) (*GameHeroTalentData, error) {
v := &GameHeroTalentData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameTalentSkill struct {
_dataMap map[int32]*GameTalentSkillData
_dataList []*GameTalentSkillData
}
func NewGameTalentSkill(_buf []map[string]interface{}) (*GameTalentSkill, error) {
_dataList := make([]*GameTalentSkillData, 0, len(_buf))
dataMap := make(map[int32]*GameTalentSkillData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameTalentSkillData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Skillid] = _v
}
}
return &GameTalentSkill{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameTalentSkill) GetDataMap() map[int32]*GameTalentSkillData {
return table._dataMap
}
func (table *GameTalentSkill) GetDataList() []*GameTalentSkillData {
return table._dataList
}
func (table *GameTalentSkill) Get(key int32) *GameTalentSkillData {
return table._dataMap[key]
}

View File

@ -0,0 +1,53 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameTalentSkillData struct {
Skillid int32
Skilltyp int32
Skillname string
Skilltxt string
Skillicon string
Hp int32
Atk int32
Def int32
Crt int32
Speed int32
}
const TypeId_GameTalentSkillData = -1949022189
func (*GameTalentSkillData) GetTypeId() int32 {
return -1949022189
}
func (_v *GameTalentSkillData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skillid"].(float64); !_ok_ { err = errors.New("skillid error"); return }; _v.Skillid = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skilltyp"].(float64); !_ok_ { err = errors.New("skilltyp error"); return }; _v.Skilltyp = int32(_tempNum_) }
{ var _ok_ bool; if _v.Skillname, _ok_ = _buf["skillname"].(string); !_ok_ { err = errors.New("skillname error"); return } }
{ var _ok_ bool; if _v.Skilltxt, _ok_ = _buf["skilltxt"].(string); !_ok_ { err = errors.New("skilltxt error"); return } }
{ var _ok_ bool; if _v.Skillicon, _ok_ = _buf["skillicon"].(string); !_ok_ { err = errors.New("skillicon error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hp"].(float64); !_ok_ { err = errors.New("hp error"); return }; _v.Hp = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["atk"].(float64); !_ok_ { err = errors.New("atk error"); return }; _v.Atk = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["def"].(float64); !_ok_ { err = errors.New("def error"); return }; _v.Def = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["crt"].(float64); !_ok_ { err = errors.New("crt error"); return }; _v.Crt = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["speed"].(float64); !_ok_ { err = errors.New("speed error"); return }; _v.Speed = int32(_tempNum_) }
return
}
func DeserializeGameTalentSkillData(_buf map[string]interface{}) (*GameTalentSkillData, error) {
v := &GameTalentSkillData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

File diff suppressed because it is too large Load Diff