style: 清理代码注释和格式

This commit is contained in:
xinian
2026-04-04 05:12:30 +08:00
committed by cnb
parent 31d274dd9d
commit b62b4af628
31 changed files with 863 additions and 195 deletions

View File

@@ -127,7 +127,7 @@ type RegReq struct {
Authorization string `json:"Authorization" in:"header"`
// 玩家昵称,@ArraySerialize注解
Nickname string `json:"nickname" ` // 固定长度16字节
// 机器人人物颜色 rgb@UInt注解
// 机器人人物颜色 rgb
Color uint32 `json:"color" ` // 4字节
}

View File

@@ -23,8 +23,8 @@ func (t *TeamInfo) InitDefaults() {
// TeamPKInfo 战队PK相关信息结构
type TeamPKInfo struct {
GroupID uint32 `struc:"uint32" default:"1"` // 分组ID默认值1@UInt long
HomeTeamID uint32 `struc:"uint32" default:"1"` // 主队ID默认值1@UInt long
GroupID uint32 `struc:"uint32" default:"1"` // 分组ID默认值1
HomeTeamID uint32 `struc:"uint32" default:"1"` // 主队ID默认值1
}
// InitDefaults 初始化默认值(确保字段默认值正确赋值)

View File

@@ -96,8 +96,6 @@ func (r Attr) sub() uint32 {
// PetInfo 精灵信息结构(合并后的优化版本)
type PetInfo struct {
// 精灵编号(@UInt long → uint32
ID uint32 `fieldDesc:"精灵编号" `
// 名字默认为全0补齐到16字节固定长度 → [16]byte
@@ -107,28 +105,20 @@ type PetInfo struct {
Generation uint16 `fieldDesc:"世代" `
// 个体值(@UInt long → uint32
Dv uint32 `struc:"uint32" `
// 性格(@UInt long → uint32
Nature uint32 `fieldDesc:"性格" `
// 等级(@UInt long → uint32
Level uint32 `fieldDesc:"等级" `
// 当前等级已获得经验(@UInt long → uint32
Exp int64 `struc:"uint32"`
// 当前等级所需经验(@UInt long → uint32
LvExp int64 `struc:"uint32"`
// 升到下一级的经验(@UInt long → uint32
NextLvExp int64 `struc:"uint32"`
// 当前生命(@UInt long → uint32
Hp uint32
// 最大生命(@UInt long → uint32
MaxHp uint32 `fieldDesc:"最大生命" `
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
Prop [5]uint32 `fieldDesc:"属性" `
@@ -141,26 +131,20 @@ type PetInfo struct {
// 技能信息固定4条空则赋值0固定长度List → [4]SkillInfo零值即符合“赋值0”
SkillList []SkillInfo
// 捕捉时间(@UInt long → 若为时间戳用uint32若需时间类型可改为time.Time需配合序列化处理
CatchTime uint32 //显式忽略,不参与序列化
OldCatchTime uint32 `struc:"skip" fieldDesc:"旧捕捉时间" `
// 捕捉地图(@UInt long → uint32
CatchMap uint32 `json:"CatchMap,omitempty"`
// 未知默认0@UInt long → uint32
CatchRect uint32 `json:"CatchRect,omitempty"`
// 捕获等级默认0@UInt long → uint32
CatchLevel uint32 `fieldDesc:"捕获等级 默认为0" `
EffectInfoLen uint16 `struc:"sizeof=EffectInfo" json:"-"`
// 特性列表长度用UShort存储变长List → []PetEffectInfo + 长度前缀规则) 第一个一定是特性
EffectInfo []PetEffectInfo
// 皮肤ID默认0@UInt long → uint32
SkinID uint32 `fieldDesc:"皮肤id默认为0" `
// 是否闪光(@UInt long → uint320=否1=是)
ShinyLen uint32 `struc:"sizeof=ShinyInfo"`
ShinyInfo []data.GlowFilter `json:"ShinyInfo,omitempty"`

View File

@@ -60,7 +60,6 @@ type PVPRankInfo struct {
type NoteReadyToFightInfo struct {
//MAXPET uint32 `struc:"skip"` // 最大精灵数 struc:"skip"`
// 战斗类型ID与野怪战斗为3与人战斗为1前端似乎未使用
// @UInt long
Status uint32 `fieldDesc:"战斗类型ID 但前端好像没有用到 与野怪战斗为3与人战斗似乎是1" `
//Mode uint32 `struc:"skip"`
// 我方信息
@@ -80,7 +79,7 @@ type NoteReadyToFightInfo struct {
OpponentPetList []ReadyFightPetInfo `fieldDesc:"敌方的精灵信息 如果是野怪 那么再给客户端发送这个包体时就提前生成好了这只精灵的PetInfo,然后把从PetInfo中把部分信息写入到这个敌方的精灵信息中再发送这个包结构体" serialize:"lengthFirst,lengthType=uint16,type=structArray"`
}
type FightUserInfo struct {
// 用户ID野怪为0@UInt long
// 用户ID野怪为0
UserID uint32 `fieldDesc:"userID 如果为野怪则为0" `
// 玩家名称野怪为UTF-8的'-'固定16字节
@@ -90,37 +89,36 @@ type FightUserInfo struct {
// ReadyFightPetInfo 准备战斗的精灵信息结构体ReadyFightPetInfo类
type ReadyFightPetInfo struct {
// 精灵ID@UInt long
// 精灵ID
ID uint32 `fieldDesc:"精灵ID" `
// 精灵等级@UInt long
// 精灵等级
Level uint32 `fieldDesc:"精灵等级" `
// 精灵当前HP@UInt long
// 精灵当前HP
Hp uint32 `fieldDesc:"精灵HP" `
// 精灵最大HP@UInt long
// 精灵最大HP
MaxHp uint32 `fieldDesc:"最大HP" `
SkillListLen uint32 `struc:"sizeof=SkillList"`
// 技能信息列表固定4个元素技能ID和剩余PP无技能则为0
// List<SkillInfo>初始化容量为4
SkillList []SkillInfo `fieldDesc:"技能信息 技能ID跟剩余PP 固定32字节 没有给0" serialize:"fixedLength=4,type=structArray"`
// 精灵捕获时间@UInt long
// 精灵捕获时间
CatchTime uint32 `fieldDesc:"精灵捕获时间" `
// 捕捉地图固定给0@UInt long
// 捕捉地图固定给0
CatchMap uint32 `fieldDesc:"捕捉地图 给0" `
// 固定给0@UInt long
// 固定给0
CatchRect uint32 `fieldDesc:"给0" `
// 固定给0@UInt long
CatchLevel uint32 `fieldDesc:"给0" `
SkinID uint32 `fieldDesc:"精灵皮肤ID" `
// 是否闪光(@UInt long → uint320=否1=是)
ShinyLen uint32 `json:"-" struc:"sizeof=ShinyInfo"`
ShinyInfo []data.GlowFilter `json:"ShinyInfo,omitempty"`
// 固定给0
CatchLevel uint32 `fieldDesc:"给0" `
SkinID uint32 `fieldDesc:"精灵皮肤ID" `
ShinyLen uint32 `json:"-" struc:"sizeof=ShinyInfo"`
ShinyInfo []data.GlowFilter `json:"ShinyInfo,omitempty"`
}
type FightOverInfo struct {
//0 正常结束