fix(fight): 使用模型层方法生成精灵信息 refactor(controller): 移除冗余变量与内联XML读取逻辑 refactor(pet): 重构经验更新与进化逻辑 refactor(item): 校验并扣减使用道具数量 feat(item): 新增金豆购买商品协议结构体 feat(user): 迁移角色服装变更逻辑至user控制器 feat(pet): 增加技能排序协议定义 refactor(utils): 移除未使用的工具函数引用 chore(config): 更新地图怪物配置信息 详细变更内容包括: - 在`xmlres/file.go`中初始化`GoldProductMap`并加载相关配置。 - 将`GenPetInfo`方法从玩家服务迁移至`model`包以统一管理。 - 合并部分不必要的局部变量声明,并优化XML资源加载方式。 - 拆分精灵升级与进化方法,明确调用职责。 - 在战斗和治疗等操作前增加货币校验及扣除逻辑。 - 补充金豆购买相关的客户端/服务端通信结构体。 - 调整技能选择逻辑避免潜在索引越界问题。 - 更新部分注释说明和代码结构以提升可维护性。
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package item
|
||
|
||
import "blazing/logic/service/common"
|
||
|
||
type BuyInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2601" struc:"skip"`
|
||
//物品ID
|
||
ItemId uint32
|
||
//物品数量
|
||
Count uint32
|
||
}
|
||
type BuyOutboundInfo struct {
|
||
//剩余的数量
|
||
Coins uint32
|
||
//购买的物品ID
|
||
ItemId uint32
|
||
//购买数量
|
||
Count uint32
|
||
//购买的物品等级
|
||
Level uint32
|
||
}
|
||
type BuyMultiInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2606" struc:"skip"`
|
||
ItemListLen uint32 `struc:"sizeof=ItemIds"`
|
||
ItemIds []uint32 `json:"itemIds" description:"购买的物品ID列表"` // @UInt Long对应uint64,List对应切片
|
||
}
|
||
type BuyMultiOutboundInfo struct {
|
||
//剩余的数量
|
||
Coins uint32
|
||
}
|
||
|
||
// C2S_GOLD_BUY_PRODUCT 客户端→服务端:金豆购买商品请求
|
||
type C2S_GOLD_BUY_PRODUCT struct {
|
||
Head common.TomeeHeader `cmd:"1104" struc:"skip"`
|
||
ProductID uint32 `json:"product_id"` // 金豆物品id对应的产品id
|
||
Count uint16 `json:"count"` // 购买数量(前端限制金豆物品只能1个1个买)
|
||
}
|
||
|
||
// S2C_GoldBuyProductInfo 服务端→客户端:金豆购买商品结果返回
|
||
type S2C_GoldBuyProductInfo struct {
|
||
Reserved uint32 `json:"reserved"` // 0 空数据(预留字段)
|
||
PayGold uint32 `json:"pay_gold"` // 购买物品消耗的金豆数(后端返回值需*100)
|
||
Gold uint32 `json:"gold"` // 购买后剩余金豆数(后端返回值需*100)
|
||
}
|