package controller import ( "blazing/common/rpc" "blazing/common/socket/errorcode" "blazing/logic/service/common" "blazing/logic/service/fight" "blazing/logic/service/fight/pvp" "blazing/logic/service/player" ) // 表示"宠物王加入"的入站消息数据 type PetTOPLEVELnboundInfo struct { Head common.TomeeHeader `cmd:"2458" struc:"skip"` Mode uint32 //巅峰赛对战模式 19 = 普通模式单精灵 20 = 普通模式多精灵 } // JoINtop 处理控制器请求。 func (h Controller) JoINtop(data *PetTOPLEVELnboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { err = pvp.JoinPeakQueue(c, data.Mode) if err != 0 { return nil, err } if Maincontroller.RPCClient == nil || Maincontroller.RPCClient.MatchJoinOrUpdate == nil { pvp.CancelPeakQueue(c) return nil, errorcode.ErrorCodes.ErrSystemBusyTryLater } fightMode, status, err := pvp.NormalizePeakMode(data.Mode) if err != 0 { pvp.CancelPeakQueue(c) return nil, err } joinPayload := rpc.PVPMatchJoinPayload{ RuntimeServerID: h.UID, UserID: c.Info.UserID, Nick: c.Info.Nick, FightMode: fightMode, Status: status, CatchTimes: pvp.AvailableCatchTimes(c.GetPetInfo(0)), } if callErr := Maincontroller.RPCClient.MatchJoinOrUpdate(joinPayload); callErr != nil { pvp.CancelPeakQueue(c) return nil, errorcode.ErrorCodes.ErrSystemBusyTryLater } return nil, -1 } // CancelPeakQueue 处理控制器请求。 func (h Controller) CancelPeakQueue(data *PeakQueueCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if Maincontroller.RPCClient != nil && Maincontroller.RPCClient.MatchCancel != nil { _ = Maincontroller.RPCClient.MatchCancel(c.Info.UserID) } pvp.CancelPeakQueue(c) return nil, -1 } // SubmitPeakBanPick 处理控制器请求。 func (h Controller) SubmitPeakBanPick(data *PeakBanPickSubmitInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { err = pvp.SubmitBanPick(c, data.SelectedCatchTimes, data.BanCatchTimes) if err != 0 { return nil, err } return nil, -1 }