From 6510e4e09b1bb421f2d20f2307822debf22ca3d1 Mon Sep 17 00:00:00 2001 From: xinian Date: Sun, 5 Apr 2026 07:24:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E7=B1=BB=E5=9E=8B=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/controller/fight_base.go | 18 +++++++-------- logic/controller/fight_boss野怪和地图怪.go | 4 ++-- logic/controller/fight_pvp_king.go | 4 ++-- logic/controller/fight_pvp_withplayer.go | 6 ++--- logic/controller/fight_塔.go | 8 +++---- logic/controller/fight_巅峰.go | 4 ++-- logic/controller/fight_擂台.go | 27 +++++++++++----------- logic/controller/inbound_fight.go | 10 ++------ logic/controller/inbound_map_room_nono.go | 6 ++--- logic/controller/item_buy.go | 6 ++--- logic/controller/item_sale.go | 3 +-- logic/controller/item_use.go | 12 +++++----- logic/controller/login_main.go | 2 +- logic/controller/map.go | 10 ++++---- logic/controller/nono.go | 8 +++---- logic/controller/pet_bag.go | 6 ++--- logic/controller/pet_barge.go | 2 +- logic/controller/pet_fusion.go | 2 +- logic/controller/pet_info.go | 6 ++--- logic/controller/pet_manage.go | 8 +++---- logic/controller/pet_skill.go | 4 ++-- logic/controller/room_buy.go | 2 +- logic/controller/room_info.go | 8 +++---- logic/controller/room_set.go | 4 ++-- logic/controller/user_action.go | 20 ++++++++-------- logic/controller/user_cdk.go | 2 +- logic/controller/user_friend.go | 8 +++---- logic/controller/user_info.go | 8 +++---- logic/controller/user_talk.go | 4 ++-- logic/controller/user_task.go | 10 ++++---- logic/controller/walk.go | 3 +-- 31 files changed, 108 insertions(+), 117 deletions(-) diff --git a/logic/controller/fight_base.go b/logic/controller/fight_base.go index db2625c86..30ef8bd7b 100644 --- a/logic/controller/fight_base.go +++ b/logic/controller/fight_base.go @@ -18,7 +18,7 @@ func (h Controller) checkFightStatus(c *player.Player) errorcode.ErrorCode { } // OnReadyToFight 准备战斗 -func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) OnReadyToFight(data *ReadyToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -27,7 +27,7 @@ func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *playe } // UseSkill 使用技能包 -func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) UseSkill(data *UseSkillInInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -37,7 +37,7 @@ func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (resu // UseSkillAt 组队/多战位技能包(cmd=7505)。 // 目标关系:0=对方 1=自己 2=队友。 -func (h Controller) UseSkillAt(data *fight.UseSkillAtInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) UseSkillAt(data *UseSkillAtInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -70,7 +70,7 @@ func (h Controller) UseSkillAt(data *fight.UseSkillAtInboundInfo, c *player.Play } // Escape 战斗逃跑 -func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) Escape(data *EscapeFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -80,7 +80,7 @@ func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player) } // ChangePet 切换精灵 -func (h Controller) ChangePet(data *fight.ChangePetInboundInfo, c *player.Player) (result *info.ChangePetInfo, err errorcode.ErrorCode) { +func (h Controller) ChangePet(data *ChangePetInboundInfo, c *player.Player) (result *info.ChangePetInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -89,7 +89,7 @@ func (h Controller) ChangePet(data *fight.ChangePetInboundInfo, c *player.Player } // Capture 捕捉精灵 -func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *player.Player) (result *info.CatchMonsterOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) Capture(data *CatchMonsterInboundInfo, c *player.Player) (result *info.CatchMonsterOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -104,7 +104,7 @@ func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *player.Playe } // LoadPercent 加载进度 -func (h Controller) LoadPercent(data *fight.LoadPercentInboundInfo, c *player.Player) (result *info.LoadPercentOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) LoadPercent(data *LoadPercentInboundInfo, c *player.Player) (result *info.LoadPercentOutboundInfo, err errorcode.ErrorCode) { if c.FightC == nil { return nil, -1 } @@ -113,7 +113,7 @@ func (h Controller) LoadPercent(data *fight.LoadPercentInboundInfo, c *player.Pl } // UsePetItemInboundInfo 使用宠物道具 -func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c *player.Player) (result *info.UsePetIteminfo, err errorcode.ErrorCode) { +func (h Controller) UsePetItemInboundInfo(data *UsePetItemInboundInfo, c *player.Player) (result *info.UsePetIteminfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } @@ -128,7 +128,7 @@ func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c * } // FightChat 战斗聊天 -func (h Controller) FightChat(data *fight.ChatInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) FightChat(data *ChatInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err := h.checkFightStatus(c); err != 0 { return nil, err } diff --git a/logic/controller/fight_boss野怪和地图怪.go b/logic/controller/fight_boss野怪和地图怪.go index 614e4f893..19d15088b 100644 --- a/logic/controller/fight_boss野怪和地图怪.go +++ b/logic/controller/fight_boss野怪和地图怪.go @@ -19,7 +19,7 @@ import ( ) // PlayerFightBoss 挑战地图boss -func (Controller) PlayerFightBoss(req *fight.ChallengeBossInboundInfo, p *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (Controller) PlayerFightBoss(req *ChallengeBossInboundInfo, p *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err = p.CanFight(); err != 0 { return nil, err } @@ -59,7 +59,7 @@ func (Controller) PlayerFightBoss(req *fight.ChallengeBossInboundInfo, p *player } // OnPlayerFightNpcMonster 战斗野怪 -func (Controller) OnPlayerFightNpcMonster(req *fight.FightNpcMonsterInboundInfo, p *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (Controller) OnPlayerFightNpcMonster(req *FightNpcMonsterInboundInfo, p *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if err = p.CanFight(); err != 0 { return nil, err } diff --git a/logic/controller/fight_pvp_king.go b/logic/controller/fight_pvp_king.go index 10b403696..e82d86161 100644 --- a/logic/controller/fight_pvp_king.go +++ b/logic/controller/fight_pvp_king.go @@ -13,7 +13,7 @@ import ( //大乱斗 -func (h Controller) PetMelee(data *fight.StartPetWarInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) PetMelee(data *StartPetWarInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { c.Fightinfo.Mode = info.BattleMode.PET_MELEE c.Fightinfo.Status = info.BattleMode.PET_MELEE @@ -70,7 +70,7 @@ func (h Controller) PetMelee(data *fight.StartPetWarInboundInfo, c *player.Playe return } -func (h Controller) PetKing(data *fight.PetKingJoinInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) PetKing(data *PetKingJoinInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { c.Fightinfo.Status = info.BattleMode.PET_TOPLEVEL var ElementTypeNumbers = []int{1, 2, 3, 5, 11, 4, 6, 7, 9} diff --git a/logic/controller/fight_pvp_withplayer.go b/logic/controller/fight_pvp_withplayer.go index 210f62400..e3a911762 100644 --- a/logic/controller/fight_pvp_withplayer.go +++ b/logic/controller/fight_pvp_withplayer.go @@ -12,7 +12,7 @@ import ( ) // 接收战斗或者取消战斗的包 -func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) OnPlayerHandleFightInvite(data *HandleFightInviteInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if c.IsArenaPVPLocked() { return nil, errorcode.ErrorCodes.ErrSystemError } @@ -78,7 +78,7 @@ func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInbou } // 邀请其他人进行战斗 -func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) OnPlayerInviteOtherFight(data *InviteToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if c.IsArenaPVPLocked() { return nil, errorcode.ErrorCodes.ErrSystemError } @@ -103,7 +103,7 @@ func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInf } // 取消队列 -func (h Controller) OnPlayerCanceledOtherInviteFight(data *fight.InviteFightCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) OnPlayerCanceledOtherInviteFight(data *InviteFightCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { atomic.StoreUint32(&c.Fightinfo.Mode, 0) //设置状态为0 return } diff --git a/logic/controller/fight_塔.go b/logic/controller/fight_塔.go index 80a8163c8..e8369ff21 100644 --- a/logic/controller/fight_塔.go +++ b/logic/controller/fight_塔.go @@ -36,7 +36,7 @@ type towerChoiceState struct { } // 暗黑门进入boss -func (h Controller) FreshOpen(data *fight.C2S_OPEN_DARKPORTAL, c *player.Player) (result *fight.S2C_OPEN_DARKPORTAL, err errorcode.ErrorCode) { +func (h Controller) FreshOpen(data *C2S_OPEN_DARKPORTAL, c *player.Player) (result *fight.S2C_OPEN_DARKPORTAL, err errorcode.ErrorCode) { result = &fight.S2C_OPEN_DARKPORTAL{} towerBosses := service.NewTower110Service().Boss(uint32(data.Level)) @@ -57,7 +57,7 @@ func (h Controller) FreshOpen(data *fight.C2S_OPEN_DARKPORTAL, c *player.Player) } // FreshChoiceFightLevel 处理玩家选择挑战模式(试炼之塔或勇者之塔) -func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEVEL, c *player.Player) (result *fight.S2C_FreshChoiceLevelRequestInfo, err errorcode.ErrorCode) { +func (h Controller) FreshChoiceFightLevel(data *C2S_FRESH_CHOICE_FIGHT_LEVEL, c *player.Player) (result *fight.S2C_FreshChoiceLevelRequestInfo, err errorcode.ErrorCode) { result = &fight.S2C_FreshChoiceLevelRequestInfo{} c.Info.CurrentFreshStage = utils.Max(c.Info.CurrentFreshStage, 1) c.Info.CurrentStage = utils.Max(c.Info.CurrentStage, 1) @@ -82,7 +82,7 @@ func (h Controller) FreshChoiceFightLevel(data *fight.C2S_FRESH_CHOICE_FIGHT_LEV return result, 0 } -func (h Controller) FreshLeaveFightLevel(data *fight.FRESH_LEAVE_FIGHT_LEVEL, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) FreshLeaveFightLevel(data *FRESH_LEAVE_FIGHT_LEVEL, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { _ = data defer c.GetSpace().EnterMap(c) @@ -92,7 +92,7 @@ func (h Controller) FreshLeaveFightLevel(data *fight.FRESH_LEAVE_FIGHT_LEVEL, c return result, 0 } -func (h Controller) PetTawor(data *fight.StartTwarInboundInfo, c *player.Player) (result *fight.S2C_ChoiceLevelRequestInfo, err errorcode.ErrorCode) { +func (h Controller) PetTawor(data *StartTwarInboundInfo, c *player.Player) (result *fight.S2C_ChoiceLevelRequestInfo, err errorcode.ErrorCode) { if err = c.CanFight(); err != 0 { return nil, err } diff --git a/logic/controller/fight_巅峰.go b/logic/controller/fight_巅峰.go index 75a87933e..6cbd61c0f 100644 --- a/logic/controller/fight_巅峰.go +++ b/logic/controller/fight_巅峰.go @@ -23,12 +23,12 @@ func (h Controller) JoINtop(data *PetTOPLEVELnboundInfo, c *player.Player) (resu return nil, -1 } -func (h Controller) CancelPeakQueue(data *fight.PeakQueueCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) CancelPeakQueue(data *PeakQueueCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { pvp.CancelPeakQueue(c) return nil, -1 } -func (h Controller) SubmitPeakBanPick(data *fight.PeakBanPickSubmitInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +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 diff --git a/logic/controller/fight_擂台.go b/logic/controller/fight_擂台.go index 2ea6cee2f..f0e464161 100644 --- a/logic/controller/fight_擂台.go +++ b/logic/controller/fight_擂台.go @@ -6,19 +6,20 @@ import ( "blazing/modules/player/model" "sync/atomic" + "blazing/logic/service/common" "blazing/logic/service/fight" "blazing/logic/service/fight/info" "blazing/logic/service/player" "blazing/logic/service/space" ) +type ARENA_SET_OWENR struct { + Head common.TomeeHeader `cmd:"2417" struc:"skip"` +} + // ArenaSetOwner 处理玩家占据擂台的请求 -// public static const ARENA_SET_OWENR:uint = 2417; -// 如果星际擂台上无人,站到星际擂台的包 -// 前端到后端无数据内容 空包 -// 后端到前端无数据内容 空包 // ArenaSetOwner 都需要通过2419包广播更新擂台状态 -func (h Controller) ArenaSetOwner(data *fight.ARENA_SET_OWENR, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ArenaSetOwner(data *ARENA_SET_OWENR, c *player.Player) (result *struct{}, err errorcode.ErrorCode) { r := c.CanFight() if r != 0 { return nil, r @@ -34,13 +35,13 @@ func (h Controller) ArenaSetOwner(data *fight.ARENA_SET_OWENR, c *player.Player) return nil, errorcode.ErrorCodes.ErrChampionExists } - +type ARENA_FIGHT_OWENR struct { + Head common.TomeeHeader `cmd:"2418" struc:"skip"` +} // ArenaFightOwner 挑战擂台的包 -// 前端到后端无数据内容 空包 -// 后端到前端无数据内容 空包 // 还是后端主动发送2503的包给双方前端后 等待前端加载完毕 主动发送2404包通知后端开始战斗 // ArenaFightOwner 并不会通知对方是否接受挑战。只要有人挑战就直接进入对战 -func (h Controller) ArenaFightOwner(data1 *fight.ARENA_FIGHT_OWENR, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ArenaFightOwner(data1 *ARENA_FIGHT_OWENR, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { r := c.CanFight() if r != 0 { @@ -141,17 +142,15 @@ func (h Controller) ArenaFightOwner(data1 *fight.ARENA_FIGHT_OWENR, c *player.Pl // ArenaGetInfo 获取星际擂台信息的包 进入空间站地图前端会发送请求包 或者 有人站到星际擂台上后 广播回包 // 前端到后端无数据内容 // ArenaGetInfo 后端到前端 -func (h Controller) ArenaGetInfo(data *fight.ARENA_GET_INFO, c *player.Player) (result *space.ARENA, err errorcode.ErrorCode) { +func (h Controller) ArenaGetInfo(data *ARENA_GET_INFO, c *player.Player) (result *space.ARENA, err errorcode.ErrorCode) { result = &c.GetSpace().Owner return } // ArenaUpfight 放弃擂台挑战的包 -// 前端到后端无数据内容 -// 后端到前端无数据内容 // ArenaUpfight 都需要通过2419包广播更新擂台状态 -func (h Controller) ArenaUpfight(data *fight.ARENA_UPFIGHT, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ArenaUpfight(data *ARENA_UPFIGHT, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { //原子操作,修改擂台状态 if atomic.LoadUint32(&c.GetSpace().Owner.UserID) != c.GetInfo().UserID { //说明已经有人了 return nil, errorcode.ErrorCodes.ErrChampionCannotCancel @@ -173,7 +172,7 @@ func (h Controller) ArenaUpfight(data *fight.ARENA_UPFIGHT, c *player.Player) (r // 后端到前端无数据内容 // public static const ARENA_OWENR_OUT:uint = 2423; // ArenaOwnerAcce 此包不清楚具体怎么触发 但已知此包为后端主动发送。不清楚什么情况下回用到 -func (h Controller) ArenaOwnerAcce(data *fight.ARENA_OWENR_ACCE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ArenaOwnerAcce(data *ARENA_OWENR_ACCE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { s := c.GetSpace() diff --git a/logic/controller/inbound_fight.go b/logic/controller/inbound_fight.go index 6c86e85e2..be2695e51 100644 --- a/logic/controller/inbound_fight.go +++ b/logic/controller/inbound_fight.go @@ -28,13 +28,7 @@ type StartTwarInboundInfo struct { Head common.TomeeHeader `cmd:"2429|2415|2425" struc:"skip"` } -type ARENA_SET_OWENR struct { - Head common.TomeeHeader `cmd:"2417" struc:"skip"` -} - -type ARENA_FIGHT_OWENR struct { - Head common.TomeeHeader `cmd:"2418" struc:"skip"` -} + type ARENA_GET_INFO struct { Head common.TomeeHeader `cmd:"2419" struc:"skip"` @@ -76,7 +70,7 @@ type HandleFightInviteInboundInfo struct { } type InviteToFightInboundInfo struct { - Head common.TomeeHeader `cmd:"2401" struc:"skip"` + Head common.TomeeHeader `cmd:"2401" struc:"skip"` UserID uint32 Mode uint32 } diff --git a/logic/controller/inbound_map_room_nono.go b/logic/controller/inbound_map_room_nono.go index a8e7b02dc..011320c09 100644 --- a/logic/controller/inbound_map_room_nono.go +++ b/logic/controller/inbound_map_room_nono.go @@ -51,9 +51,9 @@ type FitmentAllInboundEmpty struct { } type SET_FITMENT struct { - Head common.TomeeHeader `cmd:"10008" struc:"skip"` - RoomID uint32 `json:"roomID"` - FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"` + Head common.TomeeHeader `cmd:"10008" struc:"skip"` + RoomID uint32 `json:"roomID"` + FitmentsLen uint32 `json:"fitmentsLen" struc:"sizeof=Fitments"` Fitments []model.FitmentShowInfo `json:"usedList"` } diff --git a/logic/controller/item_buy.go b/logic/controller/item_buy.go index a5e5722dc..50adeef0d 100644 --- a/logic/controller/item_buy.go +++ b/logic/controller/item_buy.go @@ -11,7 +11,7 @@ import ( // 防止封包通过领取来获取道具 // BuyItem 购买单个道具 -func (h Controller) BuyItem(data *item.BuyInboundInfo, player *player.Player) (result *item.BuyOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) BuyItem(data *BuyInboundInfo, player *player.Player) (result *item.BuyOutboundInfo, err errorcode.ErrorCode) { result = &item.BuyOutboundInfo{Coins: player.Info.Coins} bought, err := buySeerdouBackpackItem(player, data.ItemId, data.Count) @@ -31,7 +31,7 @@ func (h Controller) BuyItem(data *item.BuyInboundInfo, player *player.Player) (r } // BuyMultipleItems 批量购买道具 -func (h Controller) BuyMultipleItems(data *item.BuyMultiInboundInfo, player *player.Player) (result *item.BuyMultiOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) BuyMultipleItems(data *BuyMultiInboundInfo, player *player.Player) (result *item.BuyMultiOutboundInfo, err errorcode.ErrorCode) { for _, itemID := range data.ItemIds { bought, buyErr := buySeerdouBackpackItem(player, int64(itemID), 1) if buyErr == errorcode.ErrorCodes.ErrSunDouInsufficient10016 { @@ -48,7 +48,7 @@ func (h Controller) BuyMultipleItems(data *item.BuyMultiInboundInfo, player *pla } // BuyGoldItem 使用金豆购买商品 -func (h Controller) BuyGoldItem(data *item.C2S_GOLD_BUY_PRODUCT, player *player.Player) (result *item.S2C_GoldBuyProductInfo, err errorcode.ErrorCode) { +func (h Controller) BuyGoldItem(data *C2S_GOLD_BUY_PRODUCT, player *player.Player) (result *item.S2C_GoldBuyProductInfo, err errorcode.ErrorCode) { pro := service.NewShopService().Get(data.ProductID) if pro == nil { return nil, errorcode.ErrorCodes.ErrTooManyProducts diff --git a/logic/controller/item_sale.go b/logic/controller/item_sale.go index c771eba09..4e31b149f 100644 --- a/logic/controller/item_sale.go +++ b/logic/controller/item_sale.go @@ -4,7 +4,6 @@ import ( "blazing/common/data/xmlres" "blazing/common/socket/errorcode" "blazing/logic/service/fight" - "blazing/logic/service/item" "blazing/logic/service/player" "github.com/gogf/gf/v2/util/gconv" @@ -14,7 +13,7 @@ import ( // data: 包含道具ID和数量的输入信息 // c: 当前玩家对象 // 返回: 空结果和错误码 -func (h Controller) ItemSale(data *item.C2S_ITEM_SALE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ItemSale(data *C2S_ITEM_SALE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if c.Service.Item.CheakItem(data.ItemId) < int64(data.Amount) { return nil, errorcode.ErrorCodes.ErrSystemError } diff --git a/logic/controller/item_use.go b/logic/controller/item_use.go index ddd443d4f..3d403fb53 100644 --- a/logic/controller/item_use.go +++ b/logic/controller/item_use.go @@ -21,7 +21,7 @@ const ( // data: 包含分页参数的输入信息 // c: 当前玩家对象 // 返回: 道具列表和错误码 -func (h Controller) GetUserItemList(data *item.ItemListInboundInfo, c *player.Player) (result *item.ItemListOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetUserItemList(data *ItemListInboundInfo, c *player.Player) (result *item.ItemListOutboundInfo, err errorcode.ErrorCode) { result = &item.ItemListOutboundInfo{ ItemList: c.Service.Item.GetUserItemList(data.Param1, data.Param2, ItemDefaultLeftTime), } @@ -32,7 +32,7 @@ func (h Controller) GetUserItemList(data *item.ItemListInboundInfo, c *player.Pl // data: 包含道具ID和宠物捕获时间的输入信息 // c: 当前玩家对象 // 返回: 使用后的宠物信息和错误码 -func (h Controller) UsePetItemOutOfFight(data *item.C2S_USE_PET_ITEM_OUT_OF_FIGHT, c *player.Player) (result *item.S2C_USE_PET_ITEM_OUT_OF_FIGHT, err errorcode.ErrorCode) { +func (h Controller) UsePetItemOutOfFight(data *C2S_USE_PET_ITEM_OUT_OF_FIGHT, c *player.Player) (result *item.S2C_USE_PET_ITEM_OUT_OF_FIGHT, err errorcode.ErrorCode) { _, currentPet, found := c.FindPet(data.CatchTime) if !found { return nil, errorcode.ErrorCodes.Err10401 @@ -180,7 +180,7 @@ func (h Controller) handleRegularPetItem(itemID uint32, currentPet *model.PetInf // data: 包含道具ID和宠物捕获时间的输入信息 // c: 当前玩家对象 // 返回: 无数据和错误码 -func (h Controller) ResetNature(data *item.C2S_PET_RESET_NATURE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ResetNature(data *C2S_PET_RESET_NATURE, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { _, currentPet, found := c.FindPet(data.CatchTime) if !found { return nil, errorcode.ErrorCodes.Err10401 @@ -206,7 +206,7 @@ func (h Controller) ResetNature(data *item.C2S_PET_RESET_NATURE, c *player.Playe // c: 当前玩家对象 // 返回: 无数据(响应包单独组装)和错误码 // 说明:根据物品ID区分双倍/三倍经验加速器,使用后扣减道具并更新玩家剩余次数 -func (h Controller) UseSpeedupItem(data *item.C2S_USE_SPEEDUP_ITEM, c *player.Player) (result *item.S2C_USE_SPEEDUP_ITEM, err errorcode.ErrorCode) { +func (h Controller) UseSpeedupItem(data *C2S_USE_SPEEDUP_ITEM, c *player.Player) (result *item.S2C_USE_SPEEDUP_ITEM, err errorcode.ErrorCode) { // 1. 校验道具是否存在且数量充足 itemCount := c.Service.Item.CheakItem(data.ItemID) if itemCount <= 0 { @@ -263,7 +263,7 @@ func (h Controller) UseSpeedupItem(data *item.C2S_USE_SPEEDUP_ITEM, c *player.Pl // c: 当前玩家对象 // 返回: 无数据(响应包单独组装)和错误码 // 说明:使用后扣减道具并更新玩家能量吸收器剩余次数 -func (h Controller) UseEnergyXishou(data *item.C2S_USE_ENERGY_XISHOU, c *player.Player) (result *item.S2C_USE_ENERGY_XISHOU, err errorcode.ErrorCode) { +func (h Controller) UseEnergyXishou(data *C2S_USE_ENERGY_XISHOU, c *player.Player) (result *item.S2C_USE_ENERGY_XISHOU, err errorcode.ErrorCode) { // 1. 校验道具是否存在且数量充足 itemCount := c.Service.Item.CheakItem(data.ItemID) if itemCount <= 0 { @@ -298,7 +298,7 @@ func (h Controller) UseEnergyXishou(data *item.C2S_USE_ENERGY_XISHOU, c *player. // c: 当前玩家对象 // 返回: 无数据(响应包单独组装)和错误码 // 说明:使用后扣减道具,开启自动战斗(flag设为3)并更新剩余次数 -func (h Controller) UseAutoFightItem(data *item.C2S_USE_AUTO_FIGHT_ITEM, c *player.Player) (result *item.S2C_USE_AUTO_FIGHT_ITEM, err errorcode.ErrorCode) { +func (h Controller) UseAutoFightItem(data *C2S_USE_AUTO_FIGHT_ITEM, c *player.Player) (result *item.S2C_USE_AUTO_FIGHT_ITEM, err errorcode.ErrorCode) { // 1. 校验道具是否存在且数量充足 itemCount := c.Service.Item.CheakItem(data.ItemID) diff --git a/logic/controller/login_main.go b/logic/controller/login_main.go index 9480c8396..246cdf40a 100644 --- a/logic/controller/login_main.go +++ b/logic/controller/login_main.go @@ -18,7 +18,7 @@ import ( ) // Login 处理命令: 1001 -func (h Controller) Login(data *user.MAIN_LOGIN_IN, c gnet.Conn) (result *user.LoginMSInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h Controller) Login(data *MAIN_LOGIN_IN, c gnet.Conn) (result *user.LoginMSInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 if data.Head.UserID == 0 { defer c.Close() diff --git a/logic/controller/map.go b/logic/controller/map.go index f1842a24b..c145ad815 100644 --- a/logic/controller/map.go +++ b/logic/controller/map.go @@ -16,7 +16,7 @@ import ( ) // EnterMap 处理玩家进入地图。 -func (h Controller) EnterMap(data *space.InInfo, c *player.Player) (result *info.SimpleInfo, err errorcode.ErrorCode) { +func (h Controller) EnterMap(data *EnterMapInboundInfo, c *player.Player) (result *info.SimpleInfo, err errorcode.ErrorCode) { if c.Info.MapID != data.MapId { atomic.StoreUint32(&c.Canmon, 2) c.MapNPC.Reset(6 * time.Second) @@ -39,7 +39,7 @@ func (h Controller) EnterMap(data *space.InInfo, c *player.Player) (result *info return nil, -1 } -func (h Controller) GetMapHot(data *maphot.InInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) { +func (h Controller) GetMapHot(data *GetMapHotInboundInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) { result = &maphot.OutInfo{ HotInfos: space.GetMapHot(), } @@ -47,7 +47,7 @@ func (h Controller) GetMapHot(data *maphot.InInfo, c *player.Player) (result *ma } // LeaveMap 处理玩家离开地图。 -func (h Controller) LeaveMap(data *space.LeaveMapInboundInfo, c *player.Player) (result *info.LeaveMapOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) LeaveMap(data *LeaveMapInboundInfo, c *player.Player) (result *info.LeaveMapOutboundInfo, err errorcode.ErrorCode) { atomic.StoreUint32(&c.Canmon, 0) c.GetSpace().LeaveMap(c) // 从当前空间移除玩家。 @@ -57,7 +57,7 @@ func (h Controller) LeaveMap(data *space.LeaveMapInboundInfo, c *player.Player) } // GetMapPlayerList 获取当前地图内的玩家列表与地图广播信息。 -func (h Controller) GetMapPlayerList(data *space.ListMapPlayerInboundInfo, c *player.Player) (result *info.ListMapPlayerOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetMapPlayerList(data *ListMapPlayerInboundInfo, c *player.Player) (result *info.ListMapPlayerOutboundInfo, err errorcode.ErrorCode) { result = &info.ListMapPlayerOutboundInfo{ Player: c.GetSpace().GetInfo(c), } @@ -71,7 +71,7 @@ func (h Controller) GetMapPlayerList(data *space.ListMapPlayerInboundInfo, c *pl } // AttackBoss 调试扣减当前地图广播BOSS血量。 -func (h Controller) AttackBoss(data *space.AttackBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) AttackBoss(data *AttackBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { for i := 0; i < len(c.GetSpace().MapBossSInfo.INFO); i++ { if atomic.LoadInt32(&c.GetSpace().MapBossSInfo.INFO[i].Hp) > 0 { atomic.AddInt32(&c.GetSpace().MapBossSInfo.INFO[i].Hp, -1) diff --git a/logic/controller/nono.go b/logic/controller/nono.go index a6cc1bf6a..5db4383cc 100644 --- a/logic/controller/nono.go +++ b/logic/controller/nono.go @@ -14,7 +14,7 @@ const ( nonoPetCureCost int64 = 50 ) -func (h Controller) NonoFollowOrHome(data *nono.NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h Controller) NonoFollowOrHome(data *NonoFollowOrHomeInInfo, c *player.Player) (result *nono.NonoFollowOutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 c.Info.NONO.Flag = data.Flag result = &nono.NonoFollowOutInfo{ UserID: data.Head.UserID, @@ -29,7 +29,7 @@ func (h Controller) NonoFollowOrHome(data *nono.NonoFollowOrHomeInInfo, c *playe } // GetNonoInfo 获取nono信息 -func (h *Controller) GetNonoInfo(data *nono.NonoInboundInfo, c *player.Player) (result *nono.NonoOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h *Controller) GetNonoInfo(data *NonoInboundInfo, c *player.Player) (result *nono.NonoOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 _ = data result = &nono.NonoOutboundInfo{ @@ -49,7 +49,7 @@ func (h *Controller) GetNonoInfo(data *nono.NonoInboundInfo, c *player.Player) ( return } -func (h *Controller) SwitchFlying(data *nono.SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h *Controller) SwitchFlying(data *SwitchFlyingInboundInfo, c *player.Player) (result *nono.SwitchFlyingOutboundInfo, err errorcode.ErrorCode) { //这个时候player应该是空的 result = &nono.SwitchFlyingOutboundInfo{ UserId: data.Head.UserID, Type: data.Type, @@ -59,7 +59,7 @@ func (h *Controller) SwitchFlying(data *nono.SwitchFlyingInboundInfo, c *player. return } -func (h *Controller) PlayerPetCure(data *nono.PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的 +func (h *Controller) PlayerPetCure(data *PetCureInboundInfo, c *player.Player) (result *nono.PetCureOutboundEmpty, err errorcode.ErrorCode) { //这个时候player应该是空的 _ = data if c.IsArenaHealLocked() { return result, errorcode.ErrorCodes.ErrChampionCannotHeal diff --git a/logic/controller/pet_bag.go b/logic/controller/pet_bag.go index 10c1c97e5..d59efcd0f 100644 --- a/logic/controller/pet_bag.go +++ b/logic/controller/pet_bag.go @@ -9,7 +9,7 @@ import ( // SavePetBagOrder 保存当前主背包和备用背包顺序 func (h Controller) SavePetBagOrder( - data *pet.SavePetBagOrderInboundInfo, + data *SavePetBagOrderInboundInfo, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if !player.SavePetBagOrder(data.PetList, data.BackupPetList) { @@ -21,7 +21,7 @@ func (h Controller) SavePetBagOrder( // PetRetrieveFromWarehouse 领回仓库精灵 func (h Controller) PetRetrieveFromWarehouse( - data *pet.PET_RETRIEVE, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { + data *PET_RETRIEVE, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if _, ok := player.FindPetBagSlot(data.CatchTime); ok { return nil, 0 } @@ -38,7 +38,7 @@ func (h Controller) PetRetrieveFromWarehouse( // TogglePetBagWarehouse 精灵背包仓库切换 func (h Controller) TogglePetBagWarehouse( - data *pet.PetReleaseInboundInfo, + data *PetReleaseInboundInfo, player *player.Player) (result *pet.PetReleaseOutboundInfo, err errorcode.ErrorCode) { result = &pet.PetReleaseOutboundInfo{ Flag: uint32(data.Flag), diff --git a/logic/controller/pet_barge.go b/logic/controller/pet_barge.go index 63161b764..9a7bc9a55 100644 --- a/logic/controller/pet_barge.go +++ b/logic/controller/pet_barge.go @@ -7,7 +7,7 @@ import ( ) // GetPetBargeList 精灵图鉴 -func (h Controller) GetPetBargeList(data *pet.PetBargeListInboundInfo, player *player.Player) (result *pet.PetBargeListOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetPetBargeList(data *PetBargeListInboundInfo, player *player.Player) (result *pet.PetBargeListOutboundInfo, err errorcode.ErrorCode) { ret := &pet.PetBargeListOutboundInfo{ PetBargeList: make([]pet.PetBargeListInfo, 0), diff --git a/logic/controller/pet_fusion.go b/logic/controller/pet_fusion.go index 27f71a883..f4e8a5ca1 100644 --- a/logic/controller/pet_fusion.go +++ b/logic/controller/pet_fusion.go @@ -19,7 +19,7 @@ const ( petFusionSoulID = 1000017 ) -func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) { +func (h Controller) PetFusion(data *C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) { result = &pet.PetFusionInfo{ SoulID: petFusionSoulID, } diff --git a/logic/controller/pet_info.go b/logic/controller/pet_info.go index 423273b31..20892ec88 100644 --- a/logic/controller/pet_info.go +++ b/logic/controller/pet_info.go @@ -10,7 +10,7 @@ import ( // GetPetInfo 获取精灵信息 func (h Controller) GetPetInfo( - data *pet.InInfo, + data *GetPetInfoInboundInfo, player *player.Player) (result *model.PetInfo, err errorcode.ErrorCode) { _, petInfo, found := player.FindPet(data.CatchTime) @@ -30,7 +30,7 @@ func (h Controller) GetPetInfo( // GetUserBagPetInfo 获取主背包和并列备用精灵列表 func (h Controller) GetUserBagPetInfo( - data *pet.GetUserBagPetInfoInboundEmpty, + data *GetUserBagPetInfoInboundEmpty, player *player.Player) (result *pet.GetUserBagPetInfoOutboundInfo, err errorcode.ErrorCode) { return player.GetUserBagPetInfo(), 0 @@ -63,7 +63,7 @@ func (h Controller) GetPetReleaseList( // PlayerShowPet 精灵展示 func (h Controller) PlayerShowPet( - data *pet.PetShowInboundInfo, + data *PetShowInboundInfo, player *player.Player) (result *pet.PetShowOutboundInfo, err errorcode.ErrorCode) { result = &pet.PetShowOutboundInfo{ UserID: data.Head.UserID, diff --git a/logic/controller/pet_manage.go b/logic/controller/pet_manage.go index d2b808555..38d391ed0 100644 --- a/logic/controller/pet_manage.go +++ b/logic/controller/pet_manage.go @@ -10,7 +10,7 @@ import ( // PetReleaseToWarehouse 将精灵从仓库包中放生 func (h Controller) PetReleaseToWarehouse( - data *pet.PET_ROWEI, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { + data *PET_ROWEI, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { _, _, inBag := player.FindPet(data.CatchTime) _, _, inBackup := player.FindBackupPet(data.CatchTime) freeForbidden := xmlres.PetMAP[int(data.ID)].FreeForbidden @@ -27,7 +27,7 @@ func (h Controller) PetReleaseToWarehouse( // PetOneCure 单体治疗 func (h Controller) PetOneCure( - data *pet.PetOneCureInboundInfo, player *player.Player) (result *pet.PetOneCureOutboundInfo, err errorcode.ErrorCode) { + data *PetOneCureInboundInfo, player *player.Player) (result *pet.PetOneCureOutboundInfo, err errorcode.ErrorCode) { if player.IsArenaHealLocked() { return result, errorcode.ErrorCodes.ErrChampionCannotHeal } @@ -44,7 +44,7 @@ func (h Controller) PetOneCure( // PetFirst 精灵首发 func (h Controller) PetFirst( - data *pet.PetDefaultInboundInfo, player *player.Player) (result *pet.PetDefaultOutboundInfo, err errorcode.ErrorCode) { + data *PetDefaultInboundInfo, player *player.Player) (result *pet.PetDefaultOutboundInfo, err errorcode.ErrorCode) { if player.IsArenaSwitchLocked() { return result, errorcode.ErrorCodes.ErrChampionCannotSwitch } @@ -61,7 +61,7 @@ func (h Controller) PetFirst( // SetPetExp 设置宠物经验 func (h Controller) SetPetExp( - data *pet.PetSetExpInboundInfo, + data *PetSetExpInboundInfo, player *player.Player) (result *pet.PetSetExpOutboundInfo, err errorcode.ErrorCode) { _, currentPet, found := player.FindPet(data.CatchTime) if !found || currentPet.Level >= 100 { diff --git a/logic/controller/pet_skill.go b/logic/controller/pet_skill.go index 945908791..17d77526a 100644 --- a/logic/controller/pet_skill.go +++ b/logic/controller/pet_skill.go @@ -13,7 +13,7 @@ import ( ) // SetPetSkill 设置宠物技能,消耗50赛尔豆 -func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) { +func (h Controller) SetPetSkill(data *ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) { const setSkillCost = 50 if !c.GetCoins(setSkillCost) { @@ -57,7 +57,7 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re } // SortPetSkills 排序宠物技能,消耗50赛尔豆 -func (h Controller) SortPetSkills(data *pet.C2S_Skill_Sort, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) SortPetSkills(data *C2S_Skill_Sort, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { const skillSortCost = 50 if !c.GetCoins(skillSortCost) { diff --git a/logic/controller/room_buy.go b/logic/controller/room_buy.go index a02510221..e79a54f09 100644 --- a/logic/controller/room_buy.go +++ b/logic/controller/room_buy.go @@ -7,7 +7,7 @@ import ( ) // BuyFitment 购买基地家具 -func (h Controller) BuyFitment(data *room.C2S_BUY_FITMENT, c *player.Player) (result *room.S2C_BUY_FITMENT, err errorcode.ErrorCode) { +func (h Controller) BuyFitment(data *C2S_BUY_FITMENT, c *player.Player) (result *room.S2C_BUY_FITMENT, err errorcode.ErrorCode) { result = &room.S2C_BUY_FITMENT{Coins: c.Info.Coins} bought, err := buySeerdouBackpackItem(c, int64(data.ID), int64(data.Count)) diff --git a/logic/controller/room_info.go b/logic/controller/room_info.go index bd5ab0003..7d29b378a 100644 --- a/logic/controller/room_info.go +++ b/logic/controller/room_info.go @@ -15,7 +15,7 @@ import ( // data: 包含目标用户ID的输入信息 // c: 当前玩家对象 // 返回: 基地家具信息和错误码 -func (h Controller) GetFitmentUsing(data *room.FitmentUseringInboundInfo, c *player.Player) (result *room.FitmentUseringOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetFitmentUsing(data *FitmentUseringInboundInfo, c *player.Player) (result *room.FitmentUseringOutboundInfo, err errorcode.ErrorCode) { result = &room.FitmentUseringOutboundInfo{UserId: c.Info.UserID, RoomId: data.TargetUserID} result.Fitments = make([]model.FitmentShowInfo, 0) result.Fitments = append(result.Fitments, model.FitmentShowInfo{Id: 500001, Status: 1, X: 1, Y: 1, Dir: 1}) @@ -29,7 +29,7 @@ func (h Controller) GetFitmentUsing(data *room.FitmentUseringInboundInfo, c *pla // data: 包含目标用户ID的输入信息 // c: 当前玩家对象 // 返回: 精灵展示列表和错误码 -func (h Controller) GetRoomPetShowInfo(data *room.PetRoomListInboundInfo, c *player.Player) (result *room.PetRoomListOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetRoomPetShowInfo(data *PetRoomListInboundInfo, c *player.Player) (result *room.PetRoomListOutboundInfo, err errorcode.ErrorCode) { result = &room.PetRoomListOutboundInfo{} result.Pets = make([]pet.PetShortInfo, 0) roomInfo := c.Service.Room.Get(data.TargetUserID) @@ -51,7 +51,7 @@ func (h Controller) GetRoomPetShowInfo(data *room.PetRoomListInboundInfo, c *pla // data: 空输入结构 // c: 当前玩家对象 // 返回: 玩家所有家具列表和错误码 -func (h Controller) GetAllFurniture(data *room.FitmentAllInboundEmpty, c *player.Player) (result *room.FitmentAllOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetAllFurniture(data *FitmentAllInboundEmpty, c *player.Player) (result *room.FitmentAllOutboundInfo, err errorcode.ErrorCode) { result = &room.FitmentAllOutboundInfo{} result.Fitments = make([]room.FitmentItemInfo, 0) @@ -75,7 +75,7 @@ func (h Controller) GetAllFurniture(data *room.FitmentAllInboundEmpty, c *player // data: 包含用户ID和精灵捕获时间的输入信息 // c: 当前玩家对象 // 返回: 精灵详细信息和错误码 -func (h Controller) GetRoomPetInfo(data *room.C2S_RoomPetInfo, c *player.Player) (result *pet.RoomPetInfo, err errorcode.ErrorCode) { +func (h Controller) GetRoomPetInfo(data *C2S_RoomPetInfo, c *player.Player) (result *pet.RoomPetInfo, err errorcode.ErrorCode) { petInfo := c.Service.Pet.PetInfoOneOther(data.UserID, data.CatchTime) result = &pet.RoomPetInfo{} copier.CopyWithOption(result, &petInfo.Data, copier.Option{DeepCopy: true}) diff --git a/logic/controller/room_set.go b/logic/controller/room_set.go index fad2b79b4..7bc126c9d 100644 --- a/logic/controller/room_set.go +++ b/logic/controller/room_set.go @@ -13,7 +13,7 @@ import ( // data: 包含家具列表的输入信息 // c: 当前玩家对象 // 返回: 空结果和错误码 -func (h Controller) SetFitment(data *room.SET_FITMENT, c *player.Player) (result *room.NullInfo, err errorcode.ErrorCode) { +func (h Controller) SetFitment(data *SET_FITMENT, c *player.Player) (result *room.NullInfo, err errorcode.ErrorCode) { c.Service.Room.Set(data.Fitments) return @@ -23,7 +23,7 @@ func (h Controller) SetFitment(data *room.SET_FITMENT, c *player.Player) (result // data: 包含精灵展示列表的输入信息 // c: 当前玩家对象 // 返回: 精灵展示列表和错误码 -func (h Controller) SetPet(data *room.C2S_PET_ROOM_SHOW, c *player.Player) (result *room.S2C_PET_ROOM_SHOW, err errorcode.ErrorCode) { +func (h Controller) SetPet(data *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 { diff --git a/logic/controller/user_action.go b/logic/controller/user_action.go index 1714b53ba..019cee9af 100644 --- a/logic/controller/user_action.go +++ b/logic/controller/user_action.go @@ -16,7 +16,7 @@ import ( // data: 包含射击信息的输入数据 // player: 当前玩家对象 // 返回: 射击结果和错误码 -func (h Controller) PlayerAim(data *user.AimatInboundInfo, player *player.Player) (result *user.AimatOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) PlayerAim(data *AimatInboundInfo, player *player.Player) (result *user.AimatOutboundInfo, err errorcode.ErrorCode) { result = &user.AimatOutboundInfo{ ItemId: data.ItemId, @@ -33,7 +33,7 @@ func (h Controller) PlayerAim(data *user.AimatInboundInfo, player *player.Player // data: 包含聊天消息的输入数据 // player: 当前玩家对象 // 返回: 聊天结果和错误码 -func (h Controller) PlayerChat(data *user.ChatInboundInfo, player *player.Player) (result *user.ChatOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) PlayerChat(data *ChatInboundInfo, player *player.Player) (result *user.ChatOutboundInfo, err errorcode.ErrorCode) { result = &user.ChatOutboundInfo{ @@ -50,7 +50,7 @@ func (h Controller) PlayerChat(data *user.ChatInboundInfo, player *player.Player // data: 包含颜色信息的输入数据 // player: 当前玩家对象 // 返回: 颜色更改结果和错误码 -func (h Controller) ChangePlayerColor(data *user.ChangeColorInboundInfo, player *player.Player) (result *user.ChangeColorOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangePlayerColor(data *ChangeColorInboundInfo, player *player.Player) (result *user.ChangeColorOutboundInfo, err errorcode.ErrorCode) { const changeColorCost = 50 if !player.GetCoins(changeColorCost) { @@ -76,7 +76,7 @@ func (h Controller) ChangePlayerColor(data *user.ChangeColorInboundInfo, player // data: 包含涂鸦信息的输入数据 // player: 当前玩家对象 // 返回: 涂鸦更改结果和错误码 -func (h Controller) ChangePlayerDoodle(data *user.ChangeDoodleInboundInfo, player *player.Player) (result *user.ChangeDoodleOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangePlayerDoodle(data *ChangeDoodleInboundInfo, player *player.Player) (result *user.ChangeDoodleOutboundInfo, err errorcode.ErrorCode) { const changeDoodleCost = 50 if !player.GetCoins(changeDoodleCost) { @@ -106,7 +106,7 @@ func (h Controller) ChangePlayerDoodle(data *user.ChangeDoodleInboundInfo, playe // data: 包含NONO颜色信息的输入数据 // player: 当前玩家对象 // 返回: NONO颜色更改结果和错误码 -func (h Controller) ChangeNONOColor(data *user.ChangeNONOColorInboundInfo, player *player.Player) (result *user.ChangeNONOColorOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangeNONOColor(data *ChangeNONOColorInboundInfo, player *player.Player) (result *user.ChangeNONOColorOutboundInfo, err errorcode.ErrorCode) { //player.Info.Coins -= 200 player.Info.NONO.NonoColor = data.Color @@ -122,7 +122,7 @@ func (h Controller) ChangeNONOColor(data *user.ChangeNONOColorInboundInfo, playe // data: 包含跳舞类型信息的输入数据 // player: 当前玩家对象 // 返回: 跳舞动作结果和错误码 -func (h Controller) DanceAction(data *user.C2SDanceAction, player *player.Player) (result *user.S2CDanceAction, err errorcode.ErrorCode) { +func (h Controller) DanceAction(data *C2SDanceAction, player *player.Player) (result *user.S2CDanceAction, err errorcode.ErrorCode) { result = &user.S2CDanceAction{ Type: data.Type, @@ -136,7 +136,7 @@ func (h Controller) DanceAction(data *user.C2SDanceAction, player *player.Player // data: 包含变形信息的输入数据 // player: 当前玩家对象 // 返回: 变形结果和错误码 -func (h Controller) PeopleTransform(data *user.C2SPEOPLE_TRANSFROM, player *player.Player) (result *user.S2CPEOPLE_TRANSFROM, err errorcode.ErrorCode) { +func (h Controller) PeopleTransform(data *C2SPEOPLE_TRANSFROM, player *player.Player) (result *user.S2CPEOPLE_TRANSFROM, err errorcode.ErrorCode) { result = &user.S2CPEOPLE_TRANSFROM{ SuitID: data.SuitID, @@ -150,7 +150,7 @@ func (h Controller) PeopleTransform(data *user.C2SPEOPLE_TRANSFROM, player *play // data: 包含服装信息的输入数据 // player: 当前玩家对象 // 返回: 服装更改结果和错误码 -func (h Controller) ChangePlayerCloth(data *item.ChangePlayerClothInboundInfo, player *player.Player) (result *item.ChangePlayerClothOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangePlayerCloth(data *ChangePlayerClothInboundInfo, player *player.Player) (result *item.ChangePlayerClothOutboundInfo, err errorcode.ErrorCode) { result = &item.ChangePlayerClothOutboundInfo{ UserID: player.Info.UserID, @@ -171,7 +171,7 @@ func (h Controller) ChangePlayerCloth(data *item.ChangePlayerClothInboundInfo, p return } -func (h Controller) ChangePlayerName(data *user.ChangePlayerNameInboundInfo, c *player.Player) (result *user.ChangePlayerNameOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangePlayerName(data *ChangePlayerNameInboundInfo, c *player.Player) (result *user.ChangePlayerNameOutboundInfo, err errorcode.ErrorCode) { newNickname := cool.Filter.Replace(strings.Trim(data.Nickname, "\x00"), '*') c.Info.Nick = newNickname @@ -183,7 +183,7 @@ func (h Controller) ChangePlayerName(data *user.ChangePlayerNameInboundInfo, c * return result, 0 } -func (h Controller) ChangeTile(data *user.ChangeTitleInboundInfo, c *player.Player) (result *user.ChangeTitleOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) ChangeTile(data *ChangeTitleInboundInfo, c *player.Player) (result *user.ChangeTitleOutboundInfo, err errorcode.ErrorCode) { result = &user.ChangeTitleOutboundInfo{ UserID: c.Info.UserID, diff --git a/logic/controller/user_cdk.go b/logic/controller/user_cdk.go index 15cc8606a..738b135ba 100644 --- a/logic/controller/user_cdk.go +++ b/logic/controller/user_cdk.go @@ -9,7 +9,7 @@ import ( "time" ) -func (h Controller) CDK(data *user.C2S_GET_GIFT_COMPLETE, player *player.Player) (result *user.S2C_GET_GIFT_COMPLETE, err errorcode.ErrorCode) { +func (h Controller) CDK(data *C2S_GET_GIFT_COMPLETE, player *player.Player) (result *user.S2C_GET_GIFT_COMPLETE, err errorcode.ErrorCode) { result = &user.S2C_GET_GIFT_COMPLETE{} cdkService := service.NewCdkService() diff --git a/logic/controller/user_friend.go b/logic/controller/user_friend.go index f781bc75e..265d94e70 100644 --- a/logic/controller/user_friend.go +++ b/logic/controller/user_friend.go @@ -11,7 +11,7 @@ import ( // data: 包含用户ID列表的输入信息 // c: 当前玩家对象 // 返回: 好友在线信息和错误码 -func (h Controller) GetOnlineFriends(data *friend.SeeOnlineInboundInfo, c *player.Player) (result *friend.SeeOnlineOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetOnlineFriends(data *SeeOnlineInboundInfo, c *player.Player) (result *friend.SeeOnlineOutboundInfo, err errorcode.ErrorCode) { result = &friend.SeeOnlineOutboundInfo{} result.Friends = make([]friend.OnlineInfo, 0) return @@ -21,7 +21,7 @@ func (h Controller) GetOnlineFriends(data *friend.SeeOnlineInboundInfo, c *playe // data: 包含要添加好友的用户ID // c: 当前玩家对象 // 返回: 无数据内容的响应和错误码 -func (h Controller) FriendAdd(data *friend.FriendAddInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) FriendAdd(data *FriendAddInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { v, ok := c.GetSpace().User.Load(data.UserID) @@ -40,7 +40,7 @@ func (h Controller) FriendAdd(data *friend.FriendAddInboundInfo, c *player.Playe // data: 包含发起好友请求的用户ID和回复标志(1为同意,0为拒绝) // c: 当前玩家对象 // 返回: 无数据内容的响应和错误码 -func (h Controller) FriendAnswer(data *friend.FriendAnswerInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) FriendAnswer(data *FriendAnswerInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { v, ok := c.GetSpace().User.Load(data.UserID) if ok { @@ -62,7 +62,7 @@ func (h Controller) FriendAnswer(data *friend.FriendAnswerInboundInfo, c *player // data: 包含要删除的好友ID // c: 当前玩家对象 // 返回: 无数据内容的响应和错误码 -func (h Controller) FriendRemove(data *friend.FriendRemoveInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) FriendRemove(data *FriendRemoveInboundInfo, c *player.Player) (result fight.NullOutboundInfo, err errorcode.ErrorCode) { c.Service.Friend.Del(data.UserID) return } diff --git a/logic/controller/user_info.go b/logic/controller/user_info.go index 2f700a328..1c34b1c2c 100644 --- a/logic/controller/user_info.go +++ b/logic/controller/user_info.go @@ -13,7 +13,7 @@ import ( // data: 包含用户ID的输入信息 // player: 玩家对象 // 返回: 模拟用户信息及错误码 -func (h Controller) GetUserSimInfo(data *user.SimUserInfoInboundInfo, player *player.Player) (result *user.SimUserInfoOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetUserSimInfo(data *SimUserInfoInboundInfo, player *player.Player) (result *user.SimUserInfoOutboundInfo, err errorcode.ErrorCode) { result = &user.SimUserInfoOutboundInfo{} t, ok := player.GetSpace().UserInfo.Load(data.UserId) if ok { @@ -33,7 +33,7 @@ func (h Controller) GetUserSimInfo(data *user.SimUserInfoInboundInfo, player *pl // data: 包含用户ID的输入信息 // player: 当前玩家对象 // 返回: 包含用户更多信息的输出结果和错误码 -func (h Controller) GetUserMoreInfo(data *user.MoreUserInfoInboundInfo, player *player.Player) (result *user.MoreUserInfoOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetUserMoreInfo(data *MoreUserInfoInboundInfo, player *player.Player) (result *user.MoreUserInfoOutboundInfo, err errorcode.ErrorCode) { result = &user.MoreUserInfoOutboundInfo{} info := player.Service.Info.Person(data.UserId) if info == nil { @@ -49,7 +49,7 @@ func (h Controller) GetUserMoreInfo(data *user.MoreUserInfoInboundInfo, player * // data: 输入信息(无实际内容) // player: 当前玩家对象 // 返回: 玩家金币和代币数量及错误码 -func (h Controller) GetPlayerGoldCount(data *item.GoldOnlineRemainInboundInfo, player *player.Player) (result *item.GoldOnlineRemainOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetPlayerGoldCount(data *GoldOnlineRemainInboundInfo, player *player.Player) (result *item.GoldOnlineRemainOutboundInfo, err errorcode.ErrorCode) { return &item.GoldOnlineRemainOutboundInfo{ @@ -62,7 +62,7 @@ func (h Controller) GetPlayerGoldCount(data *item.GoldOnlineRemainInboundInfo, p // data: 输入信息(无实际内容) // player: 当前玩家对象 // 返回: 玩家总经验值及错误码 -func (h Controller) GetPlayerExp(data *item.ExpTotalRemainInboundInfo, player *player.Player) (result *item.ExpTotalRemainOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetPlayerExp(data *ExpTotalRemainInboundInfo, player *player.Player) (result *item.ExpTotalRemainOutboundInfo, err errorcode.ErrorCode) { return &item.ExpTotalRemainOutboundInfo{ diff --git a/logic/controller/user_talk.go b/logic/controller/user_talk.go index b01e8dd1a..5b5a87e19 100644 --- a/logic/controller/user_talk.go +++ b/logic/controller/user_talk.go @@ -7,7 +7,7 @@ import ( "blazing/modules/config/service" ) -func (h Controller) GetTalkCount(data *item.TalkCountInboundInfo, c *player.Player) (result *item.TalkCountOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetTalkCount(data *TalkCountInboundInfo, c *player.Player) (result *item.TalkCountOutboundInfo, err errorcode.ErrorCode) { result = &item.TalkCountOutboundInfo{} talkCount, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID)) if !ok { @@ -20,7 +20,7 @@ func (h Controller) GetTalkCount(data *item.TalkCountInboundInfo, c *player.Play //var talkcacche = make(map[string]uint32) -func (h Controller) GetTalkCategory(data *item.TalkCateInboundInfo, c *player.Player) (result *item.DayTalkInfo, err errorcode.ErrorCode) { +func (h Controller) GetTalkCategory(data *TalkCateInboundInfo, c *player.Player) (result *item.DayTalkInfo, err errorcode.ErrorCode) { result = &item.DayTalkInfo{} result.OutList = make([]item.CateInfo, 0) diff --git a/logic/controller/user_task.go b/logic/controller/user_task.go index 1bdc5c559..061a4a317 100644 --- a/logic/controller/user_task.go +++ b/logic/controller/user_task.go @@ -11,7 +11,7 @@ import ( ) // AcceptTask 接受任务 -func (h Controller) AcceptTask(data *task.AcceptTaskInboundInfo, c *player.Player) (result *task.AcceptTaskOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) AcceptTask(data *AcceptTaskInboundInfo, c *player.Player) (result *task.AcceptTaskOutboundInfo, err errorcode.ErrorCode) { //isdaliy := false // if data.Head.CMD != 2201 { //判断是每日任务 // //isdaliy = true @@ -43,7 +43,7 @@ func (h Controller) AcceptTask(data *task.AcceptTaskInboundInfo, c *player.Playe // data: 包含任务ID和任务步骤列表的输入信息 // c: 当前玩家对象 // 返回: 空输出结果和错误码 -func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Player) (result *task.AddTaskBufOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) AddTaskBuf(data *AddTaskBufInboundInfo, c *player.Player) (result *task.AddTaskBufOutboundInfo, err errorcode.ErrorCode) { if c.Info.GetTask(int(data.TaskId)) != model.Accepted { return result, errorcode.ErrorCodes.ErrAwardAlreadyClaimed @@ -59,7 +59,7 @@ func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Playe // data: 包含任务ID的输入信息 // c: 当前玩家对象 // 返回: 任务完成结果和错误码 -func (h Controller) CompleteTask(data1 *task.CompleteTaskInboundInfo, c *player.Player) (result *task.CompleteTaskOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) CompleteTask(data1 *CompleteTaskInboundInfo, c *player.Player) (result *task.CompleteTaskOutboundInfo, err errorcode.ErrorCode) { if c.Info.GetTask(int(data1.TaskId)) != model.Accepted { return result, errorcode.ErrorCodes.ErrAwardAlreadyClaimed } @@ -101,7 +101,7 @@ func (h Controller) CompleteTask(data1 *task.CompleteTaskInboundInfo, c *player. } // GetTaskBuf 获取任务状态 -func (h Controller) GetTaskBuf(data *task.GetTaskBufInboundInfo, c *player.Player) (result *task.GetTaskBufOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) GetTaskBuf(data *GetTaskBufInboundInfo, c *player.Player) (result *task.GetTaskBufOutboundInfo, err errorcode.ErrorCode) { result = &task.GetTaskBufOutboundInfo{ TaskId: data.TaskId, } @@ -115,7 +115,7 @@ func (h Controller) GetTaskBuf(data *task.GetTaskBufInboundInfo, c *player.Playe } // DeleteTask 删除任务 -func (h Controller) DeleteTask(data *task.DeleteTaskInboundInfo, c *player.Player) (result *task.DeleteTaskOutboundInfo, err errorcode.ErrorCode) { +func (h Controller) DeleteTask(data *DeleteTaskInboundInfo, c *player.Player) (result *task.DeleteTaskOutboundInfo, err errorcode.ErrorCode) { if c.Info.GetTask(int(data.TaskId)) != model.Accepted { return nil, errorcode.ErrorCodes.ErrSystemError diff --git a/logic/controller/walk.go b/logic/controller/walk.go index c02e2e940..baebcf6c4 100644 --- a/logic/controller/walk.go +++ b/logic/controller/walk.go @@ -3,11 +3,10 @@ package controller import ( "blazing/common/socket/errorcode" "blazing/logic/service/player" - "blazing/logic/service/space" "blazing/logic/service/space/info" ) -func (h Controller) PlayerWalk(data *space.WalkInInfo, c *player.Player) (result *info.WalkOutInfo, err errorcode.ErrorCode) { +func (h Controller) PlayerWalk(data *WalkInInfo, c *player.Player) (result *info.WalkOutInfo, err errorcode.ErrorCode) { result = &info.WalkOutInfo{ Flag: data.Flag, Point: data.Point,