Files
bl/logic/controller/nono.go
昔念 502d497dce ```
refactor(controller): 重构控制器函数命名和代码注释

- 重命名 EGG 函数为 EggGamePlay,更新宠物生成逻辑
- 重命名 Leiyi 函数为 GetLeiyiTrainStatus
- 重命名 Cacthpet 函数为 CatchPet,添加详细函数注释
- 为 ArenaSetOwner、ArenaFightOwner、ArenaGetInfo、ArenaUpfight、ArenaOwnerAcce
  等擂台相关函数添加注释前缀
- 重命名 PETKing 函数为 PetKing
- 重命名 FRESH_CHOICE_FIGHT_LEVEL 函数为 FreshChoiceFightLevel,添加详细参数说明
- 重命名 BuyMItem 函数为 BuyMultipleItems
- 重命名 ITEM_S
2025-12-24 19:03:11 +08:00

67 lines
1.8 KiB
Go

package controller
import (
"blazing/common/socket/errorcode"
"blazing/logic/service/nono"
"blazing/logic/service/player"
"github.com/jinzhu/copier"
)
func (h Controller) NonoFollowOrHome(data *nono.NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
c.Info.NONO.Flag = data.Flag
result = &nono.NonoFollowOutInfo{
UserID: data.Head.UserID,
SuperStage: data.Flag,
Flag: data.Flag,
Nick: "",
Color: 0,
Power: 0,
}
return
}
// GetNonoInfo 获取nono信息
func (h *Controller) GetNonoInfo(data *nono.NonoInboundInfo, c *player.Player) (result *nono.NonoOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &nono.NonoOutboundInfo{}
copier.Copy(result, &c.Info.NONO)
result.UserID = c.Info.UserID
for i := 0; i < 20; i++ {
result.Func[i] = 255
}
result.Num = 1
result.SuperNono = 1
result.SuperLevel = 12
return
}
func (h *Controller) SwitchFlying(data *nono.SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
result = &nono.SwitchFlyingOutboundInfo{
UserId: data.Head.UserID,
Type: data.Type,
}
c.GetSpace().Broadcast(c, data.Head.CMD, result)
return
}
func (h *Controller) PlayerPetCure(data *nono.PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的
if c.GetSpace().Owner.UserID == c.Info.UserID {
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
}
if !c.UseCoins(50) {
return result, errorcode.ErrorCodes.ErrSunDouInsufficient10016
}
for i := 0; i < len(c.Info.PetList); i++ {
c.Info.PetList[i].Cure()
}
c.Info.Coins -= 50
return
}