```
refactor(controller): 重构控制器函数命名和代码注释 - 重命名 EGG 函数为 EggGamePlay,更新宠物生成逻辑 - 重命名 Leiyi 函数为 GetLeiyiTrainStatus - 重命名 Cacthpet 函数为 CatchPet,添加详细函数注释 - 为 ArenaSetOwner、ArenaFightOwner、ArenaGetInfo、ArenaUpfight、ArenaOwnerAcce 等擂台相关函数添加注释前缀 - 重命名 PETKing 函数为 PetKing - 重命名 FRESH_CHOICE_FIGHT_LEVEL 函数为 FreshChoiceFightLevel,添加详细参数说明 - 重命名 BuyMItem 函数为 BuyMultipleItems - 重命名 ITEM_SALE 函数为 ItemSale,优化代码结构 - 重命名 UserItemList 函数为 GetUserItemList,重命名 ItemUsePet 为 UsePetItemOutOfFight 添加 ResetNature 函数注释 - 重命名 COMMEND_ONLINE 函数为 GetServerOnline - 重命名 Login 函数,优化变量命名 - 重命名 MapEnter 为 EnterMap,MapHot 为 GetMapHot,MapLeave 为 LeaveMap MapList 为 GetMapPlayerList,Attack_Boss 为 AttackBoss - 为 GetNonoInfo 函数添加注释前缀 - 重命名 IS_COLLECT 函数为 IsCollect - 重命名 PetEVdiy 函数为 PetEVDiy,添加详细注释 - 为 GetPetInfo、GetPetList、GetPetReleaseList、PetReleaseToWarehouse、 PetRetrieveFromWarehouse、TogglePetBagWarehouse、PlayerShowPet、 PetOneCure、PetFirst、GetPetBargeList 等宠物相关函数添加注释 - 重命名 SetPetSkill 为 SetPetSkill,SkillSort 为 SortPetSkills - 重命名 BUY_FITMENT 为 BuyFitment,添加函数注释 ```
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/modules/blazing/model"
|
||||
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
// SetPetSkill 设置宠物技能,消耗50赛尔豆
|
||||
@@ -24,12 +26,19 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
|
||||
if !ok {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemBusy
|
||||
}
|
||||
canleaernskill := onpet.GetLevelRangeCanLearningSkills(1, onpet.Level)
|
||||
|
||||
// 检查要替换的技能是否已存在
|
||||
_, _, exists := utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool {
|
||||
_, ok = lo.Find(canleaernskill, func(item uint32) bool {
|
||||
return item == data.ReplaceSkill
|
||||
})
|
||||
|
||||
if !ok {
|
||||
return result, errorcode.ErrorCodes.ErrSystemBusy
|
||||
}
|
||||
_, _, ok = utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool { //已经存在技能
|
||||
return item.ID == data.ReplaceSkill
|
||||
})
|
||||
if exists {
|
||||
if ok {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemBusy
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user