Files
bl/modules/blazing/model/PetInfo.go

120 lines
7.6 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 model
import (
"blazing/cool"
)
const TableNamePet = "pet"
// Pet mapped from table <pet>
type Pet struct {
*cool.Model
PlayerID uint64 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"`
Data string `gorm:"type:text;not null;comment:'精灵全部数据'" json:"data"`
}
// PetInfo 精灵信息结构,合并了两个版本的字段
type PetInfo struct {
// 第一个版本中的字段
CapturePlayerID uint64 `gorm:"not null;comment:'捕获者ID'" json:"capture_player_id"`
CaptureTime int64 `gorm:"not null;comment:'捕获时间(时间戳)'" json:"capture_time"`
CaptureMap int32 `gorm:"not null;comment:'捕获地图ID'" json:"capture_map"`
CaptureRect int16 `gorm:"not null;default:0;comment:'捕获区域(未知用途默认为0)'" json:"capture_rect"`
CaptureLevel int16 `gorm:"not null;default:0;comment:'捕获时的等级'" json:"capture_level"`
PetTypeID int32 `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
IndividualValue int16 `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
Nature int16 `gorm:"not null;comment:'性格类型'" json:"nature"`
AbilityTypeEnum int16 `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
Shiny int32 `gorm:"not null;default:0;comment:'闪光ID(异色!=0非异色=0)'" json:"shiny"`
Level int16 `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
CurrentExp int32 `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
CurrentHP int32 `gorm:"not null;comment:'当前生命值'" json:"current_hp"`
MaxHP int32 `gorm:"not null;comment:'实际最大生命值'" json:"max_hp"`
Attack int32 `gorm:"not null;comment:'实际攻击力'" json:"attack"`
Defense int32 `gorm:"not null;comment:'实际防御力'" json:"defense"`
SpecialAttack int32 `gorm:"not null;comment:'实际特殊攻击力'" json:"special_attack"`
SpecialDefense int32 `gorm:"not null;comment:'实际特殊防御力'" json:"special_defense"`
Speed int32 `gorm:"not null;comment:'实际速度'" json:"speed"`
EvHP int16 `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
EvAttack int16 `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
EvDefense int16 `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
EvSpecialAttack int16 `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
EvSpecialDefense int16 `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
EvSpeed int16 `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
PetSkill []PetSkillInfo // 技能组
ElementalOrbID int32 `gorm:"not null;default:0;comment:'属性能量珠ID'" json:"elemental_orb_id"`
SpecialOrbID int32 `gorm:"not null;default:0;comment:'平衡/暴击能量珠ID'" json:"special_orb_id"`
ElementalOrbCount int16 `gorm:"not null;default:0;comment:'属性能量珠剩余使用次数'" json:"elemental_orb_count"`
SpecialOrbCount int16 `gorm:"not null;default:0;comment:'平衡/暴击能量珠剩余使用次数'" json:"special_orb_count"`
IndividualGuarantee int64 `gorm:"not null;default:0;comment:'个体值保底(0=无保底)'" json:"individual_guarantee"`
NatureGuarantee int64 `gorm:"not null;default:0;comment:'性格保底(0=无保底)'" json:"nature_guarantee"`
Freed bool `gorm:"default:false;not null;comment:'是否已放生(0=未放生,1=已放生)'" json:"freed"`
FreedTime string `gorm:"comment:'放生时间'" json:"freed_time"`
// 第二个版本中的字段
ID uint32 `struc:"uint32" gorm:"not null;comment:'精灵编号'" json:"id"`
Name [16]byte `struc:"[16]byte" gorm:"type:char(16);comment:'名字'" json:"name"`
DV uint32 `struc:"uint32" gorm:"not null;comment:'个体值'" json:"dv"`
LvExp uint32 `struc:"uint32" gorm:"not null;comment:'当前等级所需的经验'" json:"lv_exp"`
NextLvExp uint32 `struc:"uint32" gorm:"not null;comment:'升到下一级的经验'" json:"next_lv_exp"`
Defence uint32 `struc:"uint32" gorm:"not null;comment:'防御'" json:"defence"`
//EvSpecialDefense uint32 `struc:"uint32" gorm:"not null;comment:'特防学习力'" json:"ev_special_defense"`
SkillSize uint32 `struc:"uint32" gorm:"not null;comment:'技能个数'" json:"skill_size"`
SkillList [4]SkillInfo `gorm:"embedded;embeddedPrefix:skill_list_" json:"skill_list"`
CatchTime uint32 `struc:"uint32" gorm:"not null;comment:'捕捉时间'" json:"catch_time"`
CatchRect uint32 `struc:"uint32" default:"0" gorm:"default:0;comment:'未知默认0'" json:"catch_rect"`
CatchLevel uint32 `struc:"uint32" default:"0" gorm:"default:0;comment:'捕获等级默认0'" json:"catch_level"`
SkinID uint32 `struc:"uint32" default:"0" gorm:"default:0;comment:'皮肤id默认0'" json:"skin_id"`
EffectInfoLen uint16 `struc:"sizeof=EffectInfo" gorm:"comment:'特性列表长度'" json:"effect_info_len"`
EffectInfo []PetEffectInfo `gorm:"embedded;embeddedPrefix:effect_info_" json:"effect_info"`
}
// PetSkillInfo 精灵技能信息结构,合并了两个版本
type PetSkillInfo struct {
SkillID1 int32 `gorm:"not null;default:0;comment:'技能1ID'" json:"skill_1_id"`
PP1 int16 `gorm:"not null;default:0;comment:'技能1PP'" json:"skill_1_pp"`
SkillID2 int32 `gorm:"default:0;comment:'技能2ID'" json:"skill_2_id"`
PP2 int16 `gorm:"default:0;comment:'技能2PP'" json:"skill_2_pp"`
SkillID3 int32 `gorm:"default:0;comment:'技能3ID'" json:"skill_3_id"`
PP3 int16 `gorm:"default:0;comment:'技能3PP'" json:"skill_3_pp"`
SkillID4 int32 `gorm:"default:0;comment:'技能4ID'" json:"skill_4_id"`
PP4 int16 `gorm:"default:0;comment:'技能4PP'" json:"skill_4_pp"`
}
// PetEffectInfo 精灵特性信息结构(第二个版本中的定义)
type PetEffectInfo struct {
ItemID uint32 `struc:"uint32" gorm:"not null;comment:'特性晶片对应的物品id'" json:"item_id"`
Status byte `struc:"byte" default:"1" gorm:"default:1;comment:'状态'" json:"status"`
LeftCount byte `struc:"byte" gorm:"comment:'未知'" json:"left_count"`
EffectID uint16 `struc:"uint16" gorm:"not null;comment:'特性id'" json:"effect_id"`
Reserve1 byte `struc:"byte" gorm:"comment:'保留字段1'" json:"reserve1"`
Reserve2 byte `struc:"byte" gorm:"comment:'保留字段2'" json:"reserve2"`
Reserve3 byte `struc:"byte" gorm:"comment:'保留字段3'" json:"reserve3"`
Reserve4 [13]byte `struc:"[13]byte" gorm:"type:char(13);comment:'保留字段4'" json:"reserve4"`
}
// TableName Pet's table name
func (*Pet) TableName() string {
return TableNamePet
}
// GroupName Pet's table group
func (*Pet) GroupName() string {
return "default"
}
// NewPet create a new Pet
func NewPet() *Pet {
return &Pet{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
_ = cool.CreateTable(&Pet{})
// fmt.Println(err)
}