package model import ( "blazing/cool" "fmt" ) const TableNamePet = "pet" // Pet mapped from table 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:longtext;not null;comment:'精灵全部数据'" json:"data"` } 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"` Skill1ID int32 `gorm:"not null;default:0;comment:'技能1'" json:"skill_1_id"` Skill2ID int32 `gorm:"not null;default:0;comment:'技能2'" json:"skill_2_id"` Skill3ID int32 `gorm:"not null;default:0;comment:'技能3'" json:"skill_3_id"` Skill4ID int32 `gorm:"not null;default:0;comment:'技能4'" json:"skill_4_id"` Skill1PP int16 `gorm:"not null;default:0;comment:'技能1PP'" json:"skill_1_pp"` Skill2PP int16 `gorm:"not null;default:0;comment:'技能2PP'" json:"skill_2_pp"` Skill3PP int16 `gorm:"not null;default:0;comment:'技能3PP'" json:"skill_3_pp"` Skill4PP int16 `gorm:"not null;default:0;comment:'技能4PP'" json:"skill_4_pp"` 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"` } // 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() { err := cool.CreateTable(&Pet{}) fmt.Println(err) }