Files
bl/modules/config/model/config_egg.go

65 lines
1.9 KiB
Go
Raw Normal View History

package model
import (
"blazing/cool"
)
const (
2026-02-08 17:57:42 +08:00
TableNameEgg = "config_egg" // 性别配置表(替换原宠物融合表名)
)
2026-02-13 22:57:05 +08:00
type BaseConfig struct {
2026-02-14 11:51:34 +08:00
*cool.Model // 保留通用ModelID/创建时间/更新时间等)
IsEnable int32 `gorm:"not null;default:0;comment:'是否启用1:启用0:禁用)'" json:"is_enable"` // 保留原有逻辑
Remark string `gorm:"type:varchar(255);default:'';comment:'性别配置备注(如:默认性别规则)'" json:"remark"` // 调整注释
2026-02-13 22:57:05 +08:00
}
func (m *BaseConfig) TableName() string {
return "this_table_should_not_exist"
}
// 返回分组名
func (m *BaseConfig) GroupName() string {
return "default"
}
func NewBaseConfig() *BaseConfig {
2026-02-14 11:51:34 +08:00
return &BaseConfig{
Model: cool.NewModel(),
}
2026-02-13 22:57:05 +08:00
}
2026-02-08 17:57:42 +08:00
// Egg 性别配置模型(替换原宠物融合配方模型)
type Egg struct {
2026-02-13 22:57:05 +08:00
*BaseConfig
//雌性
2026-02-09 01:29:33 +08:00
MalePetIDs []int32 `gorm:"type:int[];comment:'雄性宠物ID列表[1001,1002]'" json:"male_pet_ids"`
//雄性
2026-02-08 17:57:42 +08:00
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"`
}
2026-02-08 17:57:42 +08:00
// TableName 指定性别配置表名(替换原宠物融合表名)
func (*Egg) TableName() string {
return TableNameEgg
}
2026-02-08 17:57:42 +08:00
// GroupName 表分组保持原逻辑的default分组
func (*Egg) GroupName() string {
return "default"
}
2026-02-08 17:57:42 +08:00
// NewEgg 创建性别配置实例替换原NewPetFusion
func NewEgg() *Egg {
return &Egg{
2026-02-13 22:57:05 +08:00
BaseConfig: NewBaseConfig(),
}
}
2026-02-08 17:57:42 +08:00
// init 初始化性别配置表结构(替换原宠物融合表初始化)
func init() {
2026-02-08 17:57:42 +08:00
cool.CreateTable(&Egg{})
}