```
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:
@@ -20,13 +20,13 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
|
||||
|
||||
c.Info.Coins -= setSkillCost
|
||||
|
||||
_, onpet, ok := c.FindPet(data.CatchTime)
|
||||
_, currentPet, ok := c.FindPet(data.CatchTime)
|
||||
if !ok {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemBusy
|
||||
}
|
||||
|
||||
// 检查要替换的技能是否已存在
|
||||
_, _, exists := utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool {
|
||||
_, _, exists := utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool {
|
||||
return item.ID == data.ReplaceSkill
|
||||
})
|
||||
if exists {
|
||||
@@ -34,12 +34,12 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
|
||||
}
|
||||
|
||||
// 查找要学习的技能并替换
|
||||
_, hasSkill, ok := utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool {
|
||||
_, targetSkill, ok := utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool {
|
||||
return item.ID == data.HasSkill
|
||||
})
|
||||
if ok {
|
||||
hasSkill.ID = data.ReplaceSkill
|
||||
hasSkill.PP = uint32(xmlres.SkillMap[int(hasSkill.ID)].MaxPP)
|
||||
targetSkill.ID = data.ReplaceSkill
|
||||
targetSkill.PP = uint32(xmlres.SkillMap[int(targetSkill.ID)].MaxPP)
|
||||
}
|
||||
|
||||
return &pet.ChangeSkillOutInfo{
|
||||
@@ -47,8 +47,8 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
|
||||
}, 0
|
||||
}
|
||||
|
||||
// SkillSort 排序宠物技能,消耗50赛尔豆
|
||||
func (h Controller) SkillSort(data *pet.C2S_Skill_Sort, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
// SortPetSkills 排序宠物技能,消耗50赛尔豆
|
||||
func (h Controller) SortPetSkills(data *pet.C2S_Skill_Sort, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
const skillSortCost = 50
|
||||
|
||||
if !c.UseCoins(skillSortCost) {
|
||||
@@ -57,18 +57,18 @@ func (h Controller) SkillSort(data *pet.C2S_Skill_Sort, c *player.Player) (resul
|
||||
|
||||
c.Info.Coins -= skillSortCost
|
||||
|
||||
_, onpet, ok := c.FindPet(data.CapTm)
|
||||
_, currentPet, ok := c.FindPet(data.CapTm)
|
||||
if ok {
|
||||
var newSkillList []model.SkillInfo
|
||||
for _, skillID := range data.Skill {
|
||||
_, skill, found := utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool {
|
||||
_, skill, found := utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool {
|
||||
return item.ID == skillID
|
||||
})
|
||||
if found {
|
||||
newSkillList = append(newSkillList, *skill)
|
||||
}
|
||||
}
|
||||
onpet.SkillList = newSkillList
|
||||
currentPet.SkillList = newSkillList
|
||||
}
|
||||
|
||||
return nil, 0
|
||||
|
||||
Reference in New Issue
Block a user