65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const (
|
||
TableNameEgg = "config_egg" // 性别配置表(替换原宠物融合表名)
|
||
)
|
||
|
||
type BaseConfig struct {
|
||
*cool.Model // 保留通用Model(ID/创建时间/更新时间等)
|
||
IsEnable int32 `gorm:"not null;default:0;comment:'是否启用(1:启用,0:禁用)'" json:"is_enable"` // 保留原有逻辑
|
||
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
|
||
}
|
||
|
||
func (m *BaseConfig) TableName() string {
|
||
return "this_table_should_not_exist"
|
||
}
|
||
|
||
// 返回分组名
|
||
func (m *BaseConfig) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
func NewBaseConfig() *BaseConfig {
|
||
return &BaseConfig{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// Egg 性别配置模型(替换原宠物融合配方模型)
|
||
type Egg struct {
|
||
*BaseConfig
|
||
//雌性
|
||
MalePetIDs []int32 `gorm:"type:int[];comment:'雄性宠物ID列表(如:[1001,1002])'" json:"male_pet_ids"`
|
||
//雄性
|
||
FemalePetIDs []int32 `gorm:"type:int[];comment:'雌性宠物ID列表(如:[1001,1002])'" json:"female_pet_ids"`
|
||
//子代指定性别配置表名
|
||
OutputMons []int32 `gorm:"type:int[];not null;comment:'宠物类型ID'" json:"pet_type_id"`
|
||
Probs []int32 `gorm:"type:int[];not null;comment:'对应子代宠物类型的概率(如:[50,50]表示均等概率)'" json:"probs"`
|
||
}
|
||
|
||
// TableName 指定性别配置表名(替换原宠物融合表名)
|
||
func (*Egg) TableName() string {
|
||
return TableNameEgg
|
||
}
|
||
|
||
// GroupName 表分组(保持原逻辑的default分组)
|
||
func (*Egg) GroupName() string {
|
||
return "default"
|
||
}
|
||
|
||
// NewEgg 创建性别配置实例(替换原NewPetFusion)
|
||
func NewEgg() *Egg {
|
||
return &Egg{
|
||
BaseConfig: NewBaseConfig(),
|
||
}
|
||
}
|
||
|
||
// init 初始化性别配置表结构(替换原宠物融合表初始化)
|
||
func init() {
|
||
cool.CreateTable(&Egg{})
|
||
}
|