Files
bl/common/core/info/pet/PetInfo.go
昔念 720294ad27 refactor(blazing): 重构项目并优化数据结构
- 更新 LoginUserInfo 结构体,将 uint64 类型改为 uint32
- 调整 ServerInfo 结构体,将 IP 字段从 []byte 改为 string
- 移除未使用的 ArraySerialize 结构体
- 更新 ByteArray 类,修改相关方法名
- 删除未使用的 serialize 相关代码
- 优化模块导入,移除冗余依赖
2025-06-22 12:05:07 +08:00

55 lines
2.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package pet
import (
"blazing/common/core/info/pet/skill"
"time"
)
// PetInfo 精灵信息结构体
type PetInfo struct {
ID uint32 // 精灵编号
Name string `serialize:"fixed:16"` // 定长模式16字节 // 名字 默认为全0 但要补齐到16字节
DV uint32 // 个体值
Nature uint32 // 性格
Level uint32 // 等级
Exp uint32 // 当前等级已经获得的经验
LvExp uint32 // 当前等级所需的经验
NextLvExp uint32 // 升到下一级的经验
HP uint32 // 当前生命
MaxHP uint32 // 最大生命
Attack uint32 // 攻击
Defence uint32 // 防御
SpecialAttack uint32 // 特攻
SpecialDefence uint32 // 特防
Speed uint32 // 速度
EVHP uint32 // 生命学习力
EVAttack uint32 // 攻击学习力
EVDefence uint32 // 防御学习力
EVSpecialAttack uint32 // 特攻学习力
EVSpecialDefense uint32 // 特防学习力
EVSpeed uint32 // 速度学习力
SkillSize uint32 // 技能个数
SkillList [4]skill.SkillInfo `serialize:"fixed:8"` // 32字节 技能信息 必须插入4条skillInfo若技能信息为空则要赋值成0
CatchTime uint32 // 捕捉时间
CatchMap uint32 // 捕捉地图
CatchRect uint32 // 未知默认为0
CatchLevel uint32 // 捕获等级 默认为0
EffectInfo []PetEffectInfo `serialize:"varlen:2"` // 特性列表, 长度在头部以UShort存储
SkinID uint32 // 皮肤id默认为0
Shiny uint32 // 是不是闪
}
// NewPetInfo 创建一个新的精灵信息实例
func NewPetInfo() *PetInfo {
return &PetInfo{
Name: "",
SkillList: [4]skill.SkillInfo{},
EffectInfo: make([]PetEffectInfo, 0),
}
}
// GetCatchTimeAsTime 将捕捉时间转换为time.Time类型
func (p *PetInfo) GetCatchTimeAsTime() time.Time {
return time.Unix(int64(p.CatchTime), 0)
}