diff options
Diffstat (limited to 'src/net/eathena')
85 files changed, 176 insertions, 2850 deletions
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 5b19f912b..b9d6a81bc 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -40,42 +40,11 @@ namespace EAthena std::string AdminHandler::mStatsName; AdminHandler::AdminHandler() : - MessageHandler(), Ea::AdminHandler() { - static const uint16_t _messages[] = - { - SMSG_ADMIN_KICK_ACK, - SMSG_ADMIN_GET_LOGIN_ACK, - SMSG_ADMIN_SET_TILE_TYPE, - SMSG_ADMIN_ACCOUNT_STATS, - 0 - }; - handledMessages = _messages; adminHandler = this; } -void AdminHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_ADMIN_KICK_ACK: - Ea::AdminRecv::processKickAck(msg); - break; - case SMSG_ADMIN_GET_LOGIN_ACK: - AdminRecv::processAdminGetLoginAck(msg); - break; - case SMSG_ADMIN_SET_TILE_TYPE: - AdminRecv::processSetTileType(msg); - break; - case SMSG_ADMIN_ACCOUNT_STATS: - AdminRecv::processAccountStats(msg); - break; - default: - break; - } -} - void AdminHandler::announce(const std::string &text) const { createOutPacket(CMSG_ADMIN_ANNOUNCE); diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h index 97571f05b..033a72244 100644 --- a/src/net/eathena/adminhandler.h +++ b/src/net/eathena/adminhandler.h @@ -25,20 +25,16 @@ #include "net/ea/adminhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class AdminHandler final : public MessageHandler, public Ea::AdminHandler +class AdminHandler final : public Ea::AdminHandler { public: AdminHandler(); A_DELETE_COPY(AdminHandler) - void handleMessage(Net::MessageIn &msg) override final; - void announce(const std::string &text) const override final; void localAnnounce(const std::string &text) const override final; diff --git a/src/net/eathena/auctionhandler.cpp b/src/net/eathena/auctionhandler.cpp index e84a29cec..154ccaa35 100644 --- a/src/net/eathena/auctionhandler.cpp +++ b/src/net/eathena/auctionhandler.cpp @@ -35,51 +35,11 @@ extern Net::AuctionHandler *auctionHandler; namespace EAthena { -AuctionHandler::AuctionHandler() : - MessageHandler() +AuctionHandler::AuctionHandler() { - static const uint16_t _messages[] = - { - SMSG_AUCTION_OPEN_WINDOW, - SMSG_AUCTION_RESULTS, - SMSG_AUCTION_SET_ITEM, - SMSG_AUCTION_MESSAGE, - SMSG_AUCTION_CLOSE, - 0 - }; - handledMessages = _messages; auctionHandler = this; } -void AuctionHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_AUCTION_OPEN_WINDOW: - AuctionRecv::processOpenWindow(msg); - break; - - case SMSG_AUCTION_RESULTS: - AuctionRecv::processAuctionResults(msg); - break; - - case SMSG_AUCTION_SET_ITEM: - AuctionRecv::processAuctionSetItem(msg); - break; - - case SMSG_AUCTION_MESSAGE: - AuctionRecv::processAuctionMessage(msg); - break; - - case SMSG_AUCTION_CLOSE: - AuctionRecv::processAuctionClose(msg); - break; - - default: - break; - } -} - void AuctionHandler::cancelReg() const { createOutPacket(CMSG_AUCTION_CANCEL_REG); diff --git a/src/net/eathena/auctionhandler.h b/src/net/eathena/auctionhandler.h index df0f57e61..ea1b5b342 100644 --- a/src/net/eathena/auctionhandler.h +++ b/src/net/eathena/auctionhandler.h @@ -25,19 +25,15 @@ #include "net/auctionhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class AuctionHandler final : public MessageHandler, public Net::AuctionHandler +class AuctionHandler final : public Net::AuctionHandler { public: AuctionHandler(); A_DELETE_COPY(AuctionHandler) - void handleMessage(Net::MessageIn &msg) override final; - void cancelReg() const override final; void setItem(const Item *const item, diff --git a/src/net/eathena/bankhandler.cpp b/src/net/eathena/bankhandler.cpp index 48bf2f425..94535474c 100644 --- a/src/net/eathena/bankhandler.cpp +++ b/src/net/eathena/bankhandler.cpp @@ -31,41 +31,11 @@ extern Net::BankHandler *bankHandler; namespace EAthena { -BankHandler::BankHandler() : - MessageHandler() +BankHandler::BankHandler() { - static const uint16_t _messages[] = - { - SMSG_BANK_STATUS, - SMSG_BANK_DEPOSIT, - SMSG_BANK_WITHDRAW, - 0 - }; - handledMessages = _messages; bankHandler = this; } -void BankHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_BANK_STATUS: - BankRecv::processBankStatus(msg); - break; - - case SMSG_BANK_DEPOSIT: - BankRecv::processBankDeposit(msg); - break; - - case SMSG_BANK_WITHDRAW: - BankRecv::processBankWithdraw(msg); - break; - - default: - break; - } -} - void BankHandler::deposit(const int money) const { createOutPacket(CMSG_BANK_DEPOSIT); diff --git a/src/net/eathena/bankhandler.h b/src/net/eathena/bankhandler.h index 49cb2cc00..6a6ee5efd 100644 --- a/src/net/eathena/bankhandler.h +++ b/src/net/eathena/bankhandler.h @@ -25,20 +25,15 @@ #include "net/bankhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class BankHandler final : public MessageHandler, - public Net::BankHandler +class BankHandler final : public Net::BankHandler { public: BankHandler(); A_DELETE_COPY(BankHandler) - void handleMessage(Net::MessageIn &msg) override final; - void deposit(const int money) const override final; void withdraw(const int money) const override final; diff --git a/src/net/eathena/battlegroundhandler.cpp b/src/net/eathena/battlegroundhandler.cpp index 1a8403444..997338659 100644 --- a/src/net/eathena/battlegroundhandler.cpp +++ b/src/net/eathena/battlegroundhandler.cpp @@ -31,66 +31,11 @@ extern Net::BattleGroundHandler *battleGroundHandler; namespace EAthena { -BattleGroundHandler::BattleGroundHandler() : - MessageHandler() +BattleGroundHandler::BattleGroundHandler() { - static const uint16_t _messages[] = - { - SMSG_BATTLE_EMBLEM, - SMSG_BATTLE_UPDATE_SCORE, - SMSG_BATTLE_UPDATE_COORDS, - SMSG_BATTLE_PLAY, - SMSG_BATTLE_QUEUE_ACK, - SMSG_BATTLE_BEGINS, - SMSG_BATTLE_NOTICE_DELETE, - SMSG_BATTLE_JOINED, - 0 - }; - handledMessages = _messages; battleGroundHandler = this; } -void BattleGroundHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_BATTLE_EMBLEM: - BattleGroundRecv::processBattleEmblem(msg); - break; - - case SMSG_BATTLE_UPDATE_SCORE: - BattleGroundRecv::processBattleUpdateScore(msg); - break; - - case SMSG_BATTLE_UPDATE_COORDS: - BattleGroundRecv::processBattleUpdateCoords(msg); - break; - - case SMSG_BATTLE_PLAY: - BattleGroundRecv::processBattlePlay(msg); - break; - - case SMSG_BATTLE_QUEUE_ACK: - BattleGroundRecv::processBattleQueueAck(msg); - break; - - case SMSG_BATTLE_BEGINS: - BattleGroundRecv::processBattleBegins(msg); - break; - - case SMSG_BATTLE_NOTICE_DELETE: - BattleGroundRecv::processBattleNoticeDelete(msg); - break; - - case SMSG_BATTLE_JOINED: - BattleGroundRecv::processBattleJoined(msg); - break; - - default: - break; - } -} - void BattleGroundHandler::registerBg(const BattleGroundTypeT &type, const std::string &name) const { diff --git a/src/net/eathena/battlegroundhandler.h b/src/net/eathena/battlegroundhandler.h index cbc6a39fa..f906a6a54 100644 --- a/src/net/eathena/battlegroundhandler.h +++ b/src/net/eathena/battlegroundhandler.h @@ -25,20 +25,15 @@ #include "net/battlegroundhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class BattleGroundHandler final : public MessageHandler, - public Net::BattleGroundHandler +class BattleGroundHandler final : public Net::BattleGroundHandler { public: BattleGroundHandler(); A_DELETE_COPY(BattleGroundHandler) - void handleMessage(Net::MessageIn &msg) override final; - void registerBg(const BattleGroundTypeT &type, const std::string &name) const override final; diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 73f4cc1ec..cad80eac9 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -38,80 +38,8 @@ namespace EAthena { BeingHandler::BeingHandler(const bool enableSync) : - MessageHandler(), Ea::BeingHandler(enableSync) { - static const uint16_t _messages[] = - { - SMSG_BEING_VISIBLE, - SMSG_BEING_MOVE, - SMSG_BEING_MOVE2, - SMSG_BEING_REMOVE, - SMSG_BEING_REMOVE_SKILL, - SMSG_SKILL_DAMAGE, - SMSG_BEING_ACTION, - SMSG_BEING_ACTION2, - SMSG_BEING_SELFEFFECT, - SMSG_BEING_SPECIAL_EFFECT, - SMSG_BEING_SPECIAL_EFFECT_NUM, - SMSG_BEING_SOUND_EFFECT, - SMSG_BEING_EMOTION, - SMSG_BEING_CHANGE_LOOKS2, - SMSG_BEING_CHANGE_LOOKS_CARDS, - SMSG_BEING_NAME_RESPONSE, - SMSG_BEING_NAME_RESPONSE2, - SMSG_PLAYER_GUILD_PARTY_INFO, - SMSG_BEING_CHANGE_DIRECTION, - SMSG_PLAYER_STOP, - SMSG_PLAYER_MOVE_TO_ATTACK, - SMSG_PLAYER_STATUS_CHANGE, - SMSG_PLAYER_STATUS_CHANGE2, - SMSG_PLAYER_STATUS_CHANGE_NO_TICK, - SMSG_BEING_STATUS_CHANGE, - SMSG_BEING_STATUS_CHANGE2, - SMSG_BEING_RESURRECT, - SMSG_SOLVE_CHAR_NAME, - SMSG_BEING_SPAWN, - SMSG_SKILL_CASTING, - SMSG_SKILL_CAST_CANCEL, - SMSG_SKILL_NO_DAMAGE, - SMSG_SKILL_GROUND_NO_DAMAGE, - SMSG_SKILL_ENTRY, - SMSG_PVP_MAP_MODE, - SMSG_PVP_SET, - SMSG_MAP_TYPE_PROPERTY2, - SMSG_MAP_TYPE, - SMSG_MONSTER_HP, - SMSG_PLAYER_HP, - SMSG_SKILL_AUTO_CAST, - SMSG_RANKS_LIST, - SMSG_BEING_FAKE_NAME, - SMSG_BEING_STAT_UPDATE_1, - SMSG_MOB_INFO, - SMSG_BEING_MOVE3, - SMSG_BEING_ATTRS, - SMSG_MONSTER_INFO, - SMSG_CLASS_CHANGE, - SMSG_SPIRIT_BALLS, - SMSG_SPIRIT_BALL_SINGLE, - SMSG_BLADE_STOP, - SMSG_COMBO_DELAY, - SMSG_WEDDING_EFFECT, - SMSG_BEING_SLIDE, - SMSG_STARS_KILL, - SMSG_BLACKSMITH_RANKS_LIST, - SMSG_ALCHEMIST_RANKS_LIST, - SMSG_TAEKWON_RANKS_LIST, - SMSG_PK_RANKS_LIST, - SMSG_GLADIATOR_FEEL_REQUEST, - SMSG_BOSS_MAP_INFO, - SMSG_BEING_FONT, - SMSG_BEING_MILLENIUM_SHIELD, - SMSG_BEING_CHARM, - SMSG_BEING_VIEW_EQUIPMENT, - 0 - }; - handledMessages = _messages; beingHandler = this; } @@ -121,278 +49,6 @@ void BeingHandler::requestNameById(const BeingId id) const outMsg.writeBeingId(id, "being id"); } -void BeingHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_BEING_VISIBLE: - BeingRecv::processBeingVisible(msg); - break; - - case SMSG_BEING_MOVE: - BeingRecv::processBeingMove(msg); - break; - - case SMSG_BEING_SPAWN: - BeingRecv::processBeingSpawn(msg); - break; - - case SMSG_BEING_MOVE2: - BeingRecv::processBeingMove2(msg); - break; - - case SMSG_BEING_REMOVE: - Ea::BeingRecv::processBeingRemove(msg); - break; - - case SMSG_BEING_REMOVE_SKILL: - BeingRecv::processBeingRemoveSkil(msg); - break; - - case SMSG_BEING_RESURRECT: - BeingRecv::processBeingResurrect(msg); - break; - - case SMSG_SKILL_DAMAGE: - Ea::BeingRecv::processSkillDamage(msg); - break; - - case SMSG_SKILL_AUTO_CAST: - BeingRecv::processSkillAutoCast(msg); - break; - - case SMSG_BEING_ACTION: - Ea::BeingRecv::processBeingAction(msg); - break; - - case SMSG_BEING_ACTION2: - BeingRecv::processBeingAction2(msg); - break; - - case SMSG_BEING_SELFEFFECT: - BeingRecv::processBeingSelfEffect(msg); - break; - - case SMSG_BEING_SPECIAL_EFFECT: - BeingRecv::processBeingSpecialEffect(msg); - break; - - case SMSG_BEING_SPECIAL_EFFECT_NUM: - BeingRecv::processBeingSpecialEffectNum(msg); - break; - - case SMSG_BEING_SOUND_EFFECT: - BeingRecv::processBeingSoundEffect(msg); - break; - - case SMSG_BEING_EMOTION: - Ea::BeingRecv::processBeingEmotion(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS2: - BeingRecv::processBeingChangeLook2(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS_CARDS: - BeingRecv::processBeingChangeLookCards(msg); - break; - - case SMSG_BEING_NAME_RESPONSE: - Ea::BeingRecv::processNameResponse(msg); - break; - - case SMSG_BEING_NAME_RESPONSE2: - BeingRecv::processNameResponse2(msg); - break; - - case SMSG_SOLVE_CHAR_NAME: - break; - - case SMSG_PLAYER_GUILD_PARTY_INFO: - BeingRecv::processPlayerGuilPartyInfo(msg); - break; - - case SMSG_BEING_CHANGE_DIRECTION: - BeingRecv::processBeingChangeDirection(msg); - break; - - case SMSG_PLAYER_STOP: - Ea::BeingRecv::processPlayerStop(msg); - break; - - case SMSG_PLAYER_MOVE_TO_ATTACK: - Ea::BeingRecv::processPlayerMoveToAttack(msg); - break; - - case SMSG_PLAYER_STATUS_CHANGE: - BeingRecv::processPlaterStatusChange(msg); - break; - - case SMSG_PLAYER_STATUS_CHANGE2: - BeingRecv::processPlaterStatusChange2(msg); - break; - - case SMSG_PLAYER_STATUS_CHANGE_NO_TICK: - BeingRecv::processPlaterStatusChangeNoTick(msg); - break; - - case SMSG_BEING_STATUS_CHANGE: - BeingRecv::processBeingStatusChange(msg); - break; - - case SMSG_BEING_STATUS_CHANGE2: - BeingRecv::processBeingStatusChange2(msg); - break; - - case SMSG_SKILL_CASTING: - BeingRecv::processSkillCasting(msg); - break; - - case SMSG_SKILL_CAST_CANCEL: - BeingRecv::processSkillCancel(msg); - break; - - case SMSG_SKILL_NO_DAMAGE: - Ea::BeingRecv::processSkillNoDamage(msg); - break; - - case SMSG_SKILL_GROUND_NO_DAMAGE: - BeingRecv::processSkillGroundNoDamage(msg); - break; - - case SMSG_SKILL_ENTRY: - BeingRecv::processSkillEntry(msg); - break; - - case SMSG_PVP_MAP_MODE: - Ea::BeingRecv::processPvpMapMode(msg); - break; - - case SMSG_PVP_SET: - BeingRecv::processPvpSet(msg); - break; - - case SMSG_MAP_TYPE_PROPERTY2: - BeingRecv::processMapTypeProperty(msg); - break; - - case SMSG_MAP_TYPE: - BeingRecv::processMapType(msg); - break; - - case SMSG_MONSTER_HP: - BeingRecv::processMonsterHp(msg); - break; - - case SMSG_PLAYER_HP: - BeingRecv::processMonsterHp(msg); - break; - - case SMSG_RANKS_LIST: - BeingRecv::processRanksList(msg); - break; - - case SMSG_BEING_FAKE_NAME: - BeingRecv::processBeingFakeName(msg); - break; - - case SMSG_BEING_STAT_UPDATE_1: - BeingRecv::processBeingStatUpdate1(msg); - break; - - case SMSG_MOB_INFO: - BeingRecv::processMobInfo(msg); - break; - - case SMSG_BEING_MOVE3: - Ea::BeingRecv::processBeingMove3(msg); - break; - - case SMSG_BEING_ATTRS: - BeingRecv::processBeingAttrs(msg); - break; - - case SMSG_MONSTER_INFO: - BeingRecv::processMonsterInfo(msg); - break; - - case SMSG_CLASS_CHANGE: - BeingRecv::processClassChange(msg); - break; - - case SMSG_SPIRIT_BALLS: - BeingRecv::processSpiritBalls(msg); - break; - - case SMSG_SPIRIT_BALL_SINGLE: - BeingRecv::processSpiritBallSingle(msg); - break; - - case SMSG_BLADE_STOP: - BeingRecv::processBladeStop(msg); - break; - - case SMSG_COMBO_DELAY: - BeingRecv::processComboDelay(msg); - break; - - case SMSG_WEDDING_EFFECT: - BeingRecv::processWddingEffect(msg); - break; - - case SMSG_BEING_SLIDE: - BeingRecv::processBeingSlide(msg); - break; - - case SMSG_STARS_KILL: - BeingRecv::processStarsKill(msg); - break; - - case SMSG_BLACKSMITH_RANKS_LIST: - BeingRecv::processBlacksmithRanksList(msg); - break; - - case SMSG_ALCHEMIST_RANKS_LIST: - BeingRecv::processAlchemistRanksList(msg); - break; - - case SMSG_TAEKWON_RANKS_LIST: - BeingRecv::processTaekwonRanksList(msg); - break; - - case SMSG_PK_RANKS_LIST: - BeingRecv::processPkRanksList(msg); - break; - - case SMSG_GLADIATOR_FEEL_REQUEST: - BeingRecv::processGladiatorFeelRequest(msg); - break; - - case SMSG_BOSS_MAP_INFO: - BeingRecv::processBossMapInfo(msg); - break; - - case SMSG_BEING_FONT: - BeingRecv::processBeingFont(msg); - break; - - case SMSG_BEING_MILLENIUM_SHIELD: - BeingRecv::processBeingMilleniumShield(msg); - break; - - case SMSG_BEING_CHARM: - BeingRecv::processBeingCharm(msg); - break; - - case SMSG_BEING_VIEW_EQUIPMENT: - BeingRecv::processBeingViewEquipment(msg); - break; - - default: - break; - } -} - void BeingHandler::undress(Being *const being) const { if (!being) diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index d47ec2f98..6780e9bc3 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -25,20 +25,16 @@ #include "net/ea/beinghandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class BeingHandler final : public MessageHandler, public Ea::BeingHandler +class BeingHandler final : public Ea::BeingHandler { public: explicit BeingHandler(const bool enableSync); A_DELETE_COPY(BeingHandler) - void handleMessage(Net::MessageIn &msg) override final; - void requestNameById(const BeingId id) const override final; void undress(Being *const being) const override final; diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index c6673e588..d3b411a67 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -38,76 +38,11 @@ extern Net::BuyingStoreHandler *buyingStoreHandler; namespace EAthena { -BuyingStoreHandler::BuyingStoreHandler() : - MessageHandler() +BuyingStoreHandler::BuyingStoreHandler() { - static const uint16_t _messages[] = - { - SMSG_BUYINGSTORE_OPEN, - SMSG_BUYINGSTORE_CREATE_FAILED, - SMSG_BUYINGSTORE_OWN_ITEMS, - SMSG_BUYINGSTORE_SHOW_BOARD, - SMSG_BUYINGSTORE_HIDE_BOARD, - SMSG_BUYINGSTORE_ITEMS_LIST, - SMSG_BUYINGSTORE_SELL_FAILED, - SMSG_BUYINGSTORE_REPORT, - SMSG_BUYINGSTORE_DELETE_ITEM, - SMSG_BUYINGSTORE_SELLER_SELL_FAILED, - 0 - }; - handledMessages = _messages; buyingStoreHandler = this; } -void BuyingStoreHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_BUYINGSTORE_OPEN: - BuyingStoreRecv::processBuyingStoreOpen(msg); - break; - - case SMSG_BUYINGSTORE_CREATE_FAILED: - BuyingStoreRecv::processBuyingStoreCreateFailed(msg); - break; - - case SMSG_BUYINGSTORE_OWN_ITEMS: - BuyingStoreRecv::processBuyingStoreOwnItems(msg); - break; - - case SMSG_BUYINGSTORE_SHOW_BOARD: - BuyingStoreRecv::processBuyingStoreShowBoard(msg); - break; - - case SMSG_BUYINGSTORE_HIDE_BOARD: - BuyingStoreRecv::processBuyingStoreHideBoard(msg); - break; - - case SMSG_BUYINGSTORE_ITEMS_LIST: - BuyingStoreRecv::processBuyingStoreItemsList(msg); - break; - - case SMSG_BUYINGSTORE_SELL_FAILED: - BuyingStoreRecv::processBuyingStoreSellFailed(msg); - break; - - case SMSG_BUYINGSTORE_REPORT: - BuyingStoreRecv::processBuyingStoreReport(msg); - break; - - case SMSG_BUYINGSTORE_DELETE_ITEM: - BuyingStoreRecv::processBuyingStoreDeleteItem(msg); - break; - - case SMSG_BUYINGSTORE_SELLER_SELL_FAILED: - BuyingStoreRecv::processBuyingStoreSellerSellFailed(msg); - break; - - default: - break; - } -} - void BuyingStoreHandler::create(const std::string &name, const int maxMoney, const bool flag, diff --git a/src/net/eathena/buyingstorehandler.h b/src/net/eathena/buyingstorehandler.h index 3fc1dd603..f806fe24c 100644 --- a/src/net/eathena/buyingstorehandler.h +++ b/src/net/eathena/buyingstorehandler.h @@ -25,20 +25,15 @@ #include "net/buyingstorehandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class BuyingStoreHandler final : public MessageHandler, - public Net::BuyingStoreHandler +class BuyingStoreHandler final : public Net::BuyingStoreHandler { public: BuyingStoreHandler(); A_DELETE_COPY(BuyingStoreHandler) - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name, const int maxMoney, const bool flag, diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index ea15b1ac3..b4cd56fc6 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -36,52 +36,12 @@ namespace EAthena { BuySellHandler::BuySellHandler() : - MessageHandler(), Ea::BuySellHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_BUY_SELL_CHOICE, - SMSG_NPC_BUY, - SMSG_NPC_SELL, - SMSG_NPC_BUY_RESPONSE, - SMSG_NPC_SELL_RESPONSE, - 0 - }; - handledMessages = _messages; buySellHandler = this; Ea::BuySellRecv::mBuyDialog = nullptr; } -void BuySellHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_NPC_BUY_SELL_CHOICE: - Ea::BuySellRecv::processNpcBuySellChoice(msg); - break; - - case SMSG_NPC_BUY: - BuySellRecv::processNpcBuy(msg); - break; - - case SMSG_NPC_SELL: - Ea::BuySellRecv::processNpcSell(msg); - break; - - case SMSG_NPC_BUY_RESPONSE: - Ea::BuySellRecv::processNpcBuyResponse(msg); - break; - - case SMSG_NPC_SELL_RESPONSE: - BuySellRecv::processNpcSellResponse(msg); - break; - - default: - break; - } -} - void BuySellHandler::requestSellList(const std::string &nick A_UNUSED) const { } diff --git a/src/net/eathena/buysellhandler.h b/src/net/eathena/buysellhandler.h index c2a94d7a5..6327bfbff 100644 --- a/src/net/eathena/buysellhandler.h +++ b/src/net/eathena/buysellhandler.h @@ -25,20 +25,16 @@ #include "net/ea/buysellhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class BuySellHandler final : public MessageHandler, public Ea::BuySellHandler +class BuySellHandler final : public Ea::BuySellHandler { public: BuySellHandler(); A_DELETE_COPY(BuySellHandler) - void handleMessage(Net::MessageIn &msg) override final; - void requestSellList(const std::string &nick) const override final; diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp index 53888cf46..058dedfdc 100644 --- a/src/net/eathena/cashshophandler.cpp +++ b/src/net/eathena/cashshophandler.cpp @@ -31,57 +31,12 @@ extern Net::CashShopHandler *cashShopHandler; namespace EAthena { -CashShopHandler::CashShopHandler() : - MessageHandler() +CashShopHandler::CashShopHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_CASH_SHOP_OPEN, - SMSG_NPC_CASH_BUY_ACK, - SMSG_NPC_CASH_POINTS, - SMSG_NPC_CASH_BUY, - SMSG_NPC_CASH_TAB_PRICE_LIST, - SMSG_NPC_CASH_SCHEDULE, - 0 - }; - handledMessages = _messages; cashShopHandler = this; CashShopRecv::mBuyDialog = nullptr; } -void CashShopHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_NPC_CASH_SHOP_OPEN: - CashShopRecv::processCashShopOpen(msg); - break; - - case SMSG_NPC_CASH_BUY_ACK: - CashShopRecv::processCashShopBuyAck(msg); - break; - - case SMSG_NPC_CASH_POINTS: - CashShopRecv::processCashShopPoints(msg); - break; - - case SMSG_NPC_CASH_BUY: - CashShopRecv::processCashShopBuy(msg); - break; - - case SMSG_NPC_CASH_TAB_PRICE_LIST: - CashShopRecv::processCashShopTabPriceList(msg); - break; - - case SMSG_NPC_CASH_SCHEDULE: - CashShopRecv::processCashShopSchedule(msg); - break; - - default: - break; - } -} - void CashShopHandler::buyItem(const int points, const int itemId, const ItemColor color A_UNUSED, diff --git a/src/net/eathena/cashshophandler.h b/src/net/eathena/cashshophandler.h index e5f057663..099aa3e92 100644 --- a/src/net/eathena/cashshophandler.h +++ b/src/net/eathena/cashshophandler.h @@ -25,20 +25,15 @@ #include "net/cashshophandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class CashShopHandler final : public MessageHandler, - public Net::CashShopHandler +class CashShopHandler final : public Net::CashShopHandler { public: CashShopHandler(); A_DELETE_COPY(CashShopHandler) - void handleMessage(Net::MessageIn &msg) override final; - void buyItem(const int points, const int itemId, const ItemColor color, diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 42e3dd7e4..634283a8e 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -48,7 +48,6 @@ extern ServerInfo charServer; extern ServerInfo mapServer; CharServerHandler::CharServerHandler() : - MessageHandler(), Ea::CharServerHandler() { CharServerRecv::mNewName.clear(); @@ -57,118 +56,9 @@ CharServerHandler::CharServerHandler() : CharServerRecv::mRenameId = BeingId_zero; CharServerRecv::mNeedCreatePin = false; - static const uint16_t _messages[] = - { - SMSG_CHAR_LOGIN, - SMSG_CHAR_LOGIN2, - SMSG_CHAR_LOGIN_ERROR, - SMSG_CHAR_CREATE_SUCCEEDED, - SMSG_CHAR_CREATE_FAILED, - SMSG_CHAR_DELETE_SUCCEEDED, - SMSG_CHAR_DELETE_FAILED, - SMSG_CHAR_MAP_INFO, - SMSG_CHANGE_MAP_SERVER, - SMSG_CHAR_PINCODE_STATUS, - SMSG_CHAR_CHECK_RENAME, - SMSG_CHAR_RENAME, - SMSG_CHAR_CHANGE_SLOT, - SMSG_CHAR_CAPTCHA_NOT_SUPPORTED, - SMSG_CHAR_DELETE2_ACK, - SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK, - SMSG_CHAR_DELETE2_CANCEL_ACK, - SMSG_CHAR_CHARACTERS, - SMSG_CHAR_BAN_CHAR_LIST, - 0 - }; - handledMessages = _messages; charServerHandler = this; } -void CharServerHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_CHAR_LOGIN: - CharServerRecv::processCharLogin(msg); - break; - - case SMSG_CHAR_LOGIN2: - CharServerRecv::processCharLogin2(msg); - break; - - case SMSG_CHAR_LOGIN_ERROR: - Ea::CharServerRecv::processCharLoginError(msg); - break; - - case SMSG_CHAR_CREATE_SUCCEEDED: - CharServerRecv::processCharCreate(msg); - break; - - case SMSG_CHAR_CREATE_FAILED: - Ea::CharServerRecv::processCharCreateFailed(msg); - break; - - case SMSG_CHAR_DELETE_SUCCEEDED: - Ea::CharServerRecv::processCharDelete(msg); - break; - - case SMSG_CHAR_DELETE_FAILED: - CharServerRecv::processCharDeleteFailed(msg); - break; - - case SMSG_CHAR_MAP_INFO: - CharServerRecv::processCharMapInfo(msg); - break; - - case SMSG_CHANGE_MAP_SERVER: - CharServerRecv::processChangeMapServer(msg); - break; - - case SMSG_CHAR_PINCODE_STATUS: - CharServerRecv::processPincodeStatus(msg); - break; - - case SMSG_CHAR_CHECK_RENAME: - CharServerRecv::processCharCheckRename(msg); - break; - - case SMSG_CHAR_RENAME: - CharServerRecv::processCharRename(msg); - break; - - case SMSG_CHAR_CHANGE_SLOT: - CharServerRecv::processCharChangeSlot(msg); - break; - - case SMSG_CHAR_CAPTCHA_NOT_SUPPORTED: - CharServerRecv::processCharCaptchaNotSupported(msg); - break; - - case SMSG_CHAR_DELETE2_ACK: - CharServerRecv::processCharDelete2Ack(msg); - break; - - case SMSG_CHAR_DELETE2_ACCEPT_ACTUAL_ACK: - CharServerRecv::processCharDelete2AcceptActual(msg); - break; - - case SMSG_CHAR_DELETE2_CANCEL_ACK: - CharServerRecv::processCharDelete2CancelAck(msg); - break; - - case SMSG_CHAR_CHARACTERS: - CharServerRecv::processCharCharacters(msg); - break; - - case SMSG_CHAR_BAN_CHAR_LIST: - CharServerRecv::processCharBanCharList(msg); - break; - - default: - break; - } -} - void CharServerHandler::chooseCharacter(Net::Character *const character) { if (!character) diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index 20086c965..e08a73584 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -25,24 +25,19 @@ #include "net/ea/charserverhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { /** * Deals with incoming messages from the character server. */ -class CharServerHandler final : public MessageHandler, - public Ea::CharServerHandler +class CharServerHandler final : public Ea::CharServerHandler { public: CharServerHandler(); A_DELETE_COPY(CharServerHandler) - void handleMessage(Net::MessageIn &msg) override final; - void chooseCharacter(Net::Character *const character) override final; void newCharacter(const std::string &name, diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 9ef9b5d3b..2721bb3fb 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -44,188 +44,11 @@ namespace EAthena { ChatHandler::ChatHandler() : - MessageHandler(), Ea::ChatHandler() { - static const uint16_t _messages[] = - { - SMSG_BEING_CHAT, - SMSG_PLAYER_CHAT, - SMSG_WHISPER, - SMSG_WHISPER_RESPONSE, - SMSG_GM_CHAT, - SMSG_GM_CHAT2, - SMSG_MVP_EFFECT, - SMSG_MVP_ITEM, - SMSG_MVP_EXP, - SMSG_MVP_NO_ITEM, - SMSG_IGNORE_ALL_RESPONSE, - SMSG_COLOR_MESSAGE, - SMSG_CHAT_IGNORE_LIST, - SMSG_FORMAT_MESSAGE, - SMSG_FORMAT_MESSAGE_NUMBER, - SMSG_FORMAT_MESSAGE_SKILL, - SMSG_CHAT_DISPLAY, - SMSG_CHAT_ROOM_JOIN_ACK, - SMSG_CHAT_ROOM_LEAVE, - SMSG_CHAT_JOIN_CHANNEL, - SMSG_IGNORE_NICK_ACK, - SMSG_CHAT_ROOM_CREATE_ACK, - SMSG_CHAT_ROOM_DESTROY, - SMSG_CHAT_ROOM_JOIN_FAILED, - SMSG_CHAT_ROOM_ADD_MEMBER, - SMSG_CHAT_ROOM_SETTINGS, - SMSG_CHAT_ROOM_ROLE_CHANGE, - SMSG_MANNER_MESSAGE, - SMSG_CHAT_SILENCE, - SMSG_CHAT_TALKIE_BOX, - SMSG_BATTLE_CHAT_MESSAGE, - SMSG_SCRIPT_MESSAGE, - 0 - }; - handledMessages = _messages; chatHandler = this; } -void ChatHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_WHISPER_RESPONSE: - ChatRecv::processWhisperResponse(msg); - break; - - // Received whisper - case SMSG_WHISPER: - ChatRecv::processWhisper(msg); - break; - - // Received speech from being - case SMSG_BEING_CHAT: - ChatRecv::processBeingChat(msg); - break; - - case SMSG_PLAYER_CHAT: - ChatRecv::processChat(msg); - break; - - case SMSG_FORMAT_MESSAGE: - ChatRecv::processFormatMessage(msg); - break; - - case SMSG_FORMAT_MESSAGE_NUMBER: - ChatRecv::processFormatMessageNumber(msg); - break; - - case SMSG_FORMAT_MESSAGE_SKILL: - ChatRecv::processFormatMessageSkill(msg); - break; - - case SMSG_COLOR_MESSAGE: - ChatRecv::processColorChat(msg); - break; - - case SMSG_GM_CHAT: - ChatRecv::processGmChat(msg); - break; - - case SMSG_GM_CHAT2: - ChatRecv::processGmChat2(msg); - break; - - case SMSG_MVP_EFFECT: - Ea::ChatRecv::processMVPEffect(msg); - break; - - case SMSG_MVP_ITEM: - ChatRecv::processMVPItem(msg); - break; - - case SMSG_MVP_EXP: - ChatRecv::processMVPExp(msg); - break; - - case SMSG_MVP_NO_ITEM: - ChatRecv::processMVPNoItem(msg); - break; - - case SMSG_IGNORE_ALL_RESPONSE: - Ea::ChatRecv::processIgnoreAllResponse(msg); - break; - - case SMSG_CHAT_IGNORE_LIST: - ChatRecv::processChatIgnoreList(msg); - break; - - case SMSG_CHAT_DISPLAY: - ChatRecv::processChatDisplay(msg); - break; - - case SMSG_CHAT_ROOM_JOIN_ACK: - ChatRecv::processChatRoomJoinAck(msg); - break; - - case SMSG_CHAT_ROOM_LEAVE: - ChatRecv::processChatRoomLeave(msg); - break; - - case SMSG_CHAT_JOIN_CHANNEL: - ChatRecv::processJoinChannel(msg); - break; - - case SMSG_IGNORE_NICK_ACK: - ChatRecv::processIgnoreNickAck(msg); - break; - - case SMSG_CHAT_ROOM_CREATE_ACK: - ChatRecv::processChatRoomCreateAck(msg); - break; - - case SMSG_CHAT_ROOM_DESTROY: - ChatRecv::processChatRoomDestroy(msg); - break; - - case SMSG_CHAT_ROOM_JOIN_FAILED: - ChatRecv::processChatRoomJoinFailed(msg); - break; - - case SMSG_CHAT_ROOM_ADD_MEMBER: - ChatRecv::processChatRoomAddMember(msg); - break; - - case SMSG_CHAT_ROOM_SETTINGS: - ChatRecv::processChatRoomSettings(msg); - break; - - case SMSG_CHAT_ROOM_ROLE_CHANGE: - ChatRecv::processChatRoomRoleChange(msg); - break; - - case SMSG_MANNER_MESSAGE: - ChatRecv::processMannerMessage(msg); - break; - - case SMSG_CHAT_SILENCE: - ChatRecv::processChatSilence(msg); - break; - - case SMSG_CHAT_TALKIE_BOX: - ChatRecv::processChatTalkieBox(msg); - break; - - case SMSG_BATTLE_CHAT_MESSAGE: - ChatRecv::processBattleChatMessage(msg); - break; - - case SMSG_SCRIPT_MESSAGE: - ChatRecv::processScriptMessage(msg); - break; - - default: - break; - } -} - void ChatHandler::talk(const std::string &restrict text, const std::string &restrict channel A_UNUSED) const { diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index a9a92452e..4cbb9b6f7 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -25,21 +25,17 @@ #include "net/ea/chathandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { class MessageOut; -class ChatHandler final : public MessageHandler, public Ea::ChatHandler +class ChatHandler final : public Ea::ChatHandler { public: ChatHandler(); A_DELETE_COPY(ChatHandler) - void handleMessage(Net::MessageIn &msg) override final; - void talk(const std::string &restrict text, const std::string &restrict channel) const override final; diff --git a/src/net/eathena/elementalhandler.cpp b/src/net/eathena/elementalhandler.cpp index 44c1437a8..e23758647 100644 --- a/src/net/eathena/elementalhandler.cpp +++ b/src/net/eathena/elementalhandler.cpp @@ -30,34 +30,9 @@ extern Net::ElementalHandler *elementalHandler; namespace EAthena { -ElementalHandler::ElementalHandler() : - MessageHandler() +ElementalHandler::ElementalHandler() { - static const uint16_t _messages[] = - { - SMSG_ELEMENTAL_UPDATE_STATUS, - SMSG_ELEMENTAL_INFO, - 0 - }; - handledMessages = _messages; elementalHandler = this; } -void ElementalHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_ELEMENTAL_UPDATE_STATUS: - ElementalRecv::processElementalUpdateStatus(msg); - break; - - case SMSG_ELEMENTAL_INFO: - ElementalRecv::processElementalInfo(msg); - break; - - default: - break; - } -} - } // namespace EAthena diff --git a/src/net/eathena/elementalhandler.h b/src/net/eathena/elementalhandler.h index e8b28233e..b22ac8b68 100644 --- a/src/net/eathena/elementalhandler.h +++ b/src/net/eathena/elementalhandler.h @@ -23,19 +23,14 @@ #include "net/elementalhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class ElementalHandler final : public MessageHandler, - public Net::ElementalHandler +class ElementalHandler final : public Net::ElementalHandler { public: ElementalHandler(); A_DELETE_COPY(ElementalHandler) - - void handleMessage(Net::MessageIn &msg) override final; }; } // namespace EAthena diff --git a/src/net/eathena/familyhandler.cpp b/src/net/eathena/familyhandler.cpp index 8d4949b4f..37c6cd079 100644 --- a/src/net/eathena/familyhandler.cpp +++ b/src/net/eathena/familyhandler.cpp @@ -33,49 +33,14 @@ extern Net::FamilyHandler *familyHandler; namespace EAthena { -FamilyHandler::FamilyHandler() : - MessageHandler() +FamilyHandler::FamilyHandler() { FamilyRecv::mParent1 = 0; FamilyRecv::mParent2 = 0; - static const uint16_t _messages[] = - { - SMSG_FAMILY_ASK_FOR_CHILD, - SMSG_FAMILY_CALL_PARTNER, - SMSG_FAMILY_DIVORCED, - SMSG_FAMILY_ASK_FOR_CHILD_REPLY, - 0 - }; - handledMessages = _messages; familyHandler = this; } -void FamilyHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_FAMILY_ASK_FOR_CHILD: - FamilyRecv::processAskForChild(msg); - break; - - case SMSG_FAMILY_CALL_PARTNER: - FamilyRecv::processCallPartner(msg); - break; - - case SMSG_FAMILY_DIVORCED: - FamilyRecv::processDivorced(msg); - break; - - case SMSG_FAMILY_ASK_FOR_CHILD_REPLY: - FamilyRecv::processAskForChildReply(msg); - break; - - default: - break; - } -} - void FamilyHandler::askForChild(const Being *const being) { if (!being) diff --git a/src/net/eathena/familyhandler.h b/src/net/eathena/familyhandler.h index 16acc8b67..2d2c42303 100644 --- a/src/net/eathena/familyhandler.h +++ b/src/net/eathena/familyhandler.h @@ -25,20 +25,15 @@ #include "net/familyhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class FamilyHandler final : public MessageHandler, - public Net::FamilyHandler +class FamilyHandler final : public Net::FamilyHandler { public: FamilyHandler(); A_DELETE_COPY(FamilyHandler) - void handleMessage(Net::MessageIn &msg) override final; - void askForChild(const Being *const being) override final; void askForChildReply(const bool accept) override final; diff --git a/src/net/eathena/friendshandler.cpp b/src/net/eathena/friendshandler.cpp index 8d07aa94d..844c292f1 100644 --- a/src/net/eathena/friendshandler.cpp +++ b/src/net/eathena/friendshandler.cpp @@ -31,51 +31,11 @@ extern Net::FriendsHandler *friendsHandler; namespace EAthena { -FriendsHandler::FriendsHandler() : - MessageHandler() +FriendsHandler::FriendsHandler() { - static const uint16_t _messages[] = - { - SMSG_FRIENDS_PLAYER_ONLINE, - SMSG_FRIENDS_LIST, - SMSG_FRIENDS_REQUEST_ACK, - SMSG_FRIENDS_REQUEST, - SMSG_FRIENDS_DELETE_PLAYER, - 0 - }; - handledMessages = _messages; friendsHandler = this; } -void FriendsHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_FRIENDS_PLAYER_ONLINE: - FriendsRecv::processPlayerOnline(msg); - break; - - case SMSG_FRIENDS_LIST: - FriendsRecv::processFriendsList(msg); - break; - - case SMSG_FRIENDS_REQUEST_ACK: - FriendsRecv::processRequestAck(msg); - break; - - case SMSG_FRIENDS_REQUEST: - FriendsRecv::processRequest(msg); - break; - - case SMSG_FRIENDS_DELETE_PLAYER: - FriendsRecv::processDeletePlayer(msg); - break; - - default: - break; - } -} - void FriendsHandler::invite(const std::string &name) const { createOutPacket(CMSG_FRIENDS_ADD_PLAYER); diff --git a/src/net/eathena/friendshandler.h b/src/net/eathena/friendshandler.h index 9f63487e9..519788633 100644 --- a/src/net/eathena/friendshandler.h +++ b/src/net/eathena/friendshandler.h @@ -25,20 +25,15 @@ #include "net/friendshandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class FriendsHandler final : public MessageHandler, - public Net::FriendsHandler +class FriendsHandler final : public Net::FriendsHandler { public: FriendsHandler(); A_DELETE_COPY(FriendsHandler) - void handleMessage(Net::MessageIn &msg) override final; - void invite(const std::string &name) const override final; void inviteResponse(const int accountId, diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 9b2756058..5cdec491f 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -48,61 +48,11 @@ namespace EAthena extern ServerInfo mapServer; GameHandler::GameHandler() : - MessageHandler(), Ea::GameHandler() { - static const uint16_t _messages[] = - { - SMSG_MAP_LOGIN_SUCCESS, - SMSG_SERVER_PING, - SMSG_WHO_ANSWER, - SMSG_CHAR_SWITCH_RESPONSE, - SMSG_MAP_QUIT_RESPONSE, - SMSG_MAP_ACCOUNT_ID, - SMSG_MAP_AUTH_REFUSE, - 0 - }; - handledMessages = _messages; gameHandler = this; } -void GameHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_MAP_LOGIN_SUCCESS: - GameRecv::processMapLogin(msg); - break; - - case SMSG_SERVER_PING: - GameRecv::processServerTick(msg); - break; - - case SMSG_WHO_ANSWER: - Ea::GameRecv::processWhoAnswer(msg); - break; - - case SMSG_CHAR_SWITCH_RESPONSE: - Ea::GameRecv::processCharSwitchResponse(msg); - break; - - case SMSG_MAP_QUIT_RESPONSE: - Ea::GameRecv::processMapQuitResponse(msg); - break; - - case SMSG_MAP_ACCOUNT_ID: - GameRecv::processMapAccountId(msg); - break; - - case SMSG_MAP_AUTH_REFUSE: - GameRecv::processMapAuthRefuse(msg); - break; - - default: - break; - } -} - void GameHandler::mapLoadedEvent() const { createOutPacket(CMSG_MAP_LOADED); diff --git a/src/net/eathena/gamehandler.h b/src/net/eathena/gamehandler.h index b740ff299..ddbe43c07 100644 --- a/src/net/eathena/gamehandler.h +++ b/src/net/eathena/gamehandler.h @@ -23,22 +23,18 @@ #ifndef NET_EATHENA_GAMEHANDLER_H #define NET_EATHENA_GAMEHANDLER_H -#include "net/eathena/messagehandler.h" - #include "net/ea/gamehandler.h" namespace EAthena { -class GameHandler final : public MessageHandler, public Ea::GameHandler +class GameHandler final : public Ea::GameHandler { public: GameHandler(); A_DELETE_COPY(GameHandler) - void handleMessage(Net::MessageIn &msg) override final; - void connect() override final; bool isConnected() const override final A_WARN_UNUSED; diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index f57bcef35..ba3c0aadb 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -37,6 +37,7 @@ #include "net/eathena/adminhandler.h" #include "net/eathena/auctionhandler.h" #include "net/eathena/bankhandler.h" +#include "net/eathena/battlegroundhandler.h" #include "net/eathena/beinghandler.h" #include "net/eathena/buyingstorehandler.h" #include "net/eathena/buysellhandler.h" @@ -52,6 +53,7 @@ #include "net/eathena/inventoryhandler.h" #include "net/eathena/itemhandler.h" #include "net/eathena/loginhandler.h" +#include "net/eathena/maphandler.h" #include "net/eathena/mailhandler.h" #include "net/eathena/markethandler.h" #include "net/eathena/mercenaryhandler.h" @@ -82,7 +84,6 @@ namespace EAthena { GeneralHandler::GeneralHandler() : - MessageHandler(), mAdminHandler(new AdminHandler), mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), mBuySellHandler(new BuySellHandler), @@ -106,25 +107,18 @@ GeneralHandler::GeneralHandler() : mCashShopHandler(new CashShopHandler), mFamilyHandler(new FamilyHandler), mBankHandler(new BankHandler), - mBattleGroundHandler(new BankHandler), + mBattleGroundHandler(new BattleGroundHandler), mMercenaryHandler(new MercenaryHandler), mBuyingStoreHandler(new BuyingStoreHandler), mHomunculusHandler(new HomunculusHandler), mFriendsHandler(new FriendsHandler), mElementalHandler(new ElementalHandler), - mMapHandler(new MarketHandler), + mMapHandler(new MapHandler), mMarketHandler(new MarketHandler), mVendingHandler(new VendingHandler), mRouletteHandler(new RouletteHandler), mSearchStoreHandler(new SearchStoreHandler) { - static const uint16_t _messages[] = - { - SMSG_CONNECTION_PROBLEM, - SMSG_MAP_NOT_FOUND, - 0 - }; - handledMessages = _messages; generalHandler = this; std::vector<ItemDB::Stat> stats; @@ -143,23 +137,6 @@ GeneralHandler::~GeneralHandler() delete2(Network::mInstance); } -void GeneralHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_CONNECTION_PROBLEM: - GeneralRecv::processConnectionProblem(msg); - break; - - case SMSG_MAP_NOT_FOUND: - GeneralRecv::processMapNotFound(msg); - break; - - default: - break; - } -} - void GeneralHandler::load() { new Network; diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index 0a7089c5d..d8f23a4c6 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -25,15 +25,47 @@ #include "net/generalhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { +class AdminHandler; +class BeingHandler; +class BuySellHandler; +class CharServerHandler; +class ChatHandler; +class GameHandler; +class GuildHandler; +class InventoryHandler; +class ItemHandler; +class LoginHandler; +class NpcHandler; +class PartyHandler; +class PetHandler; +class PlayerHandler; +class SkillHandler; +class TradeHandler; +class QuestHandler; +class ServerFeatures; +class AuctionHandler; +class BankHandler; +class BattleGroundHandler; +class BuyingStoreHandler; +class CashShopHandler; +class ElementalHandler; +class FamilyHandler; +class FriendsHandler; +class HomunculusHandler; +class MailHandler; +class MapHandler; +class MarketHandler; +class MercenaryHandler; +class RouletteHandler; +class SearchStoreHandler; +class VendingHandler; + class ServerFeatures; -class GeneralHandler final : public MessageHandler, - public Net::GeneralHandler +class GeneralHandler final : public Net::GeneralHandler { public: GeneralHandler(); @@ -42,8 +74,6 @@ class GeneralHandler final : public MessageHandler, ~GeneralHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void load() override final; void reload() override final; @@ -63,40 +93,40 @@ class GeneralHandler final : public MessageHandler, void gameEnded() const override final; protected: - MessageHandlerPtr mAdminHandler; - MessageHandlerPtr mBeingHandler; - MessageHandlerPtr mBuySellHandler; - MessageHandlerPtr mCharServerHandler; - MessageHandlerPtr mChatHandler; - MessageHandlerPtr mGameHandler; - MessageHandlerPtr mGuildHandler; - MessageHandlerPtr mInventoryHandler; - MessageHandlerPtr mItemHandler; - MessageHandlerPtr mLoginHandler; - MessageHandlerPtr mNpcHandler; - MessageHandlerPtr mPartyHandler; - MessageHandlerPtr mPetHandler; - MessageHandlerPtr mPlayerHandler; - MessageHandlerPtr mSkillHandler; - MessageHandlerPtr mTradeHandler; - MessageHandlerPtr mQuestHandler; + AdminHandler *mAdminHandler; + BeingHandler *mBeingHandler; + BuySellHandler *mBuySellHandler; + CharServerHandler *mCharServerHandler; + ChatHandler *mChatHandler; + GameHandler *mGameHandler; + GuildHandler *mGuildHandler; + InventoryHandler *mInventoryHandler; + ItemHandler *mItemHandler; + LoginHandler *mLoginHandler; + NpcHandler *mNpcHandler; + PartyHandler *mPartyHandler; + PetHandler *mPetHandler; + PlayerHandler *mPlayerHandler; + SkillHandler *mSkillHandler; + TradeHandler *mTradeHandler; + QuestHandler *mQuestHandler; ServerFeatures *mServerFeatures; - MessageHandlerPtr mMailHandler; - MessageHandlerPtr mAuctionHandler; - MessageHandlerPtr mCashShopHandler; - MessageHandlerPtr mFamilyHandler; - MessageHandlerPtr mBankHandler; - MessageHandlerPtr mBattleGroundHandler; - MessageHandlerPtr mMercenaryHandler; - MessageHandlerPtr mBuyingStoreHandler; - MessageHandlerPtr mHomunculusHandler; - MessageHandlerPtr mFriendsHandler; - MessageHandlerPtr mElementalHandler; - MessageHandlerPtr mMapHandler; - MessageHandlerPtr mMarketHandler; - MessageHandlerPtr mVendingHandler; - MessageHandlerPtr mRouletteHandler; - MessageHandlerPtr mSearchStoreHandler; + MailHandler *mMailHandler; + AuctionHandler *mAuctionHandler; + CashShopHandler *mCashShopHandler; + FamilyHandler *mFamilyHandler; + BankHandler *mBankHandler; + BattleGroundHandler *mBattleGroundHandler; + MercenaryHandler *mMercenaryHandler; + BuyingStoreHandler *mBuyingStoreHandler; + HomunculusHandler *mHomunculusHandler; + FriendsHandler *mFriendsHandler; + ElementalHandler *mElementalHandler; + MapHandler *mMapHandler; + MarketHandler *mMarketHandler; + VendingHandler *mVendingHandler; + RouletteHandler *mRouletteHandler; + SearchStoreHandler *mSearchStoreHandler; }; } // namespace EAthena diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 64801f265..27a4183c0 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -40,43 +40,8 @@ namespace EAthena { GuildHandler::GuildHandler() : - Ea::GuildHandler(), - MessageHandler() + Ea::GuildHandler() { - static const uint16_t _messages[] = - { - SMSG_GUILD_CREATE_RESPONSE, - SMSG_GUILD_POSITION_INFO, - SMSG_GUILD_MEMBER_LOGIN, - SMSG_GUILD_MASTER_OR_MEMBER, - SMSG_GUILD_BASIC_INFO, - SMSG_GUILD_ALIANCE_INFO, - SMSG_GUILD_MEMBER_LIST, - SMSG_GUILD_POS_NAME_LIST, - SMSG_GUILD_POS_INFO_LIST, - SMSG_GUILD_POSITION_CHANGED, - SMSG_GUILD_MEMBER_POS_CHANGE, - SMSG_GUILD_EMBLEM_DATA, - SMSG_GUILD_SKILL_INFO, - SMSG_GUILD_NOTICE, - SMSG_GUILD_INVITE, - SMSG_GUILD_INVITE_ACK, - SMSG_GUILD_LEAVE, - SMSG_GUILD_EXPULSION, - SMSG_GUILD_EXPULSION_LIST, - SMSG_GUILD_MESSAGE, - SMSG_GUILD_SKILL_UP, - SMSG_GUILD_REQ_ALLIANCE, - SMSG_GUILD_REQ_ALLIANCE_ACK, - SMSG_GUILD_DEL_ALLIANCE, - SMSG_GUILD_OPPOSITION_ACK, - SMSG_GUILD_BROKEN, - SMSG_GUILD_UPDATE_COORDS, - SMSG_GUILD_EMBLEM, - 0 - }; - handledMessages = _messages; - guildHandler = this; } @@ -84,127 +49,6 @@ GuildHandler::~GuildHandler() { } -void GuildHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_GUILD_CREATE_RESPONSE: - Ea::GuildRecv::processGuildCreateResponse(msg); - break; - - case SMSG_GUILD_POSITION_INFO: - GuildRecv::processGuildPositionInfo(msg); - break; - - case SMSG_GUILD_MEMBER_LOGIN: - GuildRecv::processGuildMemberLogin(msg); - break; - - case SMSG_GUILD_MASTER_OR_MEMBER: - Ea::GuildRecv::processGuildMasterOrMember(msg); - break; - - case SMSG_GUILD_BASIC_INFO: - Ea::GuildRecv::processGuildBasicInfo(msg); - break; - - case SMSG_GUILD_ALIANCE_INFO: - Ea::GuildRecv::processGuildAlianceInfo(msg); - break; - - case SMSG_GUILD_MEMBER_LIST: - Ea::GuildRecv::processGuildMemberList(msg); - break; - - case SMSG_GUILD_POS_NAME_LIST: - Ea::GuildRecv::processGuildPosNameList(msg); - break; - - case SMSG_GUILD_POS_INFO_LIST: - Ea::GuildRecv::processGuildPosInfoList(msg); - break; - - case SMSG_GUILD_POSITION_CHANGED: - Ea::GuildRecv::processGuildPositionChanged(msg); - break; - - case SMSG_GUILD_MEMBER_POS_CHANGE: - Ea::GuildRecv::processGuildMemberPosChange(msg); - break; - - case SMSG_GUILD_EMBLEM_DATA: - Ea::GuildRecv::processGuildEmblemData(msg); - break; - - case SMSG_GUILD_SKILL_INFO: - Ea::GuildRecv::processGuildSkillInfo(msg); - break; - - case SMSG_GUILD_NOTICE: - Ea::GuildRecv::processGuildNotice(msg); - break; - - case SMSG_GUILD_INVITE: - Ea::GuildRecv::processGuildInvite(msg); - break; - - case SMSG_GUILD_INVITE_ACK: - Ea::GuildRecv::processGuildInviteAck(msg); - break; - - case SMSG_GUILD_LEAVE: - Ea::GuildRecv::processGuildLeave(msg); - break; - - case SMSG_GUILD_EXPULSION: - GuildRecv::processGuildExpulsion(msg); - break; - - case SMSG_GUILD_EXPULSION_LIST: - GuildRecv::processGuildExpulsionList(msg); - break; - - case SMSG_GUILD_MESSAGE: - Ea::GuildRecv::processGuildMessage(msg); - break; - - case SMSG_GUILD_SKILL_UP: - Ea::GuildRecv::processGuildSkillUp(msg); - break; - - case SMSG_GUILD_REQ_ALLIANCE: - Ea::GuildRecv::processGuildReqAlliance(msg); - break; - - case SMSG_GUILD_REQ_ALLIANCE_ACK: - Ea::GuildRecv::processGuildReqAllianceAck(msg); - break; - - case SMSG_GUILD_DEL_ALLIANCE: - Ea::GuildRecv::processGuildDelAlliance(msg); - break; - - case SMSG_GUILD_OPPOSITION_ACK: - Ea::GuildRecv::processGuildOppositionAck(msg); - break; - - case SMSG_GUILD_BROKEN: - Ea::GuildRecv::processGuildBroken(msg); - break; - - case SMSG_GUILD_UPDATE_COORDS: - GuildRecv::processGuildUpdateCoords(msg); - break; - - case SMSG_GUILD_EMBLEM: - GuildRecv::processGuildEmblem(msg); - break; - - default: - break; - } -} - void GuildHandler::create(const std::string &name) const { createOutPacket(CMSG_GUILD_CREATE); diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index 5d6ed40e0..a7a736741 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -24,12 +24,10 @@ #include "net/ea/guildhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class GuildHandler final : public Ea::GuildHandler, public MessageHandler +class GuildHandler final : public Ea::GuildHandler { public: GuildHandler(); @@ -38,8 +36,6 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler ~GuildHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name) const override final; void invite(const std::string &name) const override final; diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 53eac18ab..c29149f44 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -35,51 +35,11 @@ extern Net::HomunculusHandler *homunculusHandler; namespace EAthena { -HomunculusHandler::HomunculusHandler() : - MessageHandler() +HomunculusHandler::HomunculusHandler() { - static const uint16_t _messages[] = - { - SMSG_HOMUNCULUS_SKILLS, - SMSG_HOMUNCULUS_DATA, - SMSG_HOMUNCULUS_INFO, - SMSG_HOMUNCULUS_SKILL_UP, - SMSG_HOMUNCULUS_FOOD, - 0 - }; - handledMessages = _messages; homunculusHandler = this; } -void HomunculusHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_HOMUNCULUS_SKILLS: - HomunculusRecv::processHomunculusSkills(msg); - break; - - case SMSG_HOMUNCULUS_DATA: - HomunculusRecv::processHomunculusData(msg); - break; - - case SMSG_HOMUNCULUS_INFO: - HomunculusRecv::processHomunculusInfo(msg); - break; - - case SMSG_HOMUNCULUS_SKILL_UP: - HomunculusRecv::processHomunculusSkillUp(msg); - break; - - case SMSG_HOMUNCULUS_FOOD: - HomunculusRecv::processHomunculusFood(msg); - break; - - default: - break; - } -} - void HomunculusHandler::setName(const std::string &name) const { createOutPacket(CMSG_HOMUNCULUS_SET_NAME); diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index 3ae52f820..0f14e957a 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -25,20 +25,15 @@ #include "net/homunculushandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class HomunculusHandler final : public MessageHandler, - public Net::HomunculusHandler +class HomunculusHandler final : public Net::HomunculusHandler { public: HomunculusHandler(); A_DELETE_COPY(HomunculusHandler) - void handleMessage(Net::MessageIn &msg) override final; - void setName(const std::string &name) const override final; void moveToMaster() const override final; diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 32457ae48..4b24479d2 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -64,55 +64,9 @@ namespace EAthena { InventoryHandler::InventoryHandler() : - MessageHandler(), Ea::InventoryHandler(), mItemIndex(0) { - static const uint16_t _messages[] = - { - SMSG_PLAYER_INVENTORY, - SMSG_PLAYER_INVENTORY_ADD, - SMSG_PLAYER_INVENTORY_REMOVE, - SMSG_PLAYER_INVENTORY_REMOVE2, - SMSG_PLAYER_INVENTORY_USE, - SMSG_ITEM_USE_RESPONSE, - SMSG_PLAYER_STORAGE_ITEMS, - SMSG_PLAYER_STORAGE_EQUIP, - SMSG_PLAYER_STORAGE_STATUS, - SMSG_PLAYER_STORAGE_ADD, - SMSG_PLAYER_STORAGE_REMOVE, - SMSG_PLAYER_STORAGE_CLOSE, - SMSG_PLAYER_EQUIPMENT, - SMSG_PLAYER_EQUIP, - SMSG_PLAYER_UNEQUIP, - SMSG_PLAYER_ARROW_EQUIP, - SMSG_PLAYER_ATTACK_RANGE, - SMSG_PLAYER_USE_CARD, - SMSG_PLAYER_INSERT_CARD, - SMSG_PLAYER_ITEM_RENTAL_TIME, - SMSG_PLAYER_ITEM_RENTAL_EXPIRED, - SMSG_CART_INFO, - SMSG_CART_REMOVE, - SMSG_PLAYER_CART_ADD, - SMSG_PLAYER_CART_EQUIP, - SMSG_PLAYER_CART_ITEMS, - SMSG_PLAYER_CART_REMOVE, - SMSG_PLAYER_IDENTIFY_LIST, - SMSG_PLAYER_IDENTIFIED, - SMSG_PLAYER_REFINE, - SMSG_PLAYER_REPAIR_LIST, - SMSG_PLAYER_REPAIR_EFFECT, - SMSG_PLAYER_REFINE_LIST, - SMSG_PLAYER_STORAGE_PASSWORD, - SMSG_PLAYER_STORAGE_PASSWORD_RESULT, - SMSG_PLAYER_COOKING_LIST, - SMSG_ITEM_DAMAGED, - SMSG_PLAYER_FAVORITE_ITEM, - SMSG_PLAYER_CART_ADD_ERROR, - SMSG_BIND_ITEM, - 0 - }; - handledMessages = _messages; inventoryHandler = this; InventoryRecv::mCartItems.clear(); @@ -122,175 +76,6 @@ InventoryHandler::~InventoryHandler() { } -void InventoryHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_PLAYER_INVENTORY: - InventoryRecv::processPlayerInventory(msg); - break; - - case SMSG_PLAYER_STORAGE_ITEMS: - InventoryRecv::processPlayerStorage(msg); - break; - - case SMSG_PLAYER_STORAGE_EQUIP: - InventoryRecv::processPlayerStorageEquip(msg); - break; - - case SMSG_PLAYER_INVENTORY_ADD: - InventoryRecv::processPlayerInventoryAdd(msg); - break; - - case SMSG_PLAYER_INVENTORY_REMOVE: - Ea::InventoryRecv::processPlayerInventoryRemove(msg); - break; - - case SMSG_PLAYER_INVENTORY_REMOVE2: - InventoryRecv::processPlayerInventoryRemove2(msg); - break; - - case SMSG_PLAYER_INVENTORY_USE: - Ea::InventoryRecv::processPlayerInventoryUse(msg); - break; - - case SMSG_ITEM_USE_RESPONSE: - Ea::InventoryRecv::processItemUseResponse(msg); - break; - - case SMSG_PLAYER_STORAGE_STATUS: - Ea::InventoryRecv::processPlayerStorageStatus(msg); - break; - - case SMSG_PLAYER_STORAGE_ADD: - InventoryRecv::processPlayerStorageAdd(msg); - break; - - case SMSG_PLAYER_STORAGE_REMOVE: - InventoryRecv::processPlayerStorageRemove(msg); - break; - - case SMSG_PLAYER_STORAGE_CLOSE: - Ea::InventoryRecv::processPlayerStorageClose(msg); - break; - - case SMSG_PLAYER_EQUIPMENT: - InventoryRecv::processPlayerEquipment(msg); - break; - - case SMSG_PLAYER_EQUIP: - InventoryRecv::processPlayerEquip(msg); - break; - - case SMSG_PLAYER_UNEQUIP: - InventoryRecv::processPlayerUnEquip(msg); - break; - - case SMSG_PLAYER_ATTACK_RANGE: - Ea::InventoryRecv::processPlayerAttackRange(msg); - break; - - case SMSG_PLAYER_ARROW_EQUIP: - Ea::InventoryRecv::processPlayerArrowEquip(msg); - break; - - case SMSG_PLAYER_USE_CARD: - InventoryRecv::processPlayerUseCard(msg); - break; - - case SMSG_PLAYER_INSERT_CARD: - InventoryRecv::processPlayerInsertCard(msg); - break; - - case SMSG_PLAYER_ITEM_RENTAL_TIME: - InventoryRecv::processPlayerItemRentalTime(msg); - break; - - case SMSG_PLAYER_ITEM_RENTAL_EXPIRED: - InventoryRecv::processPlayerItemRentalExpired(msg); - break; - - case SMSG_CART_INFO: - InventoryRecv::processCartInfo(msg); - break; - - case SMSG_CART_REMOVE: - InventoryRecv::processCartRemove(msg); - break; - - case SMSG_PLAYER_CART_ADD: - InventoryRecv::processPlayerCartAdd(msg); - break; - - case SMSG_PLAYER_CART_EQUIP: - InventoryRecv::processPlayerCartEquip(msg); - break; - - case SMSG_PLAYER_CART_ITEMS: - InventoryRecv::processPlayerCartItems(msg); - break; - - case SMSG_PLAYER_CART_REMOVE: - InventoryRecv::processPlayerCartRemove(msg); - break; - - case SMSG_PLAYER_IDENTIFY_LIST: - InventoryRecv::processPlayerIdentifyList(msg); - break; - - case SMSG_PLAYER_IDENTIFIED: - InventoryRecv::processPlayerIdentified(msg); - break; - - case SMSG_PLAYER_REFINE: - InventoryRecv::processPlayerRefine(msg); - break; - - case SMSG_PLAYER_REPAIR_LIST: - InventoryRecv::processPlayerRepairList(msg); - break; - - case SMSG_PLAYER_REPAIR_EFFECT: - InventoryRecv::processPlayerRepairEffect(msg); - break; - - case SMSG_PLAYER_REFINE_LIST: - InventoryRecv::processPlayerRefineList(msg); - break; - - case SMSG_PLAYER_STORAGE_PASSWORD: - InventoryRecv::processPlayerStoragePassword(msg); - break; - - case SMSG_PLAYER_STORAGE_PASSWORD_RESULT: - InventoryRecv::processPlayerStoragePasswordResult(msg); - break; - - case SMSG_PLAYER_COOKING_LIST: - InventoryRecv::processPlayerCookingList(msg); - break; - - case SMSG_ITEM_DAMAGED: - InventoryRecv::processItemDamaged(msg); - break; - - case SMSG_PLAYER_FAVORITE_ITEM: - InventoryRecv::processFavoriteItem(msg); - break; - - case SMSG_PLAYER_CART_ADD_ERROR: - InventoryRecv::processCartAddError(msg); - break; - - case SMSG_BIND_ITEM: - InventoryRecv::processBindItem(msg); - break; - - default: - break; - } -} - void InventoryHandler::equipItem(const Item *const item) const { if (!item) diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index b234aada7..924275757 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -25,13 +25,10 @@ #include "net/ea/inventoryhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class InventoryHandler final : public MessageHandler, - public Ea::InventoryHandler +class InventoryHandler final : public Ea::InventoryHandler { public: InventoryHandler(); @@ -40,8 +37,6 @@ class InventoryHandler final : public MessageHandler, ~InventoryHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void equipItem(const Item *const item) const override final; void unequipItem(const Item *const item) const override final; diff --git a/src/net/eathena/itemhandler.cpp b/src/net/eathena/itemhandler.cpp index d588a9461..8f3ceee41 100644 --- a/src/net/eathena/itemhandler.cpp +++ b/src/net/eathena/itemhandler.cpp @@ -33,58 +33,8 @@ namespace EAthena { ItemHandler::ItemHandler() : - MessageHandler(), Ea::ItemHandler() { - static const uint16_t _messages[] = - { - SMSG_ITEM_VISIBLE, - SMSG_ITEM_VISIBLE2, - SMSG_ITEM_DROPPED, - SMSG_ITEM_DROPPED2, - SMSG_ITEM_REMOVE, - SMSG_GRAFFITI_VISIBLE, - SMSG_ITEM_MVP_DROPPED, - 0 - }; - handledMessages = _messages; -} - -void ItemHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_ITEM_VISIBLE: - ItemRecv::processItemVisible(msg); - break; - - case SMSG_ITEM_DROPPED: - ItemRecv::processItemDropped(msg); - break; - - case SMSG_ITEM_REMOVE: - Ea::ItemRecv::processItemRemove(msg); - break; - - case SMSG_GRAFFITI_VISIBLE: - ItemRecv::processGraffiti(msg); - break; - - case SMSG_ITEM_MVP_DROPPED: - ItemRecv::processItemMvpDropped(msg); - break; - - case SMSG_ITEM_VISIBLE2: - ItemRecv::processItemVisible2(msg); - break; - - case SMSG_ITEM_DROPPED2: - ItemRecv::processItemDropped2(msg); - break; - - default: - break; - } } } // namespace EAthena diff --git a/src/net/eathena/itemhandler.h b/src/net/eathena/itemhandler.h index cd59b1524..72c6c3b0e 100644 --- a/src/net/eathena/itemhandler.h +++ b/src/net/eathena/itemhandler.h @@ -23,21 +23,17 @@ #ifndef NET_EATHENA_ITEMHANDLER_H #define NET_EATHENA_ITEMHANDLER_H -#include "net/eathena/messagehandler.h" - #include "net/ea/itemhandler.h" namespace EAthena { -class ItemHandler final : public MessageHandler, public Ea::ItemHandler +class ItemHandler final : public Ea::ItemHandler { public: ItemHandler(); A_DELETE_COPY(ItemHandler) - - void handleMessage(Net::MessageIn &msg) override final; }; } // namespace EAthena diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 9376d24b5..2b90965ff 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -44,21 +44,8 @@ namespace EAthena extern ServerInfo charServer; LoginHandler::LoginHandler() : - MessageHandler(), Ea::LoginHandler() { - static const uint16_t _messages[] = - { - SMSG_LOGIN_DATA, - SMSG_LOGIN_ERROR, - SMSG_LOGIN_ERROR2, - SMSG_SERVER_VERSION_RESPONSE, - SMSG_UPDATE_HOST, - SMSG_LOGIN_CODING_KEY, - SMSG_CHAR_PASSWORD_RESPONSE, - 0 - }; - handledMessages = _messages; loginHandler = this; } @@ -66,43 +53,6 @@ LoginHandler::~LoginHandler() { } -void LoginHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_LOGIN_DATA: - Ea::LoginRecv::processLoginData(msg); - break; - - case SMSG_LOGIN_ERROR: - Ea::LoginRecv::processLoginError(msg); - break; - - case SMSG_LOGIN_ERROR2: - LoginRecv::processLoginError2(msg); - break; - - case SMSG_SERVER_VERSION_RESPONSE: - LoginRecv::processServerVersion(msg); - break; - - case SMSG_UPDATE_HOST: - Ea::LoginRecv::processUpdateHost(msg); - break; - - case SMSG_LOGIN_CODING_KEY: - LoginRecv::processCondingKey(msg); - break; - - case SMSG_CHAR_PASSWORD_RESPONSE: - LoginRecv::processCharPasswordResponse(msg); - break; - - default: - break; - } -} - void LoginHandler::connect() { if (!Network::mInstance) diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index af44a2e51..b400c8dd5 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -25,12 +25,10 @@ #include "net/ea/loginhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class LoginHandler final : public MessageHandler, public Ea::LoginHandler +class LoginHandler final : public Ea::LoginHandler { public: LoginHandler(); @@ -39,8 +37,6 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler ~LoginHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void connect() override final; bool isConnected() const override final A_WARN_UNUSED; diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp index 654032536..3561f3e6a 100644 --- a/src/net/eathena/mailhandler.cpp +++ b/src/net/eathena/mailhandler.cpp @@ -33,71 +33,11 @@ extern Net::MailHandler *mailHandler; namespace EAthena { -MailHandler::MailHandler() : - MessageHandler() +MailHandler::MailHandler() { - static const uint16_t _messages[] = - { - SMSG_MAIL_OPEN_WINDOW, - SMSG_MAIL_MAILS_LIST, - SMSG_MAIL_READ_MAIL, - SMSG_MAIL_GET_ATTACHMENT, - SMSG_MAIL_SEND_MAIL_ACK, - SMSG_MAIL_NEW_MAIL, - SMSG_MAIL_SET_ATTACHMENT_ACK, - SMSG_MAIL_DELETE_MAIL_ACK, - SMSG_MAIL_RETURN, - 0 - }; - handledMessages = _messages; mailHandler = this; } -void MailHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_MAIL_OPEN_WINDOW: - MailRecv::processMailOpen(msg); - break; - - case SMSG_MAIL_MAILS_LIST: - MailRecv::processMailList(msg); - break; - - case SMSG_MAIL_READ_MAIL: - MailRecv::processReadMail(msg); - break; - - case SMSG_MAIL_GET_ATTACHMENT: - MailRecv::processGetAttachment(msg); - break; - - case SMSG_MAIL_SEND_MAIL_ACK: - MailRecv::processSendMailAck(msg); - break; - - case SMSG_MAIL_NEW_MAIL: - MailRecv::processNewMail(msg); - break; - - case SMSG_MAIL_SET_ATTACHMENT_ACK: - MailRecv::processSetAttachmentAck(msg); - break; - - case SMSG_MAIL_DELETE_MAIL_ACK: - MailRecv::processDeleteAck(msg); - break; - - case SMSG_MAIL_RETURN: - MailRecv::processMailReturn(msg); - break; - - default: - break; - } -} - void MailHandler::refresh() const { createOutPacket(CMSG_MAIL_REFRESH_INBOX); diff --git a/src/net/eathena/mailhandler.h b/src/net/eathena/mailhandler.h index 947c53c52..8f4b272a5 100644 --- a/src/net/eathena/mailhandler.h +++ b/src/net/eathena/mailhandler.h @@ -23,21 +23,17 @@ #include "net/mailhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { class MessageOut; -class MailHandler final : public MessageHandler, public Net::MailHandler +class MailHandler final : public Net::MailHandler { public: MailHandler(); A_DELETE_COPY(MailHandler) - void handleMessage(Net::MessageIn &msg) override final; - void refresh() const override final; void readMessage(const int msgId) const override final; diff --git a/src/net/eathena/maphandler.cpp b/src/net/eathena/maphandler.cpp index 082bb5f3f..0616e3e1f 100644 --- a/src/net/eathena/maphandler.cpp +++ b/src/net/eathena/maphandler.cpp @@ -30,44 +30,9 @@ extern Net::MapHandler *mapHandler; namespace EAthena { -MapHandler::MapHandler() : - MessageHandler() +MapHandler::MapHandler() { - static const uint16_t _messages[] = - { - SMSG_INSTANCE_START, - SMSG_INSTANCE_CREATE, - SMSG_INSTANCE_INFO, - SMSG_INSTANCE_DELETE, - 0 - }; - handledMessages = _messages; mapHandler = this; } -void MapHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_INSTANCE_START: - MapRecv::processInstanceStart(msg); - break; - - case SMSG_INSTANCE_CREATE: - MapRecv::processInstanceCreate(msg); - break; - - case SMSG_INSTANCE_INFO: - MapRecv::processInstanceInfo(msg); - break; - - case SMSG_INSTANCE_DELETE: - MapRecv::processInstanceDelete(msg); - break; - - default: - break; - } -} - } // namespace EAthena diff --git a/src/net/eathena/maphandler.h b/src/net/eathena/maphandler.h index 9c54ece6d..4c8dfff9d 100644 --- a/src/net/eathena/maphandler.h +++ b/src/net/eathena/maphandler.h @@ -23,20 +23,21 @@ #include "net/maphandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { -class MapHandler final : public MessageHandler, public Net::MapHandler +class MapHandler final : public Net::MapHandler { public: MapHandler(); A_DELETE_COPY(MapHandler) - void handleMessage(Net::MessageIn &msg) override final; - protected: void processInstanceStart(Net::MessageIn &msg); diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp index 36e45e60e..5c71b3032 100644 --- a/src/net/eathena/markethandler.cpp +++ b/src/net/eathena/markethandler.cpp @@ -31,37 +31,12 @@ extern Net::MarketHandler *marketHandler; namespace EAthena { -MarketHandler::MarketHandler() : - MessageHandler() +MarketHandler::MarketHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_MARKET_OPEN, - SMSG_NPC_MARKET_BUY_ACK, - 0 - }; - handledMessages = _messages; marketHandler = this; MarketRecv::mBuyDialog = nullptr; } -void MarketHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_NPC_MARKET_OPEN: - MarketRecv::processMarketOpen(msg); - break; - - case SMSG_NPC_MARKET_BUY_ACK: - MarketRecv::processMarketBuyAck(msg); - break; - - default: - break; - } -} - void MarketHandler::close() { createOutPacket(CMSG_NPC_MARKET_CLOSE); diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h index aa3db2f7f..30d1eb2b1 100644 --- a/src/net/eathena/markethandler.h +++ b/src/net/eathena/markethandler.h @@ -23,21 +23,16 @@ #include "net/markethandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class MarketHandler final : public MessageHandler, - public Net::MarketHandler +class MarketHandler final : public Net::MarketHandler { public: MarketHandler(); A_DELETE_COPY(MarketHandler) - void handleMessage(Net::MessageIn &msg) override final; - void close() override final; void buyItem(const int itemId, diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index 353777e42..8f6ca2d39 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -35,41 +35,11 @@ extern Net::MercenaryHandler *mercenaryHandler; namespace EAthena { -MercenaryHandler::MercenaryHandler() : - MessageHandler() +MercenaryHandler::MercenaryHandler() { - static const uint16_t _messages[] = - { - SMSG_MERCENARY_UPDATE, - SMSG_MERCENARY_INFO, - SMSG_MERCENARY_SKILLS, - 0 - }; - handledMessages = _messages; mercenaryHandler = this; } -void MercenaryHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_MERCENARY_UPDATE: - MercenaryRecv::processMercenaryUpdate(msg); - break; - - case SMSG_MERCENARY_INFO: - MercenaryRecv::processMercenaryInfo(msg); - break; - - case SMSG_MERCENARY_SKILLS: - MercenaryRecv::processMercenarySkills(msg); - break; - - default: - break; - } -} - void MercenaryHandler::fire() { createOutPacket(CMSG_MERCENARY_ACTION); diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index 9c41e15d3..f95860e31 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -23,20 +23,15 @@ #include "net/mercenaryhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class MercenaryHandler final : public MessageHandler, - public Net::MercenaryHandler +class MercenaryHandler final : public Net::MercenaryHandler { public: MercenaryHandler(); A_DELETE_COPY(MercenaryHandler) - void handleMessage(Net::MessageIn &msg) override final; - void fire() override final; void moveToMaster() const override final; diff --git a/src/net/eathena/messagehandler.cpp b/src/net/eathena/messagehandler.cpp deleted file mode 100644 index f8490ed1d..000000000 --- a/src/net/eathena/messagehandler.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "net/eathena/messagehandler.h" - -#include "net/eathena/network.h" - -#include <cassert> - -#include "debug.h" - -namespace EAthena -{ - -MessageHandler::MessageHandler() : - Net::MessageHandler() -{ -} - -MessageHandler::~MessageHandler() -{ - if (Network::mInstance) - Network::mInstance->unregisterHandler(this); -} - -void MessageHandler::setNetwork(Network *const network) -{ - assert(!(network && Network::mInstance)); -} - -} // namespace EAthena diff --git a/src/net/eathena/messagehandler.h b/src/net/eathena/messagehandler.h deleted file mode 100644 index 4fa35c6a2..000000000 --- a/src/net/eathena/messagehandler.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef NET_EATHENA_MESSAGEHANDLER_H -#define NET_EATHENA_MESSAGEHANDLER_H - -#include "net/messagehandler.h" - -namespace EAthena -{ - -class Network; - -/** - * \ingroup Network - */ -class MessageHandler notfinal : public Net::MessageHandler -{ - public: - MessageHandler(); - - A_DELETE_COPY(MessageHandler) - - virtual ~MessageHandler(); - - void setNetwork(Network *const network); -}; - -typedef MessageHandler* MessageHandlerPtr; - -} // namespace EAthena - -#endif // NET_EATHENA_MESSAGEHANDLER_H diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 33c530989..a45b720b6 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -77,7 +77,6 @@ #include "net/eathena/traderecv.h" #include "net/eathena/vendingrecv.h" -#include "net/eathena/messagehandler.h" #include "net/eathena/messagein.h" #include "net/eathena/protocol.h" @@ -110,22 +109,6 @@ void Network::registerHandlers() #include "net/eathena/recvpackets.inc" } -void Network::registerHandler(MessageHandler *const handler) -{ - if (!handler) - return; - - handler->setNetwork(this); -} - -void Network::unregisterHandler(MessageHandler *const handler) -{ - if (!handler) - return; - - handler->setNetwork(nullptr); -} - void Network::clearHandlers() { } diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index b393f17d8..695d8cea4 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -33,7 +33,6 @@ namespace EAthena { -class MessageHandler; class Network final : public Ea::Network { @@ -44,10 +43,6 @@ class Network final : public Ea::Network ~Network(); - void registerHandler(MessageHandler *const handler); - - void unregisterHandler(MessageHandler *const handler); - void clearHandlers(); bool messageReady(); diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 6ce6afac2..f8e8c1249 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -28,14 +28,15 @@ #include "gui/widgets/createwidget.h" +#include "net/messagein.h" + +#include "net/ea/eaprotocol.h" #include "net/ea/npcrecv.h" #include "net/eathena/messageout.h" #include "net/eathena/npcrecv.h" #include "net/eathena/protocol.h" -#include "net/ea/eaprotocol.h" - #include "debug.h" extern Net::NpcHandler *npcHandler; @@ -44,103 +45,11 @@ namespace EAthena { NpcHandler::NpcHandler() : - MessageHandler(), Ea::NpcHandler() { - static const uint16_t _messages[] = - { - SMSG_NPC_CHOICE, - SMSG_NPC_MESSAGE, - SMSG_NPC_NEXT, - SMSG_NPC_CLOSE, - SMSG_NPC_INT_INPUT, - SMSG_NPC_STR_INPUT, - SMSG_NPC_CUTIN, - SMSG_NPC_VIEWPOINT, - SMSG_NPC_SHOW_PROGRESS_BAR, - SMSG_NPC_CLOSE_TIMEOUT, - SMSG_NPC_COMMAND, - SMSG_NPC_CHANGETITLE, - SMSG_NPC_AREA, - SMSG_NPC_SHOW_DIGIT, - SMSG_NPC_PROGRESS_BAR_ABORT, - 0 - }; - handledMessages = _messages; npcHandler = this; } -void NpcHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_NPC_CHOICE: - Ea::NpcRecv::processNpcChoice(msg); - break; - - case SMSG_NPC_MESSAGE: - Ea::NpcRecv::processNpcMessage(msg); - break; - - case SMSG_NPC_CLOSE: - Ea::NpcRecv::processNpcClose(msg); - break; - - case SMSG_NPC_NEXT: - Ea::NpcRecv::processNpcNext(msg); - break; - - case SMSG_NPC_INT_INPUT: - Ea::NpcRecv::processNpcIntInput(msg); - break; - - case SMSG_NPC_STR_INPUT: - Ea::NpcRecv::processNpcStrInput(msg); - break; - - case SMSG_NPC_CUTIN: - NpcRecv::processNpcCutin(msg); - break; - - case SMSG_NPC_VIEWPOINT: - NpcRecv::processNpcViewPoint(msg); - break; - - case SMSG_NPC_SHOW_PROGRESS_BAR: - NpcRecv::processNpcShowProgressBar(msg); - break; - - case SMSG_NPC_CLOSE_TIMEOUT: - NpcRecv::processNpcCloseTimeout(msg); - break; - - case SMSG_NPC_COMMAND: - Ea::NpcRecv::processNpcCommand(msg); - break; - - case SMSG_NPC_CHANGETITLE: - Ea::NpcRecv::processChangeTitle(msg); - break; - - case SMSG_NPC_AREA: - NpcRecv::processArea(msg); - break; - - case SMSG_NPC_SHOW_DIGIT: - NpcRecv::processShowDigit(msg); - break; - - case SMSG_NPC_PROGRESS_BAR_ABORT: - NpcRecv::processProgressBarAbort(msg); - break; - - default: - break; - } - - Ea::NpcRecv::mDialog = nullptr; -} - void NpcHandler::talk(const BeingId npcId) const { createOutPacket(CMSG_NPC_TALK); diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h index bef960b30..f31225de7 100644 --- a/src/net/eathena/npchandler.h +++ b/src/net/eathena/npchandler.h @@ -25,20 +25,16 @@ #include "net/ea/npchandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class NpcHandler final : public MessageHandler, public Ea::NpcHandler +class NpcHandler final : public Ea::NpcHandler { public: NpcHandler(); A_DELETE_COPY(NpcHandler) - void handleMessage(Net::MessageIn &msg) override final; - void talk(const BeingId npcId) const override final; void nextDialog(const BeingId npcId) const override final; diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index 47bcf7aef..ea672e11a 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -43,26 +43,8 @@ namespace EAthena { PartyHandler::PartyHandler() : - MessageHandler(), Ea::PartyHandler() { - static const uint16_t _messages[] = - { - SMSG_PARTY_CREATE, - SMSG_PARTY_INFO, - SMSG_PARTY_INVITE_RESPONSE, - SMSG_PARTY_INVITED, - SMSG_PARTY_SETTINGS, - SMSG_PARTY_LEAVE, - SMSG_PARTY_UPDATE_COORDS, - SMSG_PARTY_MESSAGE, - SMSG_PARTY_INVITATION_STATS, - SMSG_PARTY_MEMBER_INFO, - SMSG_PARTY_ITEM_PICKUP, - SMSG_PARTY_LEADER, - 0 - }; - handledMessages = _messages; partyHandler = this; } @@ -70,52 +52,6 @@ PartyHandler::~PartyHandler() { } -void PartyHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_PARTY_CREATE: - Ea::PartyRecv::processPartyCreate(msg); - break; - case SMSG_PARTY_INFO: - PartyRecv::processPartyInfo(msg); - break; - case SMSG_PARTY_INVITE_RESPONSE: - PartyRecv::processPartyInviteResponse(msg); - break; - case SMSG_PARTY_INVITED: - PartyRecv::processPartyInvited(msg); - break; - case SMSG_PARTY_SETTINGS: - PartyRecv::processPartySettings(msg); - break; - case SMSG_PARTY_LEAVE: - Ea::PartyRecv::processPartyLeave(msg); - break; - case SMSG_PARTY_UPDATE_COORDS: - Ea::PartyRecv::processPartyUpdateCoords(msg); - break; - case SMSG_PARTY_MESSAGE: - PartyRecv::processPartyMessage(msg); - break; - case SMSG_PARTY_INVITATION_STATS: - PartyRecv::processPartyInvitationStats(msg); - break; - case SMSG_PARTY_MEMBER_INFO: - PartyRecv::processPartyMemberInfo(msg); - break; - case SMSG_PARTY_ITEM_PICKUP: - PartyRecv::processPartyItemPickup(msg); - break; - case SMSG_PARTY_LEADER: - PartyRecv::processPartyLeader(msg); - break; - - default: - break; - } -} - void PartyHandler::create(const std::string &name) const { createOutPacket(CMSG_PARTY_CREATE); diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h index c44b1eee9..2cf3bba1e 100644 --- a/src/net/eathena/partyhandler.h +++ b/src/net/eathena/partyhandler.h @@ -22,14 +22,12 @@ #ifndef NET_EATHENA_PARTYHANDLER_H #define NET_EATHENA_PARTYHANDLER_H -#include "net/eathena/messagehandler.h" - #include "net/ea/partyhandler.h" namespace EAthena { -class PartyHandler final : public MessageHandler, public Ea::PartyHandler +class PartyHandler final : public Ea::PartyHandler { public: PartyHandler(); @@ -38,8 +36,6 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler ~PartyHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void create(const std::string &name) const override final; void invite(const std::string &name) const override final; diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index ea6a0602a..729c0704d 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -35,63 +35,11 @@ extern Net::PetHandler *petHandler; namespace EAthena { -PetHandler::PetHandler() : - MessageHandler() +PetHandler::PetHandler() { - static const uint16_t _messages[] = - { - SMSG_PET_MESSAGE, - SMSG_PET_ROULETTE, - SMSG_PET_EGGS_LIST, - SMSG_PET_DATA, - SMSG_PET_STATUS, - SMSG_PET_FOOD, - SMSG_PET_CATCH_PROCESS, - 0 - }; - handledMessages = _messages; petHandler = this; } -void PetHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("PetHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_PET_MESSAGE: - PetRecv::processPetMessage(msg); - break; - - case SMSG_PET_ROULETTE: - PetRecv::processPetRoulette(msg); - break; - - case SMSG_PET_EGGS_LIST: - PetRecv::processEggsList(msg); - break; - - case SMSG_PET_DATA: - PetRecv::processPetData(msg); - break; - - case SMSG_PET_STATUS: - PetRecv::processPetStatus(msg); - break; - - case SMSG_PET_FOOD: - PetRecv::processPetFood(msg); - break; - - case SMSG_PET_CATCH_PROCESS: - PetRecv::processPetCatchProcess(msg); - break; - - default: - break; - } - BLOCK_END("PetHandler::handleMessage") -} - void PetHandler::move(const int petId A_UNUSED, const int x, const int y) const { diff --git a/src/net/eathena/pethandler.h b/src/net/eathena/pethandler.h index d54901401..2e8dddb05 100644 --- a/src/net/eathena/pethandler.h +++ b/src/net/eathena/pethandler.h @@ -21,22 +21,18 @@ #ifndef NET_EATHENA_PETHANDLER_H #define NET_EATHENA_PETHANDLER_H -#include "net/eathena/messagehandler.h" - #include "net/pethandler.h" namespace EAthena { -class PetHandler final : public MessageHandler, public Net::PetHandler +class PetHandler final : public Net::PetHandler { public: PetHandler(); A_DELETE_COPY(PetHandler) - void handleMessage(Net::MessageIn &msg) override final; - void move(const int petId, const int x, const int y) const override final; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 4779cee4b..7c4bab97a 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -56,167 +56,11 @@ namespace EAthena { PlayerHandler::PlayerHandler() : - MessageHandler(), Ea::PlayerHandler() { - static const uint16_t _messages[] = - { - SMSG_WALK_RESPONSE, - SMSG_PLAYER_WARP, - SMSG_PLAYER_STAT_UPDATE_1, - SMSG_PLAYER_STAT_UPDATE_2, - SMSG_PLAYER_STAT_UPDATE_3, - SMSG_PLAYER_STAT_UPDATE_4, - SMSG_PLAYER_STAT_UPDATE_5, - SMSG_PLAYER_STAT_UPDATE_6, - SMSG_PLAYER_ARROW_MESSAGE, - SMSG_PLAYER_SHORTCUTS, - SMSG_PLAYER_SHOW_EQUIP, - SMSG_PLAYER_GET_EXP, - SMSG_PVP_INFO, - SMSG_PLAYER_HEAL, - SMSG_PLAYER_SKILL_MESSAGE, - SMSG_MAP_MASK, - SMSG_MAP_MUSIC, - SMSG_ONLINE_LIST, - SMSG_PLAYER_NOTIFY_MAPINFO, - SMSG_PLAYER_FAME_BLACKSMITH, - SMSG_PLAYER_FAME_ALCHEMIST, - SMSG_PLAYER_UPGRADE_MESSAGE, - SMSG_PLAYER_FAME_TAEKWON, - SMSG_PLAYER_READ_BOOK, - SMSG_PLAYER_EQUIP_TICK_ACK, - SMSG_AUTOSHADOW_SPELL_LIST, - SMSG_PLAYER_RANK_POINTS, - SMSG_PLAYER_CLIENT_COMMAND, - 0 - }; - handledMessages = _messages; playerHandler = this; } -void PlayerHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_WALK_RESPONSE: - PlayerRecv::processWalkResponse(msg); - break; - - case SMSG_PLAYER_WARP: - Ea::PlayerRecv::processPlayerWarp(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_1: - Ea::PlayerRecv::processPlayerStatUpdate1(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_2: - Ea::PlayerRecv::processPlayerStatUpdate2(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute - Ea::PlayerRecv::processPlayerStatUpdate3(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack - Ea::PlayerRecv::processPlayerStatUpdate4(msg); - break; - - // Updates stats and status points - case SMSG_PLAYER_STAT_UPDATE_5: - PlayerRecv::processPlayerStatUpdate5(msg); - break; - - case SMSG_PLAYER_STAT_UPDATE_6: - Ea::PlayerRecv::processPlayerStatUpdate6(msg); - break; - - case SMSG_PLAYER_ARROW_MESSAGE: - Ea::PlayerRecv::processPlayerArrowMessage(msg); - break; - - case SMSG_PLAYER_SHORTCUTS: - PlayerRecv::processPlayerShortcuts(msg); - break; - - case SMSG_PLAYER_SHOW_EQUIP: - PlayerRecv::processPlayerShowEquip(msg); - break; - - case SMSG_PLAYER_GET_EXP: - PlayerRecv::processPlayerGetExp(msg); - break; - - case SMSG_PVP_INFO: - PlayerRecv::processPvpInfo(msg); - break; - - case SMSG_PLAYER_HEAL: - PlayerRecv::processPlayerHeal(msg); - break; - - case SMSG_PLAYER_SKILL_MESSAGE: - PlayerRecv::processPlayerSkillMessage(msg); - break; - - case SMSG_MAP_MASK: - PlayerRecv::processMapMask(msg); - break; - - case SMSG_MAP_MUSIC: - Ea::PlayerRecv::processMapMusic(msg); - break; - - case SMSG_ONLINE_LIST: - PlayerRecv::processOnlineList(msg); - break; - - case SMSG_PLAYER_NOTIFY_MAPINFO: - PlayerRecv::processNotifyMapInfo(msg); - break; - - case SMSG_PLAYER_FAME_BLACKSMITH: - PlayerRecv::processPlayerFameBlacksmith(msg); - break; - - case SMSG_PLAYER_FAME_ALCHEMIST: - PlayerRecv::processPlayerFameAlchemist(msg); - break; - - case SMSG_PLAYER_UPGRADE_MESSAGE: - PlayerRecv::processPlayerUpgradeMessage(msg); - break; - - case SMSG_PLAYER_FAME_TAEKWON: - PlayerRecv::processPlayerFameTaekwon(msg); - break; - - case SMSG_PLAYER_READ_BOOK: - PlayerRecv::processPlayerReadBook(msg); - break; - - case SMSG_PLAYER_EQUIP_TICK_ACK: - PlayerRecv::processPlayerEquipTickAck(msg); - break; - - case SMSG_AUTOSHADOW_SPELL_LIST: - PlayerRecv::processPlayerAutoShadowSpellList(msg); - break; - - case SMSG_PLAYER_RANK_POINTS: - PlayerRecv::processPlayerRankPoints(msg); - break; - - case SMSG_PLAYER_CLIENT_COMMAND: - PlayerRecv::processPlayerClientCommand(msg); - break; - - default: - break; - } -} - void PlayerHandler::attack(const BeingId id, const Keep keep) const { diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h index 82a060d04..97ac579fc 100644 --- a/src/net/eathena/playerhandler.h +++ b/src/net/eathena/playerhandler.h @@ -25,20 +25,16 @@ #include "net/ea/playerhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler +class PlayerHandler final : public Ea::PlayerHandler { public: PlayerHandler(); A_DELETE_COPY(PlayerHandler) - void handleMessage(Net::MessageIn &msg) override final; - void attack(const BeingId id, const Keep keep) const override final; void stopAttack() const override final; diff --git a/src/net/eathena/playerrecv.h b/src/net/eathena/playerrecv.h index 78ada4d92..76769629f 100644 --- a/src/net/eathena/playerrecv.h +++ b/src/net/eathena/playerrecv.h @@ -25,8 +25,6 @@ #include "net/ea/playerhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { namespace PlayerRecv diff --git a/src/net/eathena/questhandler.cpp b/src/net/eathena/questhandler.cpp index db70958a4..8d92a698e 100644 --- a/src/net/eathena/questhandler.cpp +++ b/src/net/eathena/questhandler.cpp @@ -35,63 +35,11 @@ namespace EAthena { QuestHandler::QuestHandler() : - MessageHandler(), Net::QuestHandler() { - static const uint16_t _messages[] = - { - SMSG_QUEST_ADD, - SMSG_QUEST_LIST, - SMSG_QUEST_LIST_OBJECTIVES, - SMSG_QUEST_UPDATE_OBJECTIVES, - SMSG_QUEST_REMOVE, - SMSG_QUEST_ACTIVATE, - SMSG_QUEST_NPC_EFFECT, - 0 - }; - handledMessages = _messages; questHandler = this; } -void QuestHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("QuestHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_QUEST_ADD: - QuestRecv::processAddQuest(msg); - break; - - case SMSG_QUEST_LIST: - QuestRecv::processAddQuests(msg); - break; - - case SMSG_QUEST_LIST_OBJECTIVES: - QuestRecv::processAddQuestsObjectives(msg); - break; - - case SMSG_QUEST_UPDATE_OBJECTIVES: - QuestRecv::processUpdateQuestsObjectives(msg); - break; - - case SMSG_QUEST_REMOVE: - QuestRecv::processRemoveQuest(msg); - break; - - case SMSG_QUEST_ACTIVATE: - QuestRecv::processActivateQuest(msg); - break; - - case SMSG_QUEST_NPC_EFFECT: - QuestRecv::processNpcQuestEffect(msg); - break; - - default: - break; - } - BLOCK_END("QuestHandler::handleMessage") -} - void QuestHandler::setQeustActiveState(const int questId, const bool active) const { diff --git a/src/net/eathena/questhandler.h b/src/net/eathena/questhandler.h index 2ec83767f..ad26f2d01 100644 --- a/src/net/eathena/questhandler.h +++ b/src/net/eathena/questhandler.h @@ -21,22 +21,18 @@ #ifndef NET_EATHENA_QUESTHANDLER_H #define NET_EATHENA_QUESTHANDLER_H -#include "net/eathena/messagehandler.h" - #include "net/questhandler.h" namespace EAthena { -class QuestHandler final : public MessageHandler, public Net::QuestHandler +class QuestHandler final : public Net::QuestHandler { public: QuestHandler(); A_DELETE_COPY(QuestHandler) - void handleMessage(Net::MessageIn &msg) override final; - void setQeustActiveState(const int questId, const bool active) const override final; }; diff --git a/src/net/eathena/questrecv.cpp b/src/net/eathena/questrecv.cpp index e08d663c9..e89fb83c5 100644 --- a/src/net/eathena/questrecv.cpp +++ b/src/net/eathena/questrecv.cpp @@ -23,6 +23,8 @@ #include "gui/windows/skilldialog.h" #include "gui/windows/questswindow.h" +#include "net/messagein.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" diff --git a/src/net/eathena/questrecv.h b/src/net/eathena/questrecv.h index 7b2e351cb..48a1a7782 100644 --- a/src/net/eathena/questrecv.h +++ b/src/net/eathena/questrecv.h @@ -21,10 +21,13 @@ #ifndef NET_EATHENA_QUESTRECV_H #define NET_EATHENA_QUESTRECV_H -#include "net/eathena/messagehandler.h" - #include "net/questhandler.h" +namespace Net +{ + class MessageIn; +} + namespace EAthena { namespace QuestRecv diff --git a/src/net/eathena/roulettehandler.cpp b/src/net/eathena/roulettehandler.cpp index 32420ca35..0518e99ad 100644 --- a/src/net/eathena/roulettehandler.cpp +++ b/src/net/eathena/roulettehandler.cpp @@ -32,44 +32,9 @@ extern Net::RouletteHandler *rouletteHandler; namespace EAthena { -RouletteHandler::RouletteHandler() : - MessageHandler() +RouletteHandler::RouletteHandler() { - static const uint16_t _messages[] = - { - SMSG_ROULETTE_INFO_ACK_TYPE, - SMSG_ROULETTE_RECV_ITEM_ACK, - SMSG_ROULETTE_GENERATE_ACK_TYPE, - SMSG_ROULETTE_OPEN_ACK, - 0 - }; - handledMessages = _messages; rouletteHandler = this; } -void RouletteHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_ROULETTE_INFO_ACK_TYPE: - RouletteRecv::processRouletteInfoAckType(msg); - break; - - case SMSG_ROULETTE_RECV_ITEM_ACK: - RouletteRecv::processRouletteItemAck(msg); - break; - - case SMSG_ROULETTE_GENERATE_ACK_TYPE: - RouletteRecv::processRouletteGenerateAckType(msg); - break; - - case SMSG_ROULETTE_OPEN_ACK: - RouletteRecv::processRouletteOpenAck(msg); - break; - - default: - break; - } -} - } // namespace EAthena diff --git a/src/net/eathena/roulettehandler.h b/src/net/eathena/roulettehandler.h index 8b69c002f..82ce8810b 100644 --- a/src/net/eathena/roulettehandler.h +++ b/src/net/eathena/roulettehandler.h @@ -23,19 +23,14 @@ #include "net/roulettehandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class RouletteHandler final : public MessageHandler, - public Net::RouletteHandler +class RouletteHandler final : public Net::RouletteHandler { public: RouletteHandler(); A_DELETE_COPY(RouletteHandler) - - void handleMessage(Net::MessageIn &msg) override final; }; } // namespace EAthena diff --git a/src/net/eathena/rouletterecv.cpp b/src/net/eathena/rouletterecv.cpp index 1363cdc47..a9c099473 100644 --- a/src/net/eathena/rouletterecv.cpp +++ b/src/net/eathena/rouletterecv.cpp @@ -22,6 +22,8 @@ #include "logger.h" +#include "net/messagein.h" + #include "net/eathena/protocol.h" #include "debug.h" diff --git a/src/net/eathena/rouletterecv.h b/src/net/eathena/rouletterecv.h index 75b9cc6b2..db336ef10 100644 --- a/src/net/eathena/rouletterecv.h +++ b/src/net/eathena/rouletterecv.h @@ -23,7 +23,10 @@ #include "net/roulettehandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { diff --git a/src/net/eathena/searchstorehandler.cpp b/src/net/eathena/searchstorehandler.cpp index e4225b6ee..8a170cb5d 100644 --- a/src/net/eathena/searchstorehandler.cpp +++ b/src/net/eathena/searchstorehandler.cpp @@ -36,46 +36,11 @@ extern Net::SearchStoreHandler *searchStoreHandler; namespace EAthena { -SearchStoreHandler::SearchStoreHandler() : - MessageHandler() +SearchStoreHandler::SearchStoreHandler() { - static const uint16_t _messages[] = - { - SMSG_SEARCHSTORE_SEARCH_ACK, - SMSG_SEARCHSTORE_SEARCH_FAILED, - SMSG_SEARCHSTORE_OPEN, - SMSG_SEARCHSTORE_CLICK_ACK, - 0 - }; - handledMessages = _messages; searchStoreHandler = this; } -void SearchStoreHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_SEARCHSTORE_SEARCH_ACK: - SearchStoreRecv::processSearchAck(msg); - break; - - case SMSG_SEARCHSTORE_SEARCH_FAILED: - SearchStoreRecv::processSearchFailed(msg); - break; - - case SMSG_SEARCHSTORE_OPEN: - SearchStoreRecv::processSearchOpen(msg); - break; - - case SMSG_SEARCHSTORE_CLICK_ACK: - SearchStoreRecv::processSearchClickAck(msg); - break; - - default: - break; - } -} - void SearchStoreHandler::search(const StoreSearchTypeT type, const int minPrice, const int maxPrice, diff --git a/src/net/eathena/searchstorehandler.h b/src/net/eathena/searchstorehandler.h index 121651b3d..6b2db04fc 100644 --- a/src/net/eathena/searchstorehandler.h +++ b/src/net/eathena/searchstorehandler.h @@ -23,20 +23,15 @@ #include "net/searchstorehandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class SearchStoreHandler final : public MessageHandler, - public Net::SearchStoreHandler +class SearchStoreHandler final : public Net::SearchStoreHandler { public: SearchStoreHandler(); A_DELETE_COPY(SearchStoreHandler) - void handleMessage(Net::MessageIn &msg) override final; - void search(const StoreSearchTypeT type, const int minPrice, const int maxPrice, diff --git a/src/net/eathena/searchstorerecv.cpp b/src/net/eathena/searchstorerecv.cpp index a409ea586..cba23cdfc 100644 --- a/src/net/eathena/searchstorerecv.cpp +++ b/src/net/eathena/searchstorerecv.cpp @@ -25,6 +25,8 @@ #include "enums/resources/notifytypes.h" +#include "net/messagein.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" diff --git a/src/net/eathena/searchstorerecv.h b/src/net/eathena/searchstorerecv.h index 582f57431..50005530b 100644 --- a/src/net/eathena/searchstorerecv.h +++ b/src/net/eathena/searchstorerecv.h @@ -23,7 +23,10 @@ #include "net/searchstorehandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 0302f36aa..a1e29df53 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -51,116 +51,11 @@ namespace EAthena { SkillHandler::SkillHandler() : - MessageHandler(), Ea::SkillHandler() { - static const uint16_t _messages[] = - { - SMSG_PLAYER_SKILLS, - SMSG_SKILL_FAILED, - SMSG_PLAYER_SKILL_UP, - SMSG_PLAYER_SKILL_COOLDOWN, - SMSG_PLAYER_SKILL_COOLDOWN_LIST, - SMSG_SKILL_SNAP, - SMSG_PLAYER_ADD_SKILL, - SMSG_PLAYER_DELETE_SKILL, - SMSG_PLAYER_UPDATE_SKILL, - SMSG_SKILL_WARP_POINT, - SMSG_SKILL_MEMO_MESSAGE, - SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST, - SMSG_PLAYER_SKILL_PRODUCE_EFFECT, - SMSG_SKILL_UNIT_UPDATE, - SMSG_SKILL_ARROW_CREATE_LIST, - SMSG_PLAYER_SKILL_AUTO_SPELLS, - SMSG_SKILL_DEVOTION_EFFECT, - SMSG_SKILL_ITEM_LIST_WINDOW, - 0 - }; - handledMessages = _messages; skillHandler = this; } -void SkillHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_PLAYER_SKILLS: - SkillRecv::processPlayerSkills(msg); - break; - - case SMSG_PLAYER_SKILL_UP: - Ea::SkillRecv::processPlayerSkillUp(msg); - break; - - case SMSG_SKILL_FAILED: - SkillRecv::processSkillFailed(msg); - break; - - case SMSG_PLAYER_SKILL_COOLDOWN: - SkillRecv::processSkillCoolDown(msg); - break; - - case SMSG_PLAYER_SKILL_COOLDOWN_LIST: - SkillRecv::processSkillCoolDownList(msg); - break; - - case SMSG_SKILL_SNAP: - SkillRecv::processSkillSnap(msg); - break; - - case SMSG_PLAYER_ADD_SKILL: - SkillRecv::processSkillAdd(msg); - break; - - case SMSG_PLAYER_UPDATE_SKILL: - SkillRecv::processSkillUpdate(msg); - break; - - case SMSG_PLAYER_DELETE_SKILL: - SkillRecv::processSkillDelete(msg); - break; - - case SMSG_SKILL_WARP_POINT: - SkillRecv::processSkillWarpPoint(msg); - break; - - case SMSG_SKILL_MEMO_MESSAGE: - SkillRecv::processSkillMemoMessage(msg); - break; - - case SMSG_PLAYER_SKILL_PRODUCE_MIX_LIST: - SkillRecv::processSkillProduceMixList(msg); - break; - - case SMSG_PLAYER_SKILL_PRODUCE_EFFECT: - SkillRecv::processSkillProduceEffect(msg); - break; - - case SMSG_SKILL_UNIT_UPDATE: - SkillRecv::processSkillUnitUpdate(msg); - break; - - case SMSG_SKILL_ARROW_CREATE_LIST: - SkillRecv::processSkillArrowCreateList(msg); - break; - - case SMSG_PLAYER_SKILL_AUTO_SPELLS: - SkillRecv::processSkillAutoSpells(msg); - break; - - case SMSG_SKILL_DEVOTION_EFFECT: - SkillRecv::processSkillDevotionEffect(msg); - break; - - case SMSG_SKILL_ITEM_LIST_WINDOW: - SkillRecv::processSkillItemListWindow(msg); - break; - - default: - break; - } -} - void SkillHandler::useBeing(const int id, const int level, const BeingId beingId) const { diff --git a/src/net/eathena/skillhandler.h b/src/net/eathena/skillhandler.h index 6ff52c7ef..aab407550 100644 --- a/src/net/eathena/skillhandler.h +++ b/src/net/eathena/skillhandler.h @@ -25,20 +25,16 @@ #include "net/ea/skillhandler.h" -#include "net/eathena/messagehandler.h" - namespace EAthena { -class SkillHandler final : public MessageHandler, public Ea::SkillHandler +class SkillHandler final : public Ea::SkillHandler { public: SkillHandler(); A_DELETE_COPY(SkillHandler) - void handleMessage(Net::MessageIn &msg) override final; - void useBeing(const int id, const int level, const BeingId beingId) const override final; diff --git a/src/net/eathena/skillrecv.cpp b/src/net/eathena/skillrecv.cpp index acbabff14..9a36d5db5 100644 --- a/src/net/eathena/skillrecv.cpp +++ b/src/net/eathena/skillrecv.cpp @@ -33,6 +33,8 @@ #include "gui/windows/skilldialog.h" +#include "net/messagein.h" + #include "net/ea/skillrecv.h" #include "net/eathena/menu.h" diff --git a/src/net/eathena/skillrecv.h b/src/net/eathena/skillrecv.h index 532d15cce..a968910de 100644 --- a/src/net/eathena/skillrecv.h +++ b/src/net/eathena/skillrecv.h @@ -25,7 +25,10 @@ #include "net/ea/skillhandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index 082b3bf60..d0dfe207f 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -48,69 +48,13 @@ extern Net::TradeHandler *tradeHandler; namespace EAthena { TradeHandler::TradeHandler() : - MessageHandler(), Ea::TradeHandler() { - static const uint16_t _messages[] = - { - SMSG_TRADE_REQUEST, - SMSG_TRADE_RESPONSE, - SMSG_TRADE_ITEM_ADD, - SMSG_TRADE_ITEM_ADD_RESPONSE, - SMSG_TRADE_OK, - SMSG_TRADE_CANCEL, - SMSG_TRADE_COMPLETE, - SMSG_TRADE_UNDO, - 0 - }; - handledMessages = _messages; tradeHandler = this; TradeRecv::mItemIndex = -1; TradeRecv::mQuantity = 0; } - -void TradeHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_TRADE_REQUEST: - TradeRecv::processTradeRequest(msg); - break; - - case SMSG_TRADE_RESPONSE: - TradeRecv::processTradeResponse(msg); - break; - - case SMSG_TRADE_ITEM_ADD: - TradeRecv::processTradeItemAdd(msg); - break; - - case SMSG_TRADE_ITEM_ADD_RESPONSE: - TradeRecv::processTradeItemAddResponse(msg); - break; - - case SMSG_TRADE_OK: - Ea::TradeRecv::processTradeOk(msg); - break; - - case SMSG_TRADE_CANCEL: - Ea::TradeRecv::processTradeCancel(msg); - break; - - case SMSG_TRADE_COMPLETE: - Ea::TradeRecv::processTradeComplete(msg); - break; - - case SMSG_TRADE_UNDO: - TradeRecv::processTradeUndo(msg); - break; - - default: - break; - } -} - void TradeHandler::request(const Being *const being) const { if (!being) diff --git a/src/net/eathena/tradehandler.h b/src/net/eathena/tradehandler.h index de35eb9dd..96029fdd2 100644 --- a/src/net/eathena/tradehandler.h +++ b/src/net/eathena/tradehandler.h @@ -25,20 +25,21 @@ #include "net/ea/tradehandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { -class TradeHandler final : public MessageHandler, public Ea::TradeHandler +class TradeHandler final : public Ea::TradeHandler { public: TradeHandler(); A_DELETE_COPY(TradeHandler) - void handleMessage(Net::MessageIn &msg) override final; - void request(const Being *const being) const override final; void respond(const bool accept) const override final; diff --git a/src/net/eathena/traderecv.cpp b/src/net/eathena/traderecv.cpp index 6f19302a8..b9ec536e9 100644 --- a/src/net/eathena/traderecv.cpp +++ b/src/net/eathena/traderecv.cpp @@ -33,13 +33,14 @@ #include "gui/windows/tradewindow.h" +#include "net/messagein.h" + +#include "net/ea/eaprotocol.h" #include "net/ea/traderecv.h" #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" -#include "net/ea/eaprotocol.h" - #include "debug.h" extern Net::TradeHandler *tradeHandler; diff --git a/src/net/eathena/traderecv.h b/src/net/eathena/traderecv.h index dfbeff737..9599cc3a0 100644 --- a/src/net/eathena/traderecv.h +++ b/src/net/eathena/traderecv.h @@ -25,7 +25,10 @@ #include "net/ea/tradehandler.h" -#include "net/eathena/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace EAthena { diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp index 5d0724f12..d8a3f72b7 100644 --- a/src/net/eathena/vendinghandler.cpp +++ b/src/net/eathena/vendinghandler.cpp @@ -34,6 +34,8 @@ #include "listeners/vendingmodelistener.h" #include "listeners/vendingslotslistener.h" +#include "net/messagein.h" + #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" @@ -47,67 +49,12 @@ extern Net::VendingHandler *vendingHandler; namespace EAthena { -VendingHandler::VendingHandler() : - MessageHandler() +VendingHandler::VendingHandler() { - static const uint16_t _messages[] = - { - SMSG_VENDING_OPEN_REQ, - SMSG_VENDING_SHOW_BOARD, - SMSG_VENDING_HIDE_BOARD, - SMSG_VENDING_ITEMS_LIST, - SMSG_VENDING_BUY_ACK, - SMSG_VENDING_OPEN, - SMSG_VENDING_REPORT, - SMSG_VENDING_OPEN_STATUS, - 0 - }; - handledMessages = _messages; vendingHandler = this; VendingRecv::mBuyDialog = nullptr; } -void VendingHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_VENDING_OPEN_REQ: - VendingRecv::processOpenReq(msg); - break; - - case SMSG_VENDING_SHOW_BOARD: - VendingRecv::processShowBoard(msg); - break; - - case SMSG_VENDING_HIDE_BOARD: - VendingRecv::processHideBoard(msg); - break; - - case SMSG_VENDING_ITEMS_LIST: - VendingRecv::processItemsList(msg); - break; - - case SMSG_VENDING_BUY_ACK: - VendingRecv::processBuyAck(msg); - break; - - case SMSG_VENDING_OPEN: - VendingRecv::processOpen(msg); - break; - - case SMSG_VENDING_REPORT: - VendingRecv::processReport(msg); - break; - - case SMSG_VENDING_OPEN_STATUS: - VendingRecv::processOpenStatus(msg); - break; - - default: - break; - } -} - void VendingHandler::close() const { createOutPacket(CMSG_VENDING_CLOSE); diff --git a/src/net/eathena/vendinghandler.h b/src/net/eathena/vendinghandler.h index 15a794719..b08a7a292 100644 --- a/src/net/eathena/vendinghandler.h +++ b/src/net/eathena/vendinghandler.h @@ -23,22 +23,17 @@ #include "net/vendinghandler.h" -#include "net/eathena/messagehandler.h" - class BuyDialog; namespace EAthena { -class VendingHandler final : public MessageHandler, - public Net::VendingHandler +class VendingHandler final : public Net::VendingHandler { public: VendingHandler(); A_DELETE_COPY(VendingHandler) - void handleMessage(Net::MessageIn &msg) override final; - void close() const override final; void open(const Being *const being) const override final; diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp index d1a81fdb4..6195b2724 100644 --- a/src/net/eathena/vendingrecv.cpp +++ b/src/net/eathena/vendingrecv.cpp @@ -34,6 +34,8 @@ #include "listeners/vendingmodelistener.h" #include "listeners/vendingslotslistener.h" +#include "net/messagein.h" + #include "net/ea/eaprotocol.h" #include "net/eathena/messageout.h" diff --git a/src/net/eathena/vendingrecv.h b/src/net/eathena/vendingrecv.h index 74c3f9c78..815b18329 100644 --- a/src/net/eathena/vendingrecv.h +++ b/src/net/eathena/vendingrecv.h @@ -23,10 +23,13 @@ #include "net/vendinghandler.h" -#include "net/eathena/messagehandler.h" - class BuyDialog; +namespace Net +{ + class MessageIn; +} + namespace EAthena { namespace VendingRecv |