refactor(controller): 重构控制器函数命名和代码注释

- 重命名 EGG 函数为 EggGamePlay,更新宠物生成逻辑
- 重命名 Leiyi 函数为 GetLeiyiTrainStatus
- 重命名 Cacthpet 函数为 CatchPet,添加详细函数注释
- 为 ArenaSetOwner、ArenaFightOwner、ArenaGetInfo、ArenaUpfight、ArenaOwnerAcce
  等擂台相关函数添加注释前缀
- 重命名 PETKing 函数为 PetKing
- 重命名 FRESH_CHOICE_FIGHT_LEVEL 函数为 FreshChoiceFightLevel,添加详细参数说明
- 重命名 BuyMItem 函数为 BuyMultipleItems
- 重命名 ITEM_S
This commit is contained in:
2025-12-24 19:03:11 +08:00
parent 9baca27033
commit 502d497dce
32 changed files with 533 additions and 615 deletions

View File

@@ -9,35 +9,37 @@ import (
"github.com/jinzhu/copier"
)
// 基地设置
func (h Controller) SET_FITMENT(data *room.SET_FITMENT, c *player.Player) (result *room.NullInfo, err errorcode.ErrorCode) {
// SetFitment 设置基地家具摆放
// data: 包含家具列表的输入信息
// c: 当前玩家对象
// 返回: 空结果和错误码
func (h Controller) SetFitment(data *room.SET_FITMENT, c *player.Player) (result *room.NullInfo, err errorcode.ErrorCode) {
c.Service.Room.Set(data.Fitments)
return
}
func (h Controller) SET_Pet(data *room.C2S_PET_ROOM_SHOW, c *player.Player) (result *room.S2C_PET_ROOM_SHOW, err errorcode.ErrorCode) {
var showpet []uint32
for _, v := range data.PetShowList {
if v.CatchTime != 0 {
showpet = append(showpet, v.CatchTime)
// SetPet 设置基地展示的精灵
// data: 包含精灵展示列表的输入信息
// c: 当前玩家对象
// 返回: 精灵展示列表和错误码
func (h Controller) SetPet(data *room.C2S_PET_ROOM_SHOW, c *player.Player) (result *room.S2C_PET_ROOM_SHOW, err errorcode.ErrorCode) {
var showPetCatchTimes []uint32
for _, petShowInfo := range data.PetShowList {
if petShowInfo.CatchTime != 0 {
showPetCatchTimes = append(showPetCatchTimes, petShowInfo.CatchTime)
}
}
c.Service.Room.Show(showpet)
c.Service.Room.Show(showPetCatchTimes)
result = &room.S2C_PET_ROOM_SHOW{}
result.PetShowList = make([]pet.PetShortInfo, len(showpet))
for _, v := range showpet {
r1 := c.Service.Pet.PetInfo_One(v)
if r1.Data.ID == 0 {
result.PetShowList = make([]pet.PetShortInfo, len(showPetCatchTimes))
for _, catchTime := range showPetCatchTimes {
petInfo := c.Service.Pet.PetInfo_One(catchTime)
if petInfo.Data.ID == 0 {
continue
}
var r12 pet.PetShortInfo
copier.Copy(&r12, &r1.Data)
result.PetShowList = append(result.PetShowList, r12)
var petShortInfo pet.PetShortInfo
copier.Copy(&petShortInfo, &petInfo.Data)
result.PetShowList = append(result.PetShowList, petShortInfo)
}
return
}