修改道具模块命名以及武器配置代码
This commit is contained in:
parent
773a5db73b
commit
fd99d99406
@ -33,7 +33,7 @@ const (
|
|||||||
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块
|
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块
|
||||||
SM_WebModule core.M_Modules = "web" //web模块
|
SM_WebModule core.M_Modules = "web" //web模块
|
||||||
SM_UserModule core.M_Modules = "user" //用户模块
|
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_MailModule core.M_Modules = "mail" //邮件模块
|
||||||
SM_FriendModule core.M_Modules = "friend" //好友模块
|
SM_FriendModule core.M_Modules = "friend" //好友模块
|
||||||
SM_LogModelModule core.M_Modules = "model" //日志模块
|
SM_LogModelModule core.M_Modules = "model" //日志模块
|
||||||
|
@ -11,8 +11,8 @@ type (
|
|||||||
Imail interface {
|
Imail interface {
|
||||||
CreateNewMail(uId string)
|
CreateNewMail(uId string)
|
||||||
}
|
}
|
||||||
//背包模块对外接口定义 提供给其他模块使用的
|
//道具背包接口
|
||||||
IPack interface {
|
IItems interface {
|
||||||
//查询用户背包物品数量
|
//查询用户背包物品数量
|
||||||
QueryUserPackItemAmount(uId string, itemid int32) (amount uint32)
|
QueryUserPackItemAmount(uId string, itemid int32) (amount uint32)
|
||||||
//查询用户背包多个物品数量
|
//查询用户背包多个物品数量
|
||||||
|
31
modules/game/fight/logic/FightAI.go
Normal file
31
modules/game/fight/logic/FightAI.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fightBase">FightBase实例</param>
|
||||||
|
func newFightAI(fightBase FightBase) *FightAI {
|
||||||
|
return &FightAI{
|
||||||
|
FightBase: &fightBase,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type FightAI struct {
|
||||||
|
FightBase *FightBase
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动触发技能
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fightRole"></param>
|
||||||
|
func (this *FightAI) AutoEmitSkill(fightRole *FightRole) {
|
||||||
|
//todo...根据规则,设置对应技能和目标
|
||||||
|
this.FightBase.EmitSkill(100012000, "bb")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理机制
|
||||||
|
/// </summary>
|
||||||
|
func (this *FightAI) Clear() {
|
||||||
|
|
||||||
|
}
|
45
modules/game/fight/logic/FightAfterSkill.go
Normal file
45
modules/game/fight/logic/FightAfterSkill.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="role">谁的技能</param>
|
||||||
|
/// <param name="skillConf">技能配置</param>
|
||||||
|
func newFightAfterSkill(role *FightRole, skillConf *cfg.Game_skillAfteratkData) *FightAfterSkill {
|
||||||
|
return &FightAfterSkill{
|
||||||
|
OwnerRole: role,
|
||||||
|
SkillConf: skillConf,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type FightAfterSkill struct {
|
||||||
|
//从哪个技能触发的
|
||||||
|
OwnerRole *FightRole
|
||||||
|
//技能配置
|
||||||
|
SkillConf *cfg.Game_skillAfteratkData
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 战斗结束时的清理
|
||||||
|
/// </summary>
|
||||||
|
func (this *FightAfterSkill) Clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发技能
|
||||||
|
/// </summary>
|
||||||
|
func (this *FightAfterSkill) Emit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取作用目标
|
||||||
|
/// </summary>
|
||||||
|
func (this *FightAfterSkill) GetTarget() {
|
||||||
|
|
||||||
|
}
|
45
modules/game/fight/logic/FightBase.go
Normal file
45
modules/game/fight/logic/FightBase.go
Normal file
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LastActionRole触发SkillId技能,选择的目标是TargetRid
|
||||||
|
/// 手动时,表现层在玩家操作后,调用本方法
|
||||||
|
/// 自动战斗或服务端里,通过FightAI逻辑来自动触发
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillid">技能ID</param>
|
||||||
|
/// <param name="targetRid">选择的目标rid</param>
|
||||||
|
func (this *FightBase) EmitSkill(skillId int, targetRid string) {
|
||||||
|
this.LastActionRole.EmitSkill(skillId, targetRid)
|
||||||
|
}
|
4
modules/game/fight/logic/FightBuff.go
Normal file
4
modules/game/fight/logic/FightBuff.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
type FightBuff struct {
|
||||||
|
}
|
62
modules/game/fight/logic/FightEnum.go
Normal file
62
modules/game/fight/logic/FightEnum.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
//战斗类型枚举
|
||||||
|
type FightType uint8
|
||||||
|
|
||||||
|
const (
|
||||||
|
PVE FightType = 1
|
||||||
|
PVP FightType = 2
|
||||||
|
PVBOSS FightType = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 技能类型枚举
|
||||||
|
///
|
||||||
|
///主动技 = 玩家可以点击、会出现在UI里
|
||||||
|
///被动技 = 玩家不可以点击,会出现在UI里
|
||||||
|
///队长技 = 玩家不可以点击,不会出现在UI里
|
||||||
|
///其他系统提供的被动技 = 玩家不可以点击,不会出现在UI里
|
||||||
|
/// </summary>
|
||||||
|
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
|
||||||
|
}
|
21
modules/game/fight/logic/FightLog.go
Normal file
21
modules/game/fight/logic/FightLog.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
type FightLog struct {
|
||||||
|
FightBase FightBase
|
||||||
|
Commands []interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理机制
|
||||||
|
/// </summary>
|
||||||
|
func (this *FightLog) Clear() {
|
||||||
|
this.Commands = make([]interface{}, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增加战报日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="log"></param>
|
||||||
|
func (this *FightLog) AddCommand(log interface{}) {
|
||||||
|
this.Commands = append(this.Commands, log)
|
||||||
|
}
|
4
modules/game/fight/logic/FightPassiveSkill.go
Normal file
4
modules/game/fight/logic/FightPassiveSkill.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
type FightPassiveSkill struct {
|
||||||
|
}
|
65
modules/game/fight/logic/FightRole.go
Normal file
65
modules/game/fight/logic/FightRole.go
Normal file
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改行动值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="num">变化到多少</param>
|
||||||
|
/// <returns>变化后新的行动值</returns>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前是否能进行攻击行为
|
||||||
|
/// 如果有行动类控制buff,如昏迷,冰冻等,则不能攻击
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
func (this *FightRole) CanAtk() bool {
|
||||||
|
if this.Data.ALive == false {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发SkillId技能,选择的目标是TargetRid
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillid">技能ID</param>
|
||||||
|
/// <param name="targetRid">选择的目标rid</param>
|
||||||
|
func (this *FightRole) EmitSkill(skillId int, targetRid string) {
|
||||||
|
|
||||||
|
}
|
4
modules/game/fight/logic/FightSkill.go
Normal file
4
modules/game/fight/logic/FightSkill.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
type FightSkill struct {
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
@ -18,13 +18,13 @@ const ( //消息回复的头名称
|
|||||||
type Api_Comp struct {
|
type Api_Comp struct {
|
||||||
modules.MComp_GateComp
|
modules.MComp_GateComp
|
||||||
service core.IService
|
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) {
|
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.MComp_GateComp.Init(service, module, comp, options)
|
||||||
this.module = module.(*Pack)
|
this.module = module.(*Items)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -14,13 +14,13 @@ import (
|
|||||||
///背包缓存数据管理组件
|
///背包缓存数据管理组件
|
||||||
type Model_Pack_Comp struct {
|
type Model_Pack_Comp struct {
|
||||||
modules.Model_Comp
|
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) {
|
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.Model_Comp.Init(service, module, comp, opt)
|
||||||
this.module = module.(*Pack)
|
this.module = module.(*Items)
|
||||||
this.TableName = "pack"
|
this.TableName = "pack"
|
||||||
//创建uid索引
|
//创建uid索引
|
||||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
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 len(del) > 0 {
|
||||||
if err = this.Pack_AddUserPack(uId, add...); err != nil {
|
if err = this.Pack_DeleteUserPack(uId, del...); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ func (this *Model_Pack_Comp) Pack_AddItemsToUserPack(uId string, items map[int32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(del) > 0 {
|
if len(del) > 0 {
|
||||||
if err = this.Pack_AddUserPack(uId, add...); err != nil {
|
if err = this.Pack_DeleteUserPack(uId, del...); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
@ -15,11 +15,11 @@ import (
|
|||||||
开发:李伟
|
开发:李伟
|
||||||
*/
|
*/
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
m := new(Pack)
|
m := new(Items)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
type Pack struct {
|
type Items struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
api_comp *Api_Comp
|
api_comp *Api_Comp
|
||||||
model_pack_comp *Model_Pack_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
|
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)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备组件
|
//装备组件
|
||||||
func (this *Pack) OnInstallComp() {
|
func (this *Items) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
||||||
this.model_pack_comp = this.RegisterComp(new(Model_Pack_Comp)).(*Model_Pack_Comp)
|
this.model_pack_comp = this.RegisterComp(new(Model_Pack_Comp)).(*Model_Pack_Comp)
|
||||||
@ -48,7 +48,7 @@ func (this *Pack) OnInstallComp() {
|
|||||||
|
|
||||||
//IPack-------------------------------------------------------------------------------------------------------------------------------
|
//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)
|
defer log.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount)
|
||||||
amount = 0
|
amount = 0
|
||||||
if result := this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 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...)
|
result = this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid...)
|
||||||
return
|
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
|
var err error
|
||||||
defer log.Debugf("给用户添加物品 uId:%s itemid:%d addnum:%d issucc:%v", uId, itemid, addnum, err == nil)
|
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 {
|
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
|
var err error
|
||||||
defer log.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil)
|
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 {
|
if err = this.model_pack_comp.Pack_AddItemsToUserPack(uId, items); err != nil {
|
@ -1,4 +1,4 @@
|
|||||||
package pack
|
package items
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -53,7 +53,7 @@ func (this *TestService) InitSys() {
|
|||||||
|
|
||||||
var service core.IService
|
var service core.IService
|
||||||
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
||||||
var module = new(Pack)
|
var module = new(Items)
|
||||||
|
|
||||||
//测试环境下初始化db和cache 系统
|
//测试环境下初始化db和cache 系统
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
@ -19,7 +19,7 @@ type Api_Comp struct {
|
|||||||
modules.MComp_GateComp
|
modules.MComp_GateComp
|
||||||
service core.IService
|
service core.IService
|
||||||
module *Mail
|
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) {
|
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()
|
err = this.MComp_GateComp.Start()
|
||||||
var module core.IModule
|
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
|
return
|
||||||
}
|
}
|
||||||
this.pack = module.(comm.IPack)
|
this.items = module.(comm.IItems)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ func (this *Api_Comp) GetUserMailAttachment(session comm.IUserSession, agrs map[
|
|||||||
for _, v := range _data {
|
for _, v := range _data {
|
||||||
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
_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 {
|
if code == pb.ErrorCode_Success {
|
||||||
// 修改状态
|
// 修改状态
|
||||||
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
||||||
|
29
sys/configure/structs/game.atn.go
Normal file
29
sys/configure/structs/game.atn.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 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
|
||||||
|
}
|
42
sys/configure/structs/game.equip.go
Normal file
42
sys/configure/structs/game.equip.go
Normal 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 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
42
sys/configure/structs/game.equipAttrlibrary.go
Normal file
42
sys/configure/structs/game.equipAttrlibrary.go
Normal 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 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
44
sys/configure/structs/game.equipAttrlibraryData.go
Normal file
44
sys/configure/structs/game.equipAttrlibraryData.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 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
|
||||||
|
}
|
67
sys/configure/structs/game.equipData.go
Normal file
67
sys/configure/structs/game.equipData.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 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
|
||||||
|
}
|
42
sys/configure/structs/game.equipIntensify.go
Normal file
42
sys/configure/structs/game.equipIntensify.go
Normal 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 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
52
sys/configure/structs/game.equipIntensifyData.go
Normal file
52
sys/configure/structs/game.equipIntensifyData.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 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
|
||||||
|
}
|
42
sys/configure/structs/game.equipSuit.go
Normal file
42
sys/configure/structs/game.equipSuit.go
Normal 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 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]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
29
sys/configure/structs/game.equipSuitData.go
Normal file
29
sys/configure/structs/game.equipSuitData.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 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
|
||||||
|
}
|
@ -15,15 +15,16 @@ type Game_itemData struct {
|
|||||||
Name string
|
Name string
|
||||||
Usetype int32
|
Usetype int32
|
||||||
Color int32
|
Color int32
|
||||||
Bagtype string
|
Race int32
|
||||||
|
Bagtype bool
|
||||||
Index int32
|
Index int32
|
||||||
Texiao string
|
Texiao string
|
||||||
Dlp int32
|
Dlp int32
|
||||||
Hcnum int32
|
Composenum int32
|
||||||
Htype int32
|
Htype int32
|
||||||
Tujing int32
|
Tujing int32
|
||||||
Usetz int32
|
Usetz int32
|
||||||
Shuliangshangxian int32
|
Maxnum int32
|
||||||
Uselv int32
|
Uselv int32
|
||||||
Ismutil int32
|
Ismutil int32
|
||||||
Type 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; 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["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; 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; 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; 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["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["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["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["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["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["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_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
|
||||||
|
Loading…
Reference in New Issue
Block a user