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资源加载方式。 - 拆分精灵升级与进化方法,明确调用职责。 - 在战斗和治疗等操作前增加货币校验及扣除逻辑。 - 补充金豆购买相关的客户端/服务端通信结构体。 - 调整技能选择逻辑避免潜在索引越界问题。 - 更新部分注释说明和代码结构以提升可维护性。
39 lines
1.6 KiB
Go
39 lines
1.6 KiB
Go
package item
|
|
|
|
import (
|
|
"blazing/logic/service/common"
|
|
"blazing/modules/blazing/model"
|
|
)
|
|
|
|
// C2S_USE_PET_ITEM_OUT_OF_FIGHT 客户端→服务端:非战斗场景使用宠物道具
|
|
type C2S_USE_PET_ITEM_OUT_OF_FIGHT struct {
|
|
Head common.TomeeHeader `cmd:"2326" struc:"skip"`
|
|
CatchTime uint32 `json:"catch_time"` // 使用物品的精灵的捕获时间
|
|
ItemID uint32 `json:"item_id"` // 使用的物品ID
|
|
}
|
|
|
|
// S2C_USE_PET_ITEM_OUT_OF_FIGHT 服务端→客户端:非战斗场景使用宠物道具回包
|
|
type S2C_USE_PET_ITEM_OUT_OF_FIGHT struct {
|
|
CatchTime uint32 `json:"catch_time"` // 使用物品的精灵的捕获时间
|
|
ID uint32 `json:"id"` // 精灵ID
|
|
Nick string `struc:"[16]byte" fieldDesc:"16字节昵称" json:"nick"`
|
|
Nature uint32 `json:"nature"` // 精灵性格
|
|
Dv uint32 `json:"dv"` // 精灵个体值
|
|
Level uint32 `json:"lv"` // 精灵等级
|
|
Hp uint32 `json:"hp"` // 当前血量
|
|
MaxHp uint32 `json:"maxhp"` // 最大血量
|
|
Exp uint32 `json:"exp"` // 升级所需经验
|
|
// * ev:生命学习力,攻击学习力,防御学习力,特攻学习力,特防学习力,速度学习力
|
|
Ev [6]uint32 `fieldDesc:"属性" `
|
|
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
|
Prop [5]uint32 `fieldDesc:"属性" `
|
|
SkillList []model.SkillInfo `json:"skilllist"` // 技能数组
|
|
}
|
|
type C2S_PET_RESET_NATURE struct {
|
|
Head common.TomeeHeader `cmd:"2343" struc:"skip"`
|
|
|
|
CatchTime uint32 // 精灵捕捉时间
|
|
Nature uint32 // 目标性格值
|
|
ItemId uint32 // 消耗的物品ID
|
|
}
|