diff --git a/comm/core.go b/comm/core.go index c73e4e781..cfed1b7a6 100644 --- a/comm/core.go +++ b/comm/core.go @@ -33,7 +33,7 @@ const ( SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块 SM_WebModule core.M_Modules = "web" //web模块 SM_UserModule core.M_Modules = "user" //用户模块 - SM_PackModule core.M_Modules = "pack" //背包模块 + SM_ItemsModule core.M_Modules = "items" //道具模块 SM_MailModule core.M_Modules = "mail" //邮件模块 SM_FriendModule core.M_Modules = "friend" //好友模块 SM_LogModelModule core.M_Modules = "model" //日志模块 diff --git a/comm/imodule.go b/comm/imodule.go index 499cf211d..7e7ebc97a 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -11,8 +11,8 @@ type ( Imail interface { CreateNewMail(uId string) } - //背包模块对外接口定义 提供给其他模块使用的 - IPack interface { + //道具背包接口 + IItems interface { //查询用户背包物品数量 QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) //查询用户背包多个物品数量 diff --git a/modules/game/fight/logic/FightAI.go b/modules/game/fight/logic/FightAI.go new file mode 100644 index 000000000..0a76adbb5 --- /dev/null +++ b/modules/game/fight/logic/FightAI.go @@ -0,0 +1,31 @@ +package logic + +/// +/// 构造函数 +/// +/// FightBase实例 +func newFightAI(fightBase FightBase) *FightAI { + return &FightAI{ + FightBase: &fightBase, + } +} + +type FightAI struct { + FightBase *FightBase +} + +/// +/// 自动触发技能 +/// +/// +func (this *FightAI) AutoEmitSkill(fightRole *FightRole) { + //todo...根据规则,设置对应技能和目标 + this.FightBase.EmitSkill(100012000, "bb") +} + +/// +/// 清理机制 +/// +func (this *FightAI) Clear() { + +} diff --git a/modules/game/fight/logic/FightAfterSkill.go b/modules/game/fight/logic/FightAfterSkill.go new file mode 100644 index 000000000..b3467bb89 --- /dev/null +++ b/modules/game/fight/logic/FightAfterSkill.go @@ -0,0 +1,45 @@ +package logic + +import ( + cfg "go_dreamfactory/sys/configure/structs" +) + +/// +/// 构造函数 +/// +/// 谁的技能 +/// 技能配置 +func newFightAfterSkill(role *FightRole, skillConf *cfg.Game_skillAfteratkData) *FightAfterSkill { + return &FightAfterSkill{ + OwnerRole: role, + SkillConf: skillConf, + } +} + +type FightAfterSkill struct { + //从哪个技能触发的 + OwnerRole *FightRole + //技能配置 + SkillConf *cfg.Game_skillAfteratkData +} + +/// +/// 战斗结束时的清理 +/// +func (this *FightAfterSkill) Clear() { + +} + +/// +/// 触发技能 +/// +func (this *FightAfterSkill) Emit() { + +} + +/// +/// 获取作用目标 +/// +func (this *FightAfterSkill) GetTarget() { + +} diff --git a/modules/game/fight/logic/FightBase.go b/modules/game/fight/logic/FightBase.go new file mode 100644 index 000000000..47c4221f0 --- /dev/null +++ b/modules/game/fight/logic/FightBase.go @@ -0,0 +1,45 @@ +package logic + +import "go_dreamfactory/lego/sys/event" + +type FightBase struct { + // 战斗类型 + fFightType FightType + // 战斗是否进行中 + fightIng bool + // 所有参战角色集合 + Roles []*FightRole + // 当前回合满足行动值大于等于100的所有角色 + CanAtkRoles []*FightRole + //最后一次攻击的角色 + LastActionRole *FightRole + //是否自动战斗 + AutoFight bool + //战斗AI + FightAI *FightAI + //随机数种子 + RandSeed int64 + //事件系统 + event event.ISys + //战报 + FightLog *FightLog + + //客户端专用逻辑 + //是否可进入下个循环 + ToNextRound bool +} + +func (this *FightBase) Start() { + +} + +/// +/// LastActionRole触发SkillId技能,选择的目标是TargetRid +/// 手动时,表现层在玩家操作后,调用本方法 +/// 自动战斗或服务端里,通过FightAI逻辑来自动触发 +/// +/// 技能ID +/// 选择的目标rid +func (this *FightBase) EmitSkill(skillId int, targetRid string) { + this.LastActionRole.EmitSkill(skillId, targetRid) +} diff --git a/modules/game/fight/logic/FightBuff.go b/modules/game/fight/logic/FightBuff.go new file mode 100644 index 000000000..35789dd69 --- /dev/null +++ b/modules/game/fight/logic/FightBuff.go @@ -0,0 +1,4 @@ +package logic + +type FightBuff struct { +} diff --git a/modules/game/fight/logic/FightEnum.go b/modules/game/fight/logic/FightEnum.go new file mode 100644 index 000000000..bf6c428a8 --- /dev/null +++ b/modules/game/fight/logic/FightEnum.go @@ -0,0 +1,62 @@ +package logic + +import ( + "go_dreamfactory/lego/core" +) + +//战斗类型枚举 +type FightType uint8 + +const ( + PVE FightType = 1 + PVP FightType = 2 + PVBOSS FightType = 3 +) + +/// +/// 技能类型枚举 +/// +///主动技 = 玩家可以点击、会出现在UI里 +///被动技 = 玩家不可以点击,会出现在UI里 +///队长技 = 玩家不可以点击,不会出现在UI里 +///其他系统提供的被动技 = 玩家不可以点击,不会出现在UI里 +/// +type SkillType uint8 + +const ( + ZhuDong SkillType = 1 + BeiDong SkillType = 2 + DuiZhang SkillType = 3 +) + +//事件类型枚举 +const ( + OnFightStart core.Event_Key = "OnFightStart" + OnRoleStartAction core.Event_Key = "OnRoleStartAction" + OnRoleStopAction core.Event_Key = "OnRoleStopAction" +) + +// +type ComType uint8 + +const ( + ModifyHp ComType = iota // 修改血量 + EmitSkill // 施放技能 + AddBuff // 增加一个buff + ModifyBuff // 修改一个buff数据 +) + +type ComModifyOperate struct { + from byte + nv float64 +} + +func (this *ComModifyOperate) Recycle() { + this.from = 0 + this.nv = 0 +} + +func (this *ComModifyOperate) ToString() string { + var str = "{this.GetType()} rid={from},nv:{nv}" + return str +} diff --git a/modules/game/fight/logic/FightLog.go b/modules/game/fight/logic/FightLog.go new file mode 100644 index 000000000..7fe618b03 --- /dev/null +++ b/modules/game/fight/logic/FightLog.go @@ -0,0 +1,21 @@ +package logic + +type FightLog struct { + FightBase FightBase + Commands []interface{} +} + +/// +/// 清理机制 +/// +func (this *FightLog) Clear() { + this.Commands = make([]interface{}, 0) +} + +/// +/// 增加战报日志 +/// +/// +func (this *FightLog) AddCommand(log interface{}) { + this.Commands = append(this.Commands, log) +} diff --git a/modules/game/fight/logic/FightPassiveSkill.go b/modules/game/fight/logic/FightPassiveSkill.go new file mode 100644 index 000000000..4dc472e78 --- /dev/null +++ b/modules/game/fight/logic/FightPassiveSkill.go @@ -0,0 +1,4 @@ +package logic + +type FightPassiveSkill struct { +} diff --git a/modules/game/fight/logic/FightRole.go b/modules/game/fight/logic/FightRole.go new file mode 100644 index 000000000..4d9d5f3d3 --- /dev/null +++ b/modules/game/fight/logic/FightRole.go @@ -0,0 +1,65 @@ +package logic + +//角色可序列化数据 +type FightRoleData struct { + Hp int //血量 + Atk int //攻击 + Def int //防御 + Speed int //速度 + Crit int //暴击 + OperateValue float64 //行动值 + Side byte //阵营 1=我 2=敌 + Pos byte //站位 1~5 + Rid byte //唯一标记,同时也是List FightBase.Roles的索引 + ALive bool //是否活着 + + SkillsInfo map[int]int + Skills map[int]*FightSkill + AfterSkills map[int]*FightAfterSkill + PassiveSkills []*FightPassiveSkill + Buffs []*FightBuff +} + +type FightRole struct { + Data *FightRoleData + //战斗实例 + FightBase FightBase +} + +/// +/// 修改行动值 +/// +/// 变化到多少 +/// 变化后新的行动值 +func (this *FightRole) ModifyOperateValue(newNum float64) float64 { + this.Data.OperateValue = newNum + //记录战报 + com := new(ComModifyOperate) + com.from = this.Data.Rid + com.nv = newNum + this.FightBase.FightLog.AddCommand(com) + + return this.Data.OperateValue +} + +/// +/// 当前是否能进行攻击行为 +/// 如果有行动类控制buff,如昏迷,冰冻等,则不能攻击 +/// +/// +func (this *FightRole) CanAtk() bool { + if this.Data.ALive == false { + return false + } else { + return true + } +} + +/// +/// 触发SkillId技能,选择的目标是TargetRid +/// +/// 技能ID +/// 选择的目标rid +func (this *FightRole) EmitSkill(skillId int, targetRid string) { + +} diff --git a/modules/game/fight/logic/FightSkill.go b/modules/game/fight/logic/FightSkill.go new file mode 100644 index 000000000..7c32a6496 --- /dev/null +++ b/modules/game/fight/logic/FightSkill.go @@ -0,0 +1,4 @@ +package logic + +type FightSkill struct { +} diff --git a/modules/pack/api.go b/modules/items/api.go similarity index 91% rename from modules/pack/api.go rename to modules/items/api.go index 196a5ac5b..6ceb880fe 100644 --- a/modules/pack/api.go +++ b/modules/items/api.go @@ -1,4 +1,4 @@ -package pack +package items import ( "go_dreamfactory/modules" @@ -18,13 +18,13 @@ const ( //消息回复的头名称 type Api_Comp struct { modules.MComp_GateComp service core.IService - module *Pack + module *Items } //组件初始化接口 func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MComp_GateComp.Init(service, module, comp, options) - this.module = module.(*Pack) + this.module = module.(*Items) this.service = service return } diff --git a/modules/pack/api_getlist.go b/modules/items/api_getlist.go similarity index 99% rename from modules/pack/api_getlist.go rename to modules/items/api_getlist.go index 7f28ec71d..6fe2d8d53 100644 --- a/modules/pack/api_getlist.go +++ b/modules/items/api_getlist.go @@ -1,4 +1,4 @@ -package pack +package items import ( "go_dreamfactory/comm" diff --git a/modules/pack/api_sellItem.go b/modules/items/api_sellItem.go similarity index 97% rename from modules/pack/api_sellItem.go rename to modules/items/api_sellItem.go index 1bd671287..d86e2873f 100644 --- a/modules/pack/api_sellItem.go +++ b/modules/items/api_sellItem.go @@ -1,4 +1,4 @@ -package pack +package items import ( "go_dreamfactory/comm" diff --git a/modules/pack/api_useItem.go b/modules/items/api_useItem.go similarity index 97% rename from modules/pack/api_useItem.go rename to modules/items/api_useItem.go index 6267039cb..58c33fa23 100644 --- a/modules/pack/api_useItem.go +++ b/modules/items/api_useItem.go @@ -1,4 +1,4 @@ -package pack +package items import ( "go_dreamfactory/comm" diff --git a/modules/pack/configure_comp.go b/modules/items/configure_comp.go similarity index 99% rename from modules/pack/configure_comp.go rename to modules/items/configure_comp.go index 02a59cb3b..147e9c006 100644 --- a/modules/pack/configure_comp.go +++ b/modules/items/configure_comp.go @@ -1,4 +1,4 @@ -package pack +package items import ( "fmt" diff --git a/modules/pack/core.go b/modules/items/core.go similarity index 98% rename from modules/pack/core.go rename to modules/items/core.go index 9410b30e5..bec9d3e46 100644 --- a/modules/pack/core.go +++ b/modules/items/core.go @@ -1,4 +1,4 @@ -package pack +package items import ( "errors" diff --git a/modules/pack/model_pack_comp.go b/modules/items/model_pack_comp.go similarity index 97% rename from modules/pack/model_pack_comp.go rename to modules/items/model_pack_comp.go index 76aaf8016..53a66c4b2 100644 --- a/modules/pack/model_pack_comp.go +++ b/modules/items/model_pack_comp.go @@ -1,4 +1,4 @@ -package pack +package items import ( "fmt" @@ -14,13 +14,13 @@ import ( ///背包缓存数据管理组件 type Model_Pack_Comp struct { modules.Model_Comp - module *Pack + module *Items } //组件初始化接口 func (this *Model_Pack_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { this.Model_Comp.Init(service, module, comp, opt) - this.module = module.(*Pack) + this.module = module.(*Items) this.TableName = "pack" //创建uid索引 this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ @@ -122,7 +122,7 @@ func (this *Model_Pack_Comp) Pack_AddItemToUserPack(uId string, itemId int32, ad } } if len(del) > 0 { - if err = this.Pack_AddUserPack(uId, add...); err != nil { + if err = this.Pack_DeleteUserPack(uId, del...); err != nil { return } } @@ -162,7 +162,7 @@ func (this *Model_Pack_Comp) Pack_AddItemsToUserPack(uId string, items map[int32 } } if len(del) > 0 { - if err = this.Pack_AddUserPack(uId, add...); err != nil { + if err = this.Pack_DeleteUserPack(uId, del...); err != nil { return } } diff --git a/modules/pack/module.go b/modules/items/module.go similarity index 80% rename from modules/pack/module.go rename to modules/items/module.go index c9b8165ed..f2bc97ae8 100644 --- a/modules/pack/module.go +++ b/modules/items/module.go @@ -1,4 +1,4 @@ -package pack +package items import ( "go_dreamfactory/comm" @@ -15,11 +15,11 @@ import ( 开发:李伟 */ func NewModule() core.IModule { - m := new(Pack) + m := new(Items) return m } -type Pack struct { +type Items struct { modules.ModuleBase api_comp *Api_Comp model_pack_comp *Model_Pack_Comp @@ -28,18 +28,18 @@ type Pack struct { } //模块名称 -func (this *Pack) GetType() core.M_Modules { +func (this *Items) GetType() core.M_Modules { return comm.SM_PackModule } //模块初始化接口 注册用户创建角色事件 -func (this *Pack) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { +func (this *Items) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) return } //装备组件 -func (this *Pack) OnInstallComp() { +func (this *Items) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp) this.model_pack_comp = this.RegisterComp(new(Model_Pack_Comp)).(*Model_Pack_Comp) @@ -48,7 +48,7 @@ func (this *Pack) OnInstallComp() { //IPack------------------------------------------------------------------------------------------------------------------------------- ///查询用户背包物品数量 -func (this *Pack) QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) { +func (this *Items) QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) { defer log.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount) amount = 0 if result := this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 { @@ -58,13 +58,13 @@ func (this *Pack) QueryUserPackItemAmount(uId string, itemid int32) (amount uint } ///查询用户背包多个物品数量 -func (this *Pack) QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { +func (this *Items) QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { result = this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid...) return } ///添加单个物品到背包 (可以加物品和减物品) -func (this *Pack) AddItemToUserPack(uId string, itemid, addnum int32) (code pb.ErrorCode) { +func (this *Items) AddItemToUserPack(uId string, itemid, addnum int32) (code pb.ErrorCode) { var err error defer log.Debugf("给用户添加物品 uId:%s itemid:%d addnum:%d issucc:%v", uId, itemid, addnum, err == nil) if err = this.model_pack_comp.Pack_AddItemToUserPack(uId, itemid, addnum); err != nil { @@ -81,7 +81,7 @@ func (this *Pack) AddItemToUserPack(uId string, itemid, addnum int32) (code pb.E } ///添加多个物品到背包 (可以加物品和减物品) -func (this *Pack) AddItemsToUserPack(uId string, items map[int32]int32) (code pb.ErrorCode) { +func (this *Items) AddItemsToUserPack(uId string, items map[int32]int32) (code pb.ErrorCode) { var err error defer log.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil) if err = this.model_pack_comp.Pack_AddItemsToUserPack(uId, items); err != nil { diff --git a/modules/pack/module_test.go b/modules/items/module_test.go similarity index 98% rename from modules/pack/module_test.go rename to modules/items/module_test.go index fcfb77986..94a937267 100644 --- a/modules/pack/module_test.go +++ b/modules/items/module_test.go @@ -1,4 +1,4 @@ -package pack +package items import ( "context" @@ -53,7 +53,7 @@ func (this *TestService) InitSys() { var service core.IService var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp() -var module = new(Pack) +var module = new(Items) //测试环境下初始化db和cache 系统 func TestMain(m *testing.M) { diff --git a/modules/mail/api.go b/modules/mail/api.go index a88d08fc4..86c4e73fa 100644 --- a/modules/mail/api.go +++ b/modules/mail/api.go @@ -19,7 +19,7 @@ type Api_Comp struct { modules.MComp_GateComp service core.IService module *Mail - pack comm.IPack + items comm.IItems } func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { @@ -34,10 +34,10 @@ func (this *Api_Comp) Start() (err error) { err = this.MComp_GateComp.Start() var module core.IModule - if module, err = this.service.GetModule(comm.SM_PackModule); err != nil { + if module, err = this.service.GetModule(comm.SM_ItemsModule); err != nil { return } - this.pack = module.(comm.IPack) + this.items = module.(comm.IItems) return } diff --git a/modules/mail/api_getAttachment.go b/modules/mail/api_getAttachment.go index 0da9efb63..91d27ccc2 100644 --- a/modules/mail/api_getAttachment.go +++ b/modules/mail/api_getAttachment.go @@ -35,7 +35,7 @@ func (this *Api_Comp) GetUserMailAttachment(session comm.IUserSession, agrs map[ for _, v := range _data { _items[int32(v.ItemId)] += int32(v.ItemCount) } - code = this.pack.AddItemsToUserPack(mail.Uid, _items) + code = this.items.AddItemsToUserPack(mail.Uid, _items) if code == pb.ErrorCode_Success { // 修改状态 this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID) diff --git a/sys/configure/structs/game.atn.go b/sys/configure/structs/game.atn.go new file mode 100644 index 000000000..67a89b5b5 --- /dev/null +++ b/sys/configure/structs/game.atn.go @@ -0,0 +1,29 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_atn struct { + A string + T string + N int32 +} + +func (Game_atn) GetTypeId() int { + return -1770297697 +} + +func NewGame_atn(_buf map[string]interface{}) (_v *Game_atn, err error) { + _v = &Game_atn{} + { var _ok_ bool; if _v.A, _ok_ = _buf["a"].(string); !_ok_ { err = errors.New("a error"); return } } + { var _ok_ bool; if _v.T, _ok_ = _buf["t"].(string); !_ok_ { err = errors.New("t error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ { err = errors.New("n error"); return }; _v.N = int32(_tempNum_) } + return +} diff --git a/sys/configure/structs/game.equip.go b/sys/configure/structs/game.equip.go new file mode 100644 index 000000000..a89d867b6 --- /dev/null +++ b/sys/configure/structs/game.equip.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_equip struct { + _dataMap map[int32]*Game_equipData + _dataList []*Game_equipData +} + +func NewGame_equip(_buf []map[string]interface{}) (*Game_equip, error) { + _dataList := make([]*Game_equipData, 0, len(_buf)) + dataMap := make(map[int32]*Game_equipData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_equipData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &Game_equip{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_equip) GetDataMap() map[int32]*Game_equipData { + return table._dataMap +} + +func (table *Game_equip) GetDataList() []*Game_equipData { + return table._dataList +} + +func (table *Game_equip) Get(key int32) *Game_equipData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.equipAttrlibrary.go b/sys/configure/structs/game.equipAttrlibrary.go new file mode 100644 index 000000000..4328e55a7 --- /dev/null +++ b/sys/configure/structs/game.equipAttrlibrary.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_equipAttrlibrary struct { + _dataMap map[int32]*Game_equipAttrlibraryData + _dataList []*Game_equipAttrlibraryData +} + +func NewGame_equipAttrlibrary(_buf []map[string]interface{}) (*Game_equipAttrlibrary, error) { + _dataList := make([]*Game_equipAttrlibraryData, 0, len(_buf)) + dataMap := make(map[int32]*Game_equipAttrlibraryData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_equipAttrlibraryData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Key] = _v + } + } + return &Game_equipAttrlibrary{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_equipAttrlibrary) GetDataMap() map[int32]*Game_equipAttrlibraryData { + return table._dataMap +} + +func (table *Game_equipAttrlibrary) GetDataList() []*Game_equipAttrlibraryData { + return table._dataList +} + +func (table *Game_equipAttrlibrary) Get(key int32) *Game_equipAttrlibraryData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.equipAttrlibraryData.go b/sys/configure/structs/game.equipAttrlibraryData.go new file mode 100644 index 000000000..bad8e3c2e --- /dev/null +++ b/sys/configure/structs/game.equipAttrlibraryData.go @@ -0,0 +1,44 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_equipAttrlibraryData struct { + Key int32 + Libraryid int32 + Attr []string + Probability int32 +} + +func (Game_equipAttrlibraryData) GetTypeId() int { + return -437457248 +} + +func NewGame_equipAttrlibraryData(_buf map[string]interface{}) (_v *Game_equipAttrlibraryData, err error) { + _v = &Game_equipAttrlibraryData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["libraryid"].(float64); !_ok_ { err = errors.New("libraryid error"); return }; _v.Libraryid = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["attr"].([]interface{}); !_ok_ { err = errors.New("attr error"); return } + + _v.Attr = make([]string, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ string + { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + _v.Attr = append(_v.Attr, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["probability"].(float64); !_ok_ { err = errors.New("probability error"); return }; _v.Probability = int32(_tempNum_) } + return +} diff --git a/sys/configure/structs/game.equipData.go b/sys/configure/structs/game.equipData.go new file mode 100644 index 000000000..df17d74b1 --- /dev/null +++ b/sys/configure/structs/game.equipData.go @@ -0,0 +1,67 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_equipData struct { + Id int32 + Suittype int32 + Suitintr string + Pos int32 + Star int32 + Leadlibrary int32 + Addattrnum []int32 + Addattrnump []int32 + Addlibrary int32 +} + +func (Game_equipData) GetTypeId() int { + return 1778846974 +} + +func NewGame_equipData(_buf map[string]interface{}) (_v *Game_equipData, err error) { + _v = &Game_equipData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suittype"].(float64); !_ok_ { err = errors.New("suittype error"); return }; _v.Suittype = int32(_tempNum_) } + { var _ok_ bool; if _v.Suitintr, _ok_ = _buf["suitintr"].(string); !_ok_ { err = errors.New("suitintr error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pos"].(float64); !_ok_ { err = errors.New("pos error"); return }; _v.Pos = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["leadlibrary"].(float64); !_ok_ { err = errors.New("leadlibrary error"); return }; _v.Leadlibrary = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["addattrnum"].([]interface{}); !_ok_ { err = errors.New("addattrnum error"); return } + + _v.Addattrnum = 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.Addattrnum = append(_v.Addattrnum, _list_v_) + } + } + + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["addattrnump"].([]interface{}); !_ok_ { err = errors.New("addattrnump error"); return } + + _v.Addattrnump = 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.Addattrnump = append(_v.Addattrnump, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["addlibrary"].(float64); !_ok_ { err = errors.New("addlibrary error"); return }; _v.Addlibrary = int32(_tempNum_) } + return +} diff --git a/sys/configure/structs/game.equipIntensify.go b/sys/configure/structs/game.equipIntensify.go new file mode 100644 index 000000000..a0a3de41d --- /dev/null +++ b/sys/configure/structs/game.equipIntensify.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_equipIntensify struct { + _dataMap map[int32]*Game_equipIntensifyData + _dataList []*Game_equipIntensifyData +} + +func NewGame_equipIntensify(_buf []map[string]interface{}) (*Game_equipIntensify, error) { + _dataList := make([]*Game_equipIntensifyData, 0, len(_buf)) + dataMap := make(map[int32]*Game_equipIntensifyData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_equipIntensifyData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Key] = _v + } + } + return &Game_equipIntensify{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_equipIntensify) GetDataMap() map[int32]*Game_equipIntensifyData { + return table._dataMap +} + +func (table *Game_equipIntensify) GetDataList() []*Game_equipIntensifyData { + return table._dataList +} + +func (table *Game_equipIntensify) Get(key int32) *Game_equipIntensifyData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.equipIntensifyData.go b/sys/configure/structs/game.equipIntensifyData.go new file mode 100644 index 000000000..bdc365a98 --- /dev/null +++ b/sys/configure/structs/game.equipIntensifyData.go @@ -0,0 +1,52 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_equipIntensifyData struct { + Key int32 + Star int32 + Level int32 + Need []*Game_atn + Bonus int32 + Activation bool + Probability int32 + Num int32 +} + +func (Game_equipIntensifyData) GetTypeId() int { + return 1687417591 +} + +func NewGame_equipIntensifyData(_buf map[string]interface{}) (_v *Game_equipIntensifyData, err error) { + _v = &Game_equipIntensifyData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["level"].(float64); !_ok_ { err = errors.New("level error"); return }; _v.Level = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["need"].([]interface{}); !_ok_ { err = errors.New("need error"); return } + + _v.Need = make([]*Game_atn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Game_atn + { 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 = NewGame_atn(_x_); err != nil { return } } + _v.Need = append(_v.Need, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["bonus"].(float64); !_ok_ { err = errors.New("bonus error"); return }; _v.Bonus = int32(_tempNum_) } + { var _ok_ bool; if _v.Activation, _ok_ = _buf["activation"].(bool); !_ok_ { err = errors.New("activation error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["probability"].(float64); !_ok_ { err = errors.New("probability error"); return }; _v.Probability = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["num"].(float64); !_ok_ { err = errors.New("num error"); return }; _v.Num = int32(_tempNum_) } + return +} diff --git a/sys/configure/structs/game.equipSuit.go b/sys/configure/structs/game.equipSuit.go new file mode 100644 index 000000000..a2000ec43 --- /dev/null +++ b/sys/configure/structs/game.equipSuit.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_equipSuit struct { + _dataMap map[int32]*Game_equipSuitData + _dataList []*Game_equipSuitData +} + +func NewGame_equipSuit(_buf []map[string]interface{}) (*Game_equipSuit, error) { + _dataList := make([]*Game_equipSuitData, 0, len(_buf)) + dataMap := make(map[int32]*Game_equipSuitData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_equipSuitData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Suittype] = _v + } + } + return &Game_equipSuit{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_equipSuit) GetDataMap() map[int32]*Game_equipSuitData { + return table._dataMap +} + +func (table *Game_equipSuit) GetDataList() []*Game_equipSuitData { + return table._dataList +} + +func (table *Game_equipSuit) Get(key int32) *Game_equipSuitData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.equipSuitData.go b/sys/configure/structs/game.equipSuitData.go new file mode 100644 index 000000000..ca7a39602 --- /dev/null +++ b/sys/configure/structs/game.equipSuitData.go @@ -0,0 +1,29 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_equipSuitData struct { + Suittype int32 + Suitnum int32 + Skill int32 +} + +func (Game_equipSuitData) GetTypeId() int { + return -332303445 +} + +func NewGame_equipSuitData(_buf map[string]interface{}) (_v *Game_equipSuitData, err error) { + _v = &Game_equipSuitData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suittype"].(float64); !_ok_ { err = errors.New("suittype error"); return }; _v.Suittype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suitnum"].(float64); !_ok_ { err = errors.New("suitnum error"); return }; _v.Suitnum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["skill"].(float64); !_ok_ { err = errors.New("skill error"); return }; _v.Skill = int32(_tempNum_) } + return +} diff --git a/sys/configure/structs/game.itemData.go b/sys/configure/structs/game.itemData.go index 2c5b2ee64..af691d78b 100644 --- a/sys/configure/structs/game.itemData.go +++ b/sys/configure/structs/game.itemData.go @@ -15,15 +15,16 @@ type Game_itemData struct { Name string Usetype int32 Color int32 - Bagtype string + Race int32 + Bagtype bool Index int32 Texiao string Dlp int32 - Hcnum int32 + Composenum int32 Htype int32 Tujing int32 Usetz int32 - Shuliangshangxian int32 + Maxnum int32 Uselv int32 Ismutil int32 Type int32 @@ -43,15 +44,16 @@ func NewGame_itemData(_buf map[string]interface{}) (_v *Game_itemData, err error { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["usetype"].(float64); !_ok_ { err = errors.New("usetype error"); return }; _v.Usetype = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) } - { var _ok_ bool; if _v.Bagtype, _ok_ = _buf["bagtype"].(string); !_ok_ { err = errors.New("bagtype error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["race"].(float64); !_ok_ { err = errors.New("race error"); return }; _v.Race = int32(_tempNum_) } + { var _ok_ bool; if _v.Bagtype, _ok_ = _buf["bagtype"].(bool); !_ok_ { err = errors.New("bagtype error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["index"].(float64); !_ok_ { err = errors.New("index error"); return }; _v.Index = int32(_tempNum_) } { var _ok_ bool; if _v.Texiao, _ok_ = _buf["texiao"].(string); !_ok_ { err = errors.New("texiao error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dlp"].(float64); !_ok_ { err = errors.New("dlp error"); return }; _v.Dlp = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hcnum"].(float64); !_ok_ { err = errors.New("hcnum error"); return }; _v.Hcnum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["composenum"].(float64); !_ok_ { err = errors.New("composenum error"); return }; _v.Composenum = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["htype"].(float64); !_ok_ { err = errors.New("htype error"); return }; _v.Htype = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tujing"].(float64); !_ok_ { err = errors.New("tujing error"); return }; _v.Tujing = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["usetz"].(float64); !_ok_ { err = errors.New("usetz error"); return }; _v.Usetz = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["shuliangshangxian"].(float64); !_ok_ { err = errors.New("shuliangshangxian error"); return }; _v.Shuliangshangxian = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["maxnum"].(float64); !_ok_ { err = errors.New("maxnum error"); return }; _v.Maxnum = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["uselv"].(float64); !_ok_ { err = errors.New("uselv error"); return }; _v.Uselv = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ismutil"].(float64); !_ok_ { err = errors.New("ismutil error"); return }; _v.Ismutil = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }