feat(config): 新增固定异色功能并重构异色服务

- 新增 FixShiny 方法用于固定获取异色效果
- 重命名 Args 方法为 RandShiny 以明确功能
- 添加 utils 包依赖用于数据转换

feat(model): 扩展宠物异色相关方法

- 为 PetInfo 结构体添加 FixShiny 方法
- 修改 RandShiny 方法逻辑,确保异色信息正确添加

ref
This commit is contained in:
2025-12-30 00:45:23 +08:00
parent 9422f2df99
commit 41babda646
6 changed files with 49 additions and 5 deletions

View File

@@ -42,6 +42,7 @@ func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res
)
t := model.GenPetInfo(
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.Level, nil)
t.FixShiny()
service.NewUserService(uint32(admin.UserId)).Pet.PetAdd(t)
return

View File

@@ -215,7 +215,17 @@ func (pet *PetInfo) Cure() {
}
func (pet *PetInfo) RandShiny() {
co := service.NewShinyService().Args(pet.ID)
co := service.NewShinyService().RandShiny(pet.ID)
if co != nil {
pet.ShinyInfo = append(pet.ShinyInfo, *co)
}
//o.ShinyInfo[0].ColorMatrixFilter = GenerateRandomOffspringMatrix().Get()
//g.Dump(ttt.ShinyInfo)
// ttt.Shiny = 0 //待确认是否刷新异色
}
func (pet *PetInfo) FixShiny() {
co := service.NewShinyService().FixShiny(pet.ID)
if co != nil {
pet.ShinyInfo = append(pet.ShinyInfo, *co)
}