From 84d2bab38202cd52b5eb0a37c12204ab6f607915 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 2 Sep 2015 20:58:41 +0300 Subject: Remove MessageHandler class --- src/CMakeLists.txt | 5 - src/Makefile.am | 5 - src/net/beinghandler.h | 2 - src/net/buysellhandler.h | 2 - src/net/eathena/adminhandler.cpp | 31 --- src/net/eathena/adminhandler.h | 6 +- src/net/eathena/auctionhandler.cpp | 42 +--- src/net/eathena/auctionhandler.h | 6 +- src/net/eathena/bankhandler.cpp | 32 +-- src/net/eathena/bankhandler.h | 7 +- src/net/eathena/battlegroundhandler.cpp | 57 +----- src/net/eathena/battlegroundhandler.h | 7 +- src/net/eathena/beinghandler.cpp | 344 -------------------------------- src/net/eathena/beinghandler.h | 6 +- src/net/eathena/buyingstorehandler.cpp | 67 +------ src/net/eathena/buyingstorehandler.h | 7 +- src/net/eathena/buysellhandler.cpp | 40 ---- src/net/eathena/buysellhandler.h | 6 +- src/net/eathena/cashshophandler.cpp | 47 +---- src/net/eathena/cashshophandler.h | 7 +- src/net/eathena/charserverhandler.cpp | 110 ---------- src/net/eathena/charserverhandler.h | 7 +- src/net/eathena/chathandler.cpp | 177 ---------------- src/net/eathena/chathandler.h | 6 +- src/net/eathena/elementalhandler.cpp | 27 +-- src/net/eathena/elementalhandler.h | 7 +- src/net/eathena/familyhandler.cpp | 37 +--- src/net/eathena/familyhandler.h | 7 +- src/net/eathena/friendshandler.cpp | 42 +--- src/net/eathena/friendshandler.h | 7 +- src/net/eathena/gamehandler.cpp | 50 ----- src/net/eathena/gamehandler.h | 6 +- src/net/eathena/generalhandler.cpp | 31 +-- src/net/eathena/generalhandler.h | 108 ++++++---- src/net/eathena/guildhandler.cpp | 158 +-------------- src/net/eathena/guildhandler.h | 6 +- src/net/eathena/homunculushandler.cpp | 42 +--- src/net/eathena/homunculushandler.h | 7 +- src/net/eathena/inventoryhandler.cpp | 215 -------------------- src/net/eathena/inventoryhandler.h | 7 +- src/net/eathena/itemhandler.cpp | 50 ----- src/net/eathena/itemhandler.h | 6 +- src/net/eathena/loginhandler.cpp | 50 ----- src/net/eathena/loginhandler.h | 6 +- src/net/eathena/mailhandler.cpp | 62 +----- src/net/eathena/mailhandler.h | 6 +- src/net/eathena/maphandler.cpp | 37 +--- src/net/eathena/maphandler.h | 9 +- src/net/eathena/markethandler.cpp | 27 +-- src/net/eathena/markethandler.h | 7 +- src/net/eathena/mercenaryhandler.cpp | 32 +-- src/net/eathena/mercenaryhandler.h | 7 +- src/net/eathena/messagehandler.cpp | 50 ----- src/net/eathena/messagehandler.h | 52 ----- src/net/eathena/network.cpp | 17 -- src/net/eathena/network.h | 5 - src/net/eathena/npchandler.cpp | 97 +-------- src/net/eathena/npchandler.h | 6 +- src/net/eathena/partyhandler.cpp | 64 ------ src/net/eathena/partyhandler.h | 6 +- src/net/eathena/pethandler.cpp | 54 +---- src/net/eathena/pethandler.h | 6 +- src/net/eathena/playerhandler.cpp | 156 --------------- src/net/eathena/playerhandler.h | 6 +- src/net/eathena/playerrecv.h | 2 - src/net/eathena/questhandler.cpp | 52 ----- src/net/eathena/questhandler.h | 6 +- src/net/eathena/questrecv.cpp | 2 + src/net/eathena/questrecv.h | 7 +- src/net/eathena/roulettehandler.cpp | 37 +--- src/net/eathena/roulettehandler.h | 7 +- src/net/eathena/rouletterecv.cpp | 2 + src/net/eathena/rouletterecv.h | 5 +- src/net/eathena/searchstorehandler.cpp | 37 +--- src/net/eathena/searchstorehandler.h | 7 +- src/net/eathena/searchstorerecv.cpp | 2 + src/net/eathena/searchstorerecv.h | 5 +- src/net/eathena/skillhandler.cpp | 105 ---------- src/net/eathena/skillhandler.h | 6 +- src/net/eathena/skillrecv.cpp | 2 + src/net/eathena/skillrecv.h | 5 +- src/net/eathena/tradehandler.cpp | 56 ------ src/net/eathena/tradehandler.h | 9 +- src/net/eathena/traderecv.cpp | 5 +- src/net/eathena/traderecv.h | 5 +- src/net/eathena/vendinghandler.cpp | 59 +----- src/net/eathena/vendinghandler.h | 7 +- src/net/eathena/vendingrecv.cpp | 2 + src/net/eathena/vendingrecv.h | 7 +- src/net/messagehandler.h | 56 ------ src/net/net.cpp | 1 + src/net/tmwa/adminhandler.cpp | 22 -- src/net/tmwa/adminhandler.h | 9 +- src/net/tmwa/auctionhandler.cpp | 12 +- src/net/tmwa/auctionhandler.h | 6 +- src/net/tmwa/bankhandler.cpp | 12 +- src/net/tmwa/bankhandler.h | 7 +- src/net/tmwa/battlegroundhandler.cpp | 12 +- src/net/tmwa/battlegroundhandler.h | 7 +- src/net/tmwa/beinghandler.cpp | 166 --------------- src/net/tmwa/beinghandler.h | 6 +- src/net/tmwa/buyingstorehandler.cpp | 12 +- src/net/tmwa/buyingstorehandler.h | 7 +- src/net/tmwa/buysellhandler.cpp | 42 ---- src/net/tmwa/buysellhandler.h | 6 +- src/net/tmwa/cashshophandler.cpp | 12 +- src/net/tmwa/cashshophandler.h | 7 +- src/net/tmwa/charserverhandler.cpp | 57 ------ src/net/tmwa/charserverhandler.h | 7 +- src/net/tmwa/charserverrecv.cpp | 1 + src/net/tmwa/chathandler.cpp | 59 ------ src/net/tmwa/chathandler.h | 6 +- src/net/tmwa/elementalhandler.cpp | 17 +- src/net/tmwa/elementalhandler.h | 18 +- src/net/tmwa/familyhandler.cpp | 12 +- src/net/tmwa/familyhandler.h | 7 +- src/net/tmwa/friendshandler.cpp | 17 +- src/net/tmwa/friendshandler.h | 7 +- src/net/tmwa/gamehandler.cpp | 43 ---- src/net/tmwa/gamehandler.h | 6 +- src/net/tmwa/generalhandler.cpp | 25 +-- src/net/tmwa/generalhandler.h | 112 +++++++---- src/net/tmwa/guildhandler.cpp | 153 +------------- src/net/tmwa/guildhandler.h | 6 +- src/net/tmwa/homunculushandler.cpp | 12 +- src/net/tmwa/homunculushandler.h | 7 +- src/net/tmwa/inventoryhandler.cpp | 97 --------- src/net/tmwa/inventoryhandler.h | 7 +- src/net/tmwa/itemhandler.cpp | 32 --- src/net/tmwa/itemhandler.h | 6 +- src/net/tmwa/loginhandler.cpp | 42 ---- src/net/tmwa/loginhandler.h | 6 +- src/net/tmwa/mailhandler.cpp | 12 +- src/net/tmwa/mailhandler.h | 6 +- src/net/tmwa/maphandler.cpp | 12 +- src/net/tmwa/maphandler.h | 8 +- src/net/tmwa/markethandler.cpp | 17 +- src/net/tmwa/markethandler.h | 7 +- src/net/tmwa/mercenaryhandler.cpp | 12 +- src/net/tmwa/mercenaryhandler.h | 7 +- src/net/tmwa/messagehandler.cpp | 50 ----- src/net/tmwa/messagehandler.h | 52 ----- src/net/tmwa/network.cpp | 17 -- src/net/tmwa/network.h | 6 - src/net/tmwa/npchandler.cpp | 63 +----- src/net/tmwa/npchandler.h | 6 +- src/net/tmwa/partyhandler.cpp | 58 ------ src/net/tmwa/partyhandler.h | 6 +- src/net/tmwa/pethandler.cpp | 12 -- src/net/tmwa/pethandler.h | 6 +- src/net/tmwa/playerhandler.cpp | 68 ------- src/net/tmwa/playerhandler.h | 6 +- src/net/tmwa/playerrecv.h | 2 - src/net/tmwa/questhandler.cpp | 27 --- src/net/tmwa/questhandler.h | 7 +- src/net/tmwa/questrecv.cpp | 2 + src/net/tmwa/questrecv.h | 7 +- src/net/tmwa/roulettehandler.cpp | 17 +- src/net/tmwa/roulettehandler.h | 7 +- src/net/tmwa/searchstorehandler.cpp | 17 +- src/net/tmwa/searchstorehandler.h | 7 +- src/net/tmwa/skillhandler.cpp | 32 --- src/net/tmwa/skillhandler.h | 6 +- src/net/tmwa/skillrecv.cpp | 2 + src/net/tmwa/skillrecv.h | 5 +- src/net/tmwa/tradehandler.cpp | 53 ----- src/net/tmwa/tradehandler.h | 6 +- src/net/tmwa/traderecv.cpp | 5 +- src/net/tmwa/traderecv.h | 2 - src/net/tmwa/vendinghandler.cpp | 12 +- src/net/tmwa/vendinghandler.h | 7 +- 171 files changed, 330 insertions(+), 4528 deletions(-) delete mode 100644 src/net/eathena/messagehandler.cpp delete mode 100644 src/net/eathena/messagehandler.h delete mode 100644 src/net/messagehandler.h delete mode 100644 src/net/tmwa/messagehandler.cpp delete mode 100644 src/net/tmwa/messagehandler.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 361253d05..a91afbc07 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -545,7 +545,6 @@ SET(SRCS net/ea/inventoryitem.h net/logindata.h net/loginhandler.h - net/messagehandler.h net/messagein.cpp net/messagein.h net/messageout.cpp @@ -1459,8 +1458,6 @@ SET(SRCS_TMWA net/tmwa/loginhandler.h net/tmwa/loginrecv.cpp net/tmwa/loginrecv.h - net/tmwa/messagehandler.cpp - net/tmwa/messagehandler.h net/tmwa/messagein.cpp net/tmwa/messagein.h net/tmwa/messageout.cpp @@ -1680,8 +1677,6 @@ SET(SRCS_EATHENA net/eathena/mercenaryhandler.h net/eathena/mercenaryrecv.cpp net/eathena/mercenaryrecv.h - net/eathena/messagehandler.cpp - net/eathena/messagehandler.h net/eathena/messagein.cpp net/eathena/messagein.h net/eathena/messageout.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 5893fca1d..5d40b4c18 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1154,7 +1154,6 @@ manaplus_SOURCES += main.cpp \ net/ea/inventoryitem.h \ net/logindata.h \ net/loginhandler.h \ - net/messagehandler.h \ net/messagein.cpp \ net/messagein.h \ net/messageout.cpp \ @@ -1302,8 +1301,6 @@ manaplus_SOURCES += \ net/tmwa/loginhandler.h \ net/tmwa/loginrecv.cpp \ net/tmwa/loginrecv.h \ - net/tmwa/messagehandler.cpp \ - net/tmwa/messagehandler.h \ net/tmwa/messagein.cpp \ net/tmwa/messagein.h \ net/tmwa/messageout.cpp \ @@ -1526,8 +1523,6 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \ net/eathena/mercenaryhandler.h \ net/eathena/mercenaryrecv.cpp \ net/eathena/mercenaryrecv.h \ - net/eathena/messagehandler.cpp \ - net/eathena/messagehandler.h \ net/eathena/messagein.cpp \ net/eathena/messagein.h \ net/eathena/messageout.cpp \ diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index e79f26bb3..a3c7cc2f6 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -37,8 +37,6 @@ class BeingHandler notfinal virtual ~BeingHandler() { } - virtual void handleMessage(Net::MessageIn &msg) = 0; - virtual void requestNameById(const BeingId id) const = 0; virtual void undress(Being *const being) const = 0; diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h index ebb42d2a4..ef089885b 100644 --- a/src/net/buysellhandler.h +++ b/src/net/buysellhandler.h @@ -36,8 +36,6 @@ class BuySellHandler notfinal virtual ~BuySellHandler() { } - virtual void handleMessage(Net::MessageIn &msg) = 0; - virtual void requestSellList(const std::string &nick) const = 0; virtual void requestBuyList(const std::string &nick) const = 0; 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 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 . - */ - -#include "net/eathena/messagehandler.h" - -#include "net/eathena/network.h" - -#include - -#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 . - */ - -#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 diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h deleted file mode 100644 index 0d13053c5..000000000 --- a/src/net/messagehandler.h +++ /dev/null @@ -1,56 +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 . - */ - -#ifndef NET_MESSAGEHANDLER_H -#define NET_MESSAGEHANDLER_H - -#include "net/messagein.h" - -namespace Net -{ - -/** - * \ingroup Network - */ -class MessageHandler notfinal -{ - public: - const uint16_t *handledMessages; - - virtual void handleMessage(MessageIn &msg) = 0; - - - A_DELETE_COPY(MessageHandler) - - virtual ~MessageHandler() - { } - - protected: - MessageHandler() : - handledMessages(nullptr) - { - } -}; - -} // namespace Net - -#endif // NET_MESSAGEHANDLER_H diff --git a/src/net/net.cpp b/src/net/net.cpp index 9b31499dd..e706680de 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -66,6 +66,7 @@ namespace Net class GameHandler; class GuildHandler; class InventoryHandler; + class ItemHandler; class NpcHandler; class PartyHandler; class PetHandler; diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 834a29c43..fa2f012f1 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -41,33 +41,11 @@ namespace TmwAthena { AdminHandler::AdminHandler() : - MessageHandler(), Ea::AdminHandler() { - static const uint16_t _messages[] = - { - SMSG_ADMIN_KICK_ACK, - 0 - }; - handledMessages = _messages; adminHandler = this; } -void AdminHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("AdminHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_ADMIN_KICK_ACK: - Ea::AdminRecv::processKickAck(msg); - break; - - default: - break; - } - BLOCK_END("AdminHandler::handleMessage") -} - void AdminHandler::announce(const std::string &text) const { createOutPacket(CMSG_ADMIN_ANNOUNCE); diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index a98d6d850..7fa28ce2b 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -25,20 +25,21 @@ #include "net/ea/adminhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { -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/tmwa/auctionhandler.cpp b/src/net/tmwa/auctionhandler.cpp index e63b76a00..91fa7116f 100644 --- a/src/net/tmwa/auctionhandler.cpp +++ b/src/net/tmwa/auctionhandler.cpp @@ -27,21 +27,11 @@ extern Net::AuctionHandler *auctionHandler; namespace TmwAthena { -AuctionHandler::AuctionHandler() : - MessageHandler() +AuctionHandler::AuctionHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; auctionHandler = this; } -void AuctionHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void AuctionHandler::cancelReg() const { } diff --git a/src/net/tmwa/auctionhandler.h b/src/net/tmwa/auctionhandler.h index 5df04b778..d4acb42b4 100644 --- a/src/net/tmwa/auctionhandler.h +++ b/src/net/tmwa/auctionhandler.h @@ -25,19 +25,15 @@ #include "net/auctionhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/bankhandler.cpp b/src/net/tmwa/bankhandler.cpp index 946f2e806..2126536d4 100644 --- a/src/net/tmwa/bankhandler.cpp +++ b/src/net/tmwa/bankhandler.cpp @@ -27,21 +27,11 @@ extern Net::BankHandler *bankHandler; namespace TmwAthena { -BankHandler::BankHandler() : - MessageHandler() +BankHandler::BankHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; bankHandler = this; } -void BankHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BankHandler::deposit(const int money A_UNUSED) const { } diff --git a/src/net/tmwa/bankhandler.h b/src/net/tmwa/bankhandler.h index b56c03c86..dfa9fbb1f 100644 --- a/src/net/tmwa/bankhandler.h +++ b/src/net/tmwa/bankhandler.h @@ -25,21 +25,16 @@ #include "net/bankhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/battlegroundhandler.cpp b/src/net/tmwa/battlegroundhandler.cpp index 31dbc1006..09261ba69 100644 --- a/src/net/tmwa/battlegroundhandler.cpp +++ b/src/net/tmwa/battlegroundhandler.cpp @@ -27,21 +27,11 @@ extern Net::BattleGroundHandler *battleGroundHandler; namespace TmwAthena { -BattleGroundHandler::BattleGroundHandler() : - MessageHandler() +BattleGroundHandler::BattleGroundHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; battleGroundHandler = this; } -void BattleGroundHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BattleGroundHandler::registerBg(const BattleGroundTypeT &type A_UNUSED, const std::string &name A_UNUSED) const diff --git a/src/net/tmwa/battlegroundhandler.h b/src/net/tmwa/battlegroundhandler.h index 1755bb980..63687fad9 100644 --- a/src/net/tmwa/battlegroundhandler.h +++ b/src/net/tmwa/battlegroundhandler.h @@ -25,21 +25,16 @@ #include "net/battlegroundhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index cf0df34e4..b3529b53c 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -38,44 +38,8 @@ namespace TmwAthena { 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_SKILL_DAMAGE, - SMSG_BEING_ACTION, - SMSG_BEING_SELFEFFECT, - SMSG_BEING_EMOTION, - SMSG_BEING_CHANGE_LOOKS, - SMSG_BEING_CHANGE_LOOKS2, - SMSG_BEING_NAME_RESPONSE, - SMSG_PLAYER_GUILD_PARTY_INFO, - SMSG_BEING_CHANGE_DIRECTION, - SMSG_PLAYER_UPDATE_1, - SMSG_PLAYER_UPDATE_2, - SMSG_PLAYER_MOVE, - SMSG_PLAYER_STOP, - SMSG_PLAYER_MOVE_TO_ATTACK, - SMSG_PLAYER_STATUS_CHANGE, - SMSG_BEING_STATUS_CHANGE, - SMSG_BEING_RESURRECT, - SMSG_SOLVE_CHAR_NAME, - SMSG_BEING_SPAWN, - SMSG_SKILL_CASTING, - SMSG_SKILL_CAST_CANCEL, - SMSG_SKILL_NO_DAMAGE, - SMSG_BEING_IP_RESPONSE, - SMSG_PVP_MAP_MODE, - SMSG_PVP_SET, - SMSG_BEING_MOVE3, - 0 - }; - handledMessages = _messages; beingHandler = this; } @@ -85,136 +49,6 @@ void BeingHandler::requestNameById(const BeingId id) const outMsg.writeBeingId(id, "being id"); } -void BeingHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("BeingHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_BEING_VISIBLE: - BeingRecv::processBeingVisible(msg); - break; - - case SMSG_BEING_MOVE: - BeingRecv::processBeingMove(msg); - break; - - case SMSG_BEING_MOVE2: - BeingRecv::processBeingMove2(msg); - break; - - case SMSG_BEING_MOVE3: - Ea::BeingRecv::processBeingMove3(msg); - break; - - case SMSG_BEING_SPAWN: - BeingRecv::processBeingSpawn(msg); - break; - - case SMSG_BEING_REMOVE: - Ea::BeingRecv::processBeingRemove(msg); - break; - - case SMSG_BEING_RESURRECT: - BeingRecv::processBeingResurrect(msg); - break; - - case SMSG_SKILL_DAMAGE: - Ea::BeingRecv::processSkillDamage(msg); - break; - - case SMSG_BEING_ACTION: - Ea::BeingRecv::processBeingAction(msg); - break; - - case SMSG_BEING_SELFEFFECT: - BeingRecv::processBeingSelfEffect(msg); - break; - - case SMSG_BEING_EMOTION: - Ea::BeingRecv::processBeingEmotion(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS: - BeingRecv::processBeingChangeLook(msg); - break; - - case SMSG_BEING_CHANGE_LOOKS2: - BeingRecv::processBeingChangeLook2(msg); - break; - - case SMSG_BEING_NAME_RESPONSE: - Ea::BeingRecv::processNameResponse(msg); - break; - - case SMSG_BEING_IP_RESPONSE: - BeingRecv::processIpResponse(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_UPDATE_1: - BeingRecv::processPlayerUpdate1(msg); - break; - - case SMSG_PLAYER_UPDATE_2: - BeingRecv::processPlayerUpdate2(msg); - break; - - case SMSG_PLAYER_MOVE: - BeingRecv::processPlayerMove(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_BEING_STATUS_CHANGE: - BeingRecv::processBeingStatusChange(msg); - break; - - case SMSG_SKILL_CASTING: - BeingRecv::processSkillCasting(msg); - break; - - case SMSG_SKILL_CAST_CANCEL: - BeingRecv::processSkillCastCancel(msg); - break; - - case SMSG_SKILL_NO_DAMAGE: - Ea::BeingRecv::processSkillNoDamage(msg); - break; - - case SMSG_PVP_MAP_MODE: - Ea::BeingRecv::processPvpMapMode(msg); - break; - - case SMSG_PVP_SET: - BeingRecv::processPvpSet(msg); - break; - - default: - break; - } - BLOCK_END("BeingHandler::handleMessage") -} - void BeingHandler::undress(Being *const being) const { if (!being) diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index a11415531..1776ddd96 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -25,20 +25,16 @@ #include "net/ea/beinghandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/buyingstorehandler.cpp b/src/net/tmwa/buyingstorehandler.cpp index 245775c24..53fc45858 100644 --- a/src/net/tmwa/buyingstorehandler.cpp +++ b/src/net/tmwa/buyingstorehandler.cpp @@ -27,21 +27,11 @@ extern Net::BuyingStoreHandler *buyingStoreHandler; namespace TmwAthena { -BuyingStoreHandler::BuyingStoreHandler() : - MessageHandler() +BuyingStoreHandler::BuyingStoreHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; buyingStoreHandler = this; } -void BuyingStoreHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void BuyingStoreHandler::create(const std::string &name A_UNUSED, const int maxMoney A_UNUSED, const bool flag A_UNUSED, diff --git a/src/net/tmwa/buyingstorehandler.h b/src/net/tmwa/buyingstorehandler.h index dc1b408bb..bfbb71080 100644 --- a/src/net/tmwa/buyingstorehandler.h +++ b/src/net/tmwa/buyingstorehandler.h @@ -25,21 +25,16 @@ #include "net/buyingstorehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 963a40a5f..b2582a595 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -44,54 +44,12 @@ namespace TmwAthena { 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) -{ - BLOCK_START("BuySellHandler::handleMessage") - 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; - } - BLOCK_END("BuySellHandler::handleMessage") -} - void BuySellHandler::requestSellList(const std::string &nick) const { if (nick.empty() != 0 || !shopWindow) diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h index d02497a1d..7ed1b83d4 100644 --- a/src/net/tmwa/buysellhandler.h +++ b/src/net/tmwa/buysellhandler.h @@ -25,20 +25,16 @@ #include "net/ea/buysellhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/cashshophandler.cpp b/src/net/tmwa/cashshophandler.cpp index 45a4aaacb..a0b6d64cd 100644 --- a/src/net/tmwa/cashshophandler.cpp +++ b/src/net/tmwa/cashshophandler.cpp @@ -27,21 +27,11 @@ extern Net::CashShopHandler *cashShopHandler; namespace TmwAthena { -CashShopHandler::CashShopHandler() : - MessageHandler() +CashShopHandler::CashShopHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; cashShopHandler = this; } -void CashShopHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void CashShopHandler::buyItem(const int points A_UNUSED, const int itemId A_UNUSED, const ItemColor color A_UNUSED, diff --git a/src/net/tmwa/cashshophandler.h b/src/net/tmwa/cashshophandler.h index 3b4c668ec..7d90067c8 100644 --- a/src/net/tmwa/cashshophandler.h +++ b/src/net/tmwa/cashshophandler.h @@ -25,21 +25,16 @@ #include "net/cashshophandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index c5afb012e..487e0bbfc 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -54,68 +54,11 @@ extern ServerInfo mapServer; extern ServerInfo charServer; CharServerHandler::CharServerHandler() : - MessageHandler(), Ea::CharServerHandler() { - static const uint16_t _messages[] = - { - SMSG_CHAR_LOGIN, - 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, - 0 - }; - handledMessages = _messages; charServerHandler = this; } -void CharServerHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("CharServerHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_CHAR_LOGIN: - CharServerRecv::processCharLogin(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; - - default: - break; - } - BLOCK_END("CharServerHandler::handleMessage") -} - void CharServerHandler::chooseCharacter(Net::Character *const character) { if (!character) diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 39c561213..b141fc7bc 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -25,24 +25,19 @@ #include "net/ea/charserverhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { /** * 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/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 4d9998ab2..f2e1b0943 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -33,6 +33,7 @@ #include "net/character.h" #include "net/charserverhandler.h" +#include "net/messagein.h" #include "net/ea/token.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index ad34acb61..a3071c1a5 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -44,70 +44,11 @@ namespace TmwAthena { 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_MVP_EFFECT, - SMSG_IGNORE_ALL_RESPONSE, - SMSG_SCRIPT_MESSAGE, - 0 - }; - handledMessages = _messages; chatHandler = this; } -void ChatHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("ChatHandler::handleMessage") - 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_GM_CHAT: - ChatRecv::processGmChat(msg); - break; - - case SMSG_MVP_EFFECT: - Ea::ChatRecv::processMVPEffect(msg); - break; - - case SMSG_IGNORE_ALL_RESPONSE: - Ea::ChatRecv::processIgnoreAllResponse(msg); - break; - - case SMSG_SCRIPT_MESSAGE: - ChatRecv::processScriptMessage(msg); - break; - - default: - break; - } - BLOCK_END("ChatHandler::handleMessage") -} - void ChatHandler::talk(const std::string &restrict text, const std::string &restrict channel A_UNUSED) const { diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index 4bab1f050..ba591225b 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -25,21 +25,17 @@ #include "net/ea/chathandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { 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/tmwa/elementalhandler.cpp b/src/net/tmwa/elementalhandler.cpp index 5ea0f11d6..56ef699c8 100644 --- a/src/net/tmwa/elementalhandler.cpp +++ b/src/net/tmwa/elementalhandler.cpp @@ -27,24 +27,9 @@ extern Net::ElementalHandler *elementalHandler; namespace TmwAthena { -ElementalHandler::ElementalHandler() : - MessageHandler() +ElementalHandler::ElementalHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; elementalHandler = this; } -void ElementalHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - } // namespace TmwAthena diff --git a/src/net/tmwa/elementalhandler.h b/src/net/tmwa/elementalhandler.h index bacb7260e..f68805c61 100644 --- a/src/net/tmwa/elementalhandler.h +++ b/src/net/tmwa/elementalhandler.h @@ -25,21 +25,15 @@ #include "net/elementalhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -class ElementalHandler final : public MessageHandler, - public Net::ElementalHandler -{ - public: - ElementalHandler(); - - A_DELETE_COPY(ElementalHandler) - - void handleMessage(Net::MessageIn &msg) override final; -}; + class ElementalHandler final : public Net::ElementalHandler + { + public: + ElementalHandler(); + A_DELETE_COPY(ElementalHandler) + }; } // namespace TmwAthena #endif // EATHENA_SUPPORT diff --git a/src/net/tmwa/familyhandler.cpp b/src/net/tmwa/familyhandler.cpp index b5502e388..58a0bf629 100644 --- a/src/net/tmwa/familyhandler.cpp +++ b/src/net/tmwa/familyhandler.cpp @@ -27,21 +27,11 @@ extern Net::FamilyHandler *familyHandler; namespace TmwAthena { -FamilyHandler::FamilyHandler() : - MessageHandler() +FamilyHandler::FamilyHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; familyHandler = this; } -void FamilyHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void FamilyHandler::askForChild(const Being *const being A_UNUSED) { } diff --git a/src/net/tmwa/familyhandler.h b/src/net/tmwa/familyhandler.h index e284312b9..ff6328f65 100644 --- a/src/net/tmwa/familyhandler.h +++ b/src/net/tmwa/familyhandler.h @@ -25,21 +25,16 @@ #include "net/familyhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/friendshandler.cpp b/src/net/tmwa/friendshandler.cpp index a575ecd95..41081bc70 100644 --- a/src/net/tmwa/friendshandler.cpp +++ b/src/net/tmwa/friendshandler.cpp @@ -27,26 +27,11 @@ extern Net::FriendsHandler *friendsHandler; namespace TmwAthena { -FriendsHandler::FriendsHandler() : - MessageHandler() +FriendsHandler::FriendsHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; friendsHandler = this; } -void FriendsHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void FriendsHandler::invite(const std::string &name A_UNUSED) const { } diff --git a/src/net/tmwa/friendshandler.h b/src/net/tmwa/friendshandler.h index 2021352e4..bd223a499 100644 --- a/src/net/tmwa/friendshandler.h +++ b/src/net/tmwa/friendshandler.h @@ -25,20 +25,15 @@ #include "net/friendshandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 00537bf83..7d6d912fa 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -46,54 +46,11 @@ namespace TmwAthena 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, - 0 - }; - handledMessages = _messages; gameHandler = this; } -void GameHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GameHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_MAP_LOGIN_SUCCESS: - GameRecv::processMapLogin(msg); - break; - - case SMSG_SERVER_PING: - // We ignore this for now - // int tick = msg.readInt32() - 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; - - default: - break; - } - BLOCK_END("GameHandler::handleMessage") -} - void GameHandler::mapLoadedEvent() const { createOutPacket(CMSG_MAP_LOADED); diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index 9af5d017f..11db03d5c 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -23,22 +23,18 @@ #ifndef NET_TMWA_GAMEHANDLER_H #define NET_TMWA_GAMEHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/gamehandler.h" namespace TmwAthena { -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/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 5abce494b..b844261d5 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -87,7 +87,6 @@ namespace TmwAthena { GeneralHandler::GeneralHandler() : - MessageHandler(), mAdminHandler(new AdminHandler), mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), mBuySellHandler(new BuySellHandler), @@ -117,7 +116,7 @@ GeneralHandler::GeneralHandler() : mFriendsHandler(new FriendsHandler), mHomunculusHandler(new HomunculusHandler), mMailHandler(new MailHandler), - mMapHandler(new MarketHandler), + mMapHandler(new MapHandler), mMarketHandler(new MarketHandler), mMercenaryHandler(new MercenaryHandler), mRouletteHandler(new RouletteHandler), @@ -127,12 +126,6 @@ GeneralHandler::GeneralHandler() : mServerFeatures(new ServerFeatures) #endif { - static const uint16_t _messages[] = - { - SMSG_CONNECTION_PROBLEM, - 0 - }; - handledMessages = _messages; generalHandler = this; std::vector stats; @@ -157,22 +150,6 @@ GeneralHandler::~GeneralHandler() delete2(Network::mInstance); } -void GeneralHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GeneralHandler::handleMessage") - - switch (msg.getId()) - { - case SMSG_CONNECTION_PROBLEM: - GeneralRecv::processConnectionProblem(msg); - break; - - default: - break; - } - BLOCK_END("GeneralHandler::handleMessage") -} - void GeneralHandler::load() { new Network; diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 66aea3869..21bdb5ca0 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -25,15 +25,53 @@ #include "net/generalhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { +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; +#ifdef EATHENA_SUPPORT +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; +#endif class ServerFeatures; -class GeneralHandler final : public MessageHandler, - public Net::GeneralHandler +class GeneralHandler final : public Net::GeneralHandler { public: GeneralHandler(); @@ -42,8 +80,6 @@ class GeneralHandler final : public MessageHandler, ~GeneralHandler(); - void handleMessage(Net::MessageIn &msg) override final; - void load() override final; void reload() override final; @@ -63,41 +99,41 @@ 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; #ifdef EATHENA_SUPPORT - MessageHandlerPtr mAuctionHandler; - MessageHandlerPtr mBankHandler; - MessageHandlerPtr mBattleGroundHandler; - MessageHandlerPtr mBuyingStoreHandler; - MessageHandlerPtr mCashShopHandler; - MessageHandlerPtr mElementalHandler; - MessageHandlerPtr mFamilyHandler; - MessageHandlerPtr mFriendsHandler; - MessageHandlerPtr mHomunculusHandler; - MessageHandlerPtr mMailHandler; - MessageHandlerPtr mMapHandler; - MessageHandlerPtr mMarketHandler; - MessageHandlerPtr mMercenaryHandler; - MessageHandlerPtr mRouletteHandler; - MessageHandlerPtr mSearchStoreHandler; - MessageHandlerPtr mVendingHandler; + AuctionHandler *mAuctionHandler; + BankHandler *mBankHandler; + BattleGroundHandler *mBattleGroundHandler; + BuyingStoreHandler *mBuyingStoreHandler; + CashShopHandler *mCashShopHandler; + ElementalHandler *mElementalHandler; + FamilyHandler *mFamilyHandler; + FriendsHandler *mFriendsHandler; + HomunculusHandler *mHomunculusHandler; + MailHandler *mMailHandler; + MapHandler *mMapHandler; + MarketHandler *mMarketHandler; + MercenaryHandler *mMercenaryHandler; + RouletteHandler *mRouletteHandler; + SearchStoreHandler *mSearchStoreHandler; + VendingHandler *mVendingHandler; #endif }; diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 957fe2ace..e2074ac27 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -42,41 +42,8 @@ namespace TmwAthena { 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, - 0 - }; - handledMessages = _messages; - guildHandler = this; } @@ -84,124 +51,6 @@ GuildHandler::~GuildHandler() { } -void GuildHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("GuildHandler::handleMessage") - if (!serverFeatures->haveNativeGuilds()) - return; - - 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; - - default: - break; - } - BLOCK_END("GuildHandler::handleMessage") -} - void GuildHandler::create(const std::string &name) const { createOutPacket(CMSG_GUILD_CREATE); diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index 7bc9e5fef..6b2d0e350 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -24,12 +24,10 @@ #include "net/ea/guildhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/homunculushandler.cpp b/src/net/tmwa/homunculushandler.cpp index 1a0a89077..7612a5d9f 100644 --- a/src/net/tmwa/homunculushandler.cpp +++ b/src/net/tmwa/homunculushandler.cpp @@ -27,21 +27,11 @@ extern Net::HomunculusHandler *homunculusHandler; namespace TmwAthena { -HomunculusHandler::HomunculusHandler() : - MessageHandler() +HomunculusHandler::HomunculusHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; homunculusHandler = this; } -void HomunculusHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void HomunculusHandler::setName(const std::string &name A_UNUSED) const { } diff --git a/src/net/tmwa/homunculushandler.h b/src/net/tmwa/homunculushandler.h index a54079382..d5997c3f6 100644 --- a/src/net/tmwa/homunculushandler.h +++ b/src/net/tmwa/homunculushandler.h @@ -25,21 +25,16 @@ #include "net/homunculushandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 950a6b492..33d260673 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -62,30 +62,8 @@ namespace TmwAthena { InventoryHandler::InventoryHandler() : - MessageHandler(), Ea::InventoryHandler() { - static const uint16_t _messages[] = - { - SMSG_PLAYER_INVENTORY, - SMSG_PLAYER_INVENTORY_ADD, - SMSG_PLAYER_INVENTORY_REMOVE, - 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, - 0 - }; - handledMessages = _messages; inventoryHandler = this; } @@ -93,81 +71,6 @@ InventoryHandler::~InventoryHandler() { } -void InventoryHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("InventoryHandler::handleMessage") - 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_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; - - default: - break; - } - BLOCK_END("InventoryHandler::handleMessage") -} - void InventoryHandler::equipItem(const Item *const item) const { if (!item) diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 8bbd17a56..d0ccedab5 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -25,13 +25,10 @@ #include "net/ea/inventoryhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index 8bf6239d9..eb42aa2a3 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -33,40 +33,8 @@ namespace TmwAthena { ItemHandler::ItemHandler() : - MessageHandler(), Ea::ItemHandler() { - static const uint16_t _messages[] = - { - SMSG_ITEM_VISIBLE, - SMSG_ITEM_DROPPED, - SMSG_ITEM_REMOVE, - 0 - }; - handledMessages = _messages; -} - -void ItemHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("ItemHandler::handleMessage") - 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; - - default: - break; - } - BLOCK_END("ItemHandler::handleMessage") } } // namespace TmwAthena diff --git a/src/net/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h index c81eba3c3..0a26a3166 100644 --- a/src/net/tmwa/itemhandler.h +++ b/src/net/tmwa/itemhandler.h @@ -23,21 +23,17 @@ #ifndef NET_TMWA_ITEMHANDLER_H #define NET_TMWA_ITEMHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/itemhandler.h" namespace TmwAthena { -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 TmwAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 177984d72..de9196814 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -43,19 +43,8 @@ namespace TmwAthena extern ServerInfo charServer; LoginHandler::LoginHandler() : - MessageHandler(), Ea::LoginHandler() { - static const uint16_t _messages[] = - { - SMSG_UPDATE_HOST, - SMSG_LOGIN_DATA, - SMSG_LOGIN_ERROR, - SMSG_CHAR_PASSWORD_RESPONSE, - SMSG_SERVER_VERSION_RESPONSE, - 0 - }; - handledMessages = _messages; loginHandler = this; } @@ -63,37 +52,6 @@ LoginHandler::~LoginHandler() { } -void LoginHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("LoginHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_CHAR_PASSWORD_RESPONSE: - LoginRecv::processCharPasswordResponse(msg); - break; - - case SMSG_UPDATE_HOST: - Ea::LoginRecv::processUpdateHost(msg); - break; - - case SMSG_LOGIN_DATA: - Ea::LoginRecv::processLoginData(msg); - break; - - case SMSG_LOGIN_ERROR: - Ea::LoginRecv::processLoginError(msg); - break; - - case SMSG_SERVER_VERSION_RESPONSE: - LoginRecv::processServerVersion(msg); - break; - - default: - break; - } - BLOCK_END("LoginHandler::handleMessage") -} - void LoginHandler::connect() { if (!Network::mInstance) diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 48a9e060e..e22e5c2bf 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -25,12 +25,10 @@ #include "net/ea/loginhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/mailhandler.cpp b/src/net/tmwa/mailhandler.cpp index 911436972..f82f32d72 100644 --- a/src/net/tmwa/mailhandler.cpp +++ b/src/net/tmwa/mailhandler.cpp @@ -27,21 +27,11 @@ extern Net::MailHandler *mailHandler; namespace TmwAthena { -MailHandler::MailHandler() : - MessageHandler() +MailHandler::MailHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mailHandler = this; } -void MailHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void MailHandler::refresh() const { } diff --git a/src/net/tmwa/mailhandler.h b/src/net/tmwa/mailhandler.h index b6427c763..7278f85c5 100644 --- a/src/net/tmwa/mailhandler.h +++ b/src/net/tmwa/mailhandler.h @@ -25,20 +25,16 @@ #include "net/mailhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/maphandler.cpp b/src/net/tmwa/maphandler.cpp index 2f2d37a82..6b3262ee5 100644 --- a/src/net/tmwa/maphandler.cpp +++ b/src/net/tmwa/maphandler.cpp @@ -27,19 +27,9 @@ extern Net::MapHandler *mapHandler; namespace TmwAthena { -MapHandler::MapHandler() : - MessageHandler() +MapHandler::MapHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mapHandler = this; } -void MapHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - } // namespace TmwAthena diff --git a/src/net/tmwa/maphandler.h b/src/net/tmwa/maphandler.h index f532c1bb6..c883dea09 100644 --- a/src/net/tmwa/maphandler.h +++ b/src/net/tmwa/maphandler.h @@ -25,21 +25,15 @@ #include "net/maphandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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: }; } // namespace TmwAthena diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp index 4e322b1cf..b9dbfa4bb 100644 --- a/src/net/tmwa/markethandler.cpp +++ b/src/net/tmwa/markethandler.cpp @@ -27,26 +27,11 @@ extern Net::MarketHandler *marketHandler; namespace TmwAthena { -MarketHandler::MarketHandler() : - MessageHandler() +MarketHandler::MarketHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; marketHandler = this; } -void MarketHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void MarketHandler::close() { } diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h index 65d299251..7bbf04aea 100644 --- a/src/net/tmwa/markethandler.h +++ b/src/net/tmwa/markethandler.h @@ -25,20 +25,15 @@ #include "net/markethandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp index 2bbdc0a31..855515e4a 100644 --- a/src/net/tmwa/mercenaryhandler.cpp +++ b/src/net/tmwa/mercenaryhandler.cpp @@ -27,21 +27,11 @@ extern Net::MercenaryHandler *mercenaryHandler; namespace TmwAthena { -MercenaryHandler::MercenaryHandler() : - MessageHandler() +MercenaryHandler::MercenaryHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; mercenaryHandler = this; } -void MercenaryHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void MercenaryHandler::fire() { } diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h index 17489b7fd..58f119e99 100644 --- a/src/net/tmwa/mercenaryhandler.h +++ b/src/net/tmwa/mercenaryhandler.h @@ -25,21 +25,16 @@ #include "net/mercenaryhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp deleted file mode 100644 index bc5e2fae7..000000000 --- a/src/net/tmwa/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 . - */ - -#include "net/tmwa/messagehandler.h" - -#include "net/tmwa/network.h" - -#include - -#include "debug.h" - -namespace TmwAthena -{ - -MessageHandler::MessageHandler() : - Net::MessageHandler() -{ -} - -MessageHandler::~MessageHandler() -{ - if (Network::mInstance) - Network::mInstance->unregisterHandler(this); -} - -void MessageHandler::setNetwork(Network *const network) -{ - assert(!(network && Network::mInstance)); -} - -} // namespace TmwAthena diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h deleted file mode 100644 index 0ea8609af..000000000 --- a/src/net/tmwa/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 . - */ - -#ifndef NET_TMWA_MESSAGEHANDLER_H -#define NET_TMWA_MESSAGEHANDLER_H - -#include "net/messagehandler.h" - -namespace TmwAthena -{ - -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 TmwAthena - -#endif // NET_TMWA_MESSAGEHANDLER_H diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 0e99f9dbd..069ff373a 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -58,7 +58,6 @@ #include "net/tmwa/skillrecv.h" #include "net/tmwa/traderecv.h" -#include "net/tmwa/messagehandler.h" #include "net/tmwa/messagein.h" #include "net/tmwa/protocol.h" @@ -91,22 +90,6 @@ void Network::registerHandlers() #include "net/tmwa/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/tmwa/network.h b/src/net/tmwa/network.h index 473665576..9e0aa9512 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -34,8 +34,6 @@ namespace TmwAthena { -class MessageHandler; - class Network final : public Ea::Network { public: @@ -45,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/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index c3ad53b41..b2e121cef 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -28,12 +28,13 @@ #include "gui/widgets/createwidget.h" -#include "net/ea/npcrecv.h" +#include "net/messagein.h" #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" #include "net/ea/eaprotocol.h" +#include "net/ea/npcrecv.h" #include "debug.h" @@ -43,71 +44,11 @@ namespace TmwAthena { 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_COMMAND, - SMSG_NPC_CHANGETITLE, - 0 - }; - handledMessages = _messages; npcHandler = this; } -void NpcHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("NpcHandler::handleMessage") - - 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_COMMAND: - Ea::NpcRecv::processNpcCommand(msg); - break; - - case SMSG_NPC_CHANGETITLE: - Ea::NpcRecv::processChangeTitle(msg); - break; - - default: - break; - } - - Ea::NpcRecv::mDialog = nullptr; - BLOCK_END("NpcHandler::handleMessage") -} - void NpcHandler::talk(const BeingId npcId) const { createOutPacket(CMSG_NPC_TALK); diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index 35a6f9459..a69845724 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -25,20 +25,16 @@ #include "net/ea/npchandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 46a27b6e9..b20516363 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -43,24 +43,8 @@ namespace TmwAthena { 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_MOVE, - SMSG_PARTY_LEAVE, - SMSG_PARTY_UPDATE_HP, - SMSG_PARTY_UPDATE_COORDS, - SMSG_PARTY_MESSAGE, - 0 - }; - handledMessages = _messages; partyHandler = this; } @@ -68,48 +52,6 @@ PartyHandler::~PartyHandler() { } -void PartyHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("PartyHandler::handleMessage") - 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_MOVE: - PartyRecv::processPartyMove(msg); - break; - case SMSG_PARTY_LEAVE: - Ea::PartyRecv::processPartyLeave(msg); - break; - case SMSG_PARTY_UPDATE_HP: - PartyRecv::processPartyUpdateHp(msg); - break; - case SMSG_PARTY_UPDATE_COORDS: - Ea::PartyRecv::processPartyUpdateCoords(msg); - break; - case SMSG_PARTY_MESSAGE: - PartyRecv::processPartyMessage(msg); - break; - - default: - break; - } - BLOCK_END("PartyHandler::handleMessage") -} - void PartyHandler::create(const std::string &name) const { createOutPacket(CMSG_PARTY_CREATE); diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 47fe9c232..5d4ca18ae 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -22,14 +22,12 @@ #ifndef NET_TMWA_PARTYHANDLER_H #define NET_TMWA_PARTYHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/ea/partyhandler.h" namespace TmwAthena { -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/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index f759fdb0d..615fbb073 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -35,23 +35,11 @@ namespace TmwAthena { PetHandler::PetHandler() : - MessageHandler(), mRandCounter(1000) { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; petHandler = this; } -void PetHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ - BLOCK_START("PetHandler::handleMessage") - BLOCK_END("PetHandler::handleMessage") -} - void PetHandler::move(const int petId A_UNUSED, const int x, const int y) const { diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h index 3a744180a..23428edf8 100644 --- a/src/net/tmwa/pethandler.h +++ b/src/net/tmwa/pethandler.h @@ -21,22 +21,18 @@ #ifndef NET_TMWA_PETHANDLER_H #define NET_TMWA_PETHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/pethandler.h" namespace TmwAthena { -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/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 312a95644..d637aed4d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -43,79 +43,11 @@ namespace TmwAthena { 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_MAP_MUSIC, - 0 - }; - handledMessages = _messages; playerHandler = this; } -void PlayerHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("PlayerHandler::handleMessage") - 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_MAP_MUSIC: - Ea::PlayerRecv::processMapMusic(msg); - break; - - default: - break; - } - BLOCK_END("PlayerHandler::handleMessage") -} - void PlayerHandler::attack(const BeingId id, const Keep keep) const { diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 5af3e9676..89dc609c4 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -25,20 +25,16 @@ #include "net/ea/playerhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/playerrecv.h b/src/net/tmwa/playerrecv.h index 0fcadb104..929591be6 100644 --- a/src/net/tmwa/playerrecv.h +++ b/src/net/tmwa/playerrecv.h @@ -25,8 +25,6 @@ #include "net/ea/playerhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { namespace PlayerRecv diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index d40603b7f..8ecf0b83e 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -34,38 +34,11 @@ namespace TmwAthena { QuestHandler::QuestHandler() : - MessageHandler(), Net::QuestHandler() { - static const uint16_t _messages[] = - { - SMSG_QUEST_SET_VAR, - SMSG_QUEST_PLAYER_VARS, - 0 - }; - handledMessages = _messages; questHandler = this; } -void QuestHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("QuestHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_QUEST_SET_VAR: - QuestRecv::processSetQuestVar(msg); - break; - - case SMSG_QUEST_PLAYER_VARS: - QuestRecv::processPlayerQuests(msg); - break; - - default: - break; - } - BLOCK_END("QuestHandler::handleMessage") -} - void QuestHandler::setQeustActiveState(const int questId A_UNUSED, const bool active A_UNUSED) const { diff --git a/src/net/tmwa/questhandler.h b/src/net/tmwa/questhandler.h index 920df82fb..60577bf0a 100644 --- a/src/net/tmwa/questhandler.h +++ b/src/net/tmwa/questhandler.h @@ -21,23 +21,18 @@ #ifndef NET_TMWA_QUESTHANDLER_H #define NET_TMWA_QUESTHANDLER_H -#include "net/tmwa/messagehandler.h" - #include "net/questhandler.h" namespace TmwAthena { -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/tmwa/questrecv.cpp b/src/net/tmwa/questrecv.cpp index 51971f1f9..0f05413af 100644 --- a/src/net/tmwa/questrecv.cpp +++ b/src/net/tmwa/questrecv.cpp @@ -23,6 +23,8 @@ #include "gui/windows/skilldialog.h" #include "gui/windows/questswindow.h" +#include "net/messagein.h" + #include "net/tmwa/protocol.h" #include "resources/skillconsts.h" diff --git a/src/net/tmwa/questrecv.h b/src/net/tmwa/questrecv.h index 41d6be3da..f81653cf6 100644 --- a/src/net/tmwa/questrecv.h +++ b/src/net/tmwa/questrecv.h @@ -21,10 +21,13 @@ #ifndef NET_TMWA_QUESTRECV_H #define NET_TMWA_QUESTRECV_H -#include "net/tmwa/messagehandler.h" - #include "net/questhandler.h" +namespace Net +{ + class MessageIn; +} + namespace TmwAthena { namespace QuestRecv diff --git a/src/net/tmwa/roulettehandler.cpp b/src/net/tmwa/roulettehandler.cpp index 63957d926..a3e08ef70 100644 --- a/src/net/tmwa/roulettehandler.cpp +++ b/src/net/tmwa/roulettehandler.cpp @@ -27,24 +27,9 @@ extern Net::RouletteHandler *rouletteHandler; namespace TmwAthena { -RouletteHandler::RouletteHandler() : - MessageHandler() +RouletteHandler::RouletteHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; rouletteHandler = this; } -void RouletteHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - } // namespace TmwAthena diff --git a/src/net/tmwa/roulettehandler.h b/src/net/tmwa/roulettehandler.h index a16cc269a..981314052 100644 --- a/src/net/tmwa/roulettehandler.h +++ b/src/net/tmwa/roulettehandler.h @@ -25,19 +25,14 @@ #include "net/roulettehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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 TmwAthena diff --git a/src/net/tmwa/searchstorehandler.cpp b/src/net/tmwa/searchstorehandler.cpp index 091903e4c..9cea62eb8 100644 --- a/src/net/tmwa/searchstorehandler.cpp +++ b/src/net/tmwa/searchstorehandler.cpp @@ -27,26 +27,11 @@ extern Net::SearchStoreHandler *searchStoreHandler; namespace TmwAthena { -SearchStoreHandler::SearchStoreHandler() : - MessageHandler() +SearchStoreHandler::SearchStoreHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; searchStoreHandler = this; } -void SearchStoreHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - default: - break; - } -} - void SearchStoreHandler::search(const StoreSearchTypeT type A_UNUSED, const int minPrice A_UNUSED, const int maxPrice A_UNUSED, diff --git a/src/net/tmwa/searchstorehandler.h b/src/net/tmwa/searchstorehandler.h index ca1efcd9c..183d1084a 100644 --- a/src/net/tmwa/searchstorehandler.h +++ b/src/net/tmwa/searchstorehandler.h @@ -25,20 +25,15 @@ #include "net/searchstorehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 33eb884d1..ed9909e18 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -47,43 +47,11 @@ namespace TmwAthena { SkillHandler::SkillHandler() : - MessageHandler(), Ea::SkillHandler() { - static const uint16_t _messages[] = - { - SMSG_PLAYER_SKILLS, - SMSG_SKILL_FAILED, - SMSG_PLAYER_SKILL_UP, - 0 - }; - handledMessages = _messages; skillHandler = this; } -void SkillHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("SkillHandler::handleMessage") - 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; - - default: - break; - } - BLOCK_END("SkillHandler::handleMessage") -} - void SkillHandler::useBeing(const int id, const int level, const BeingId beingId) const { diff --git a/src/net/tmwa/skillhandler.h b/src/net/tmwa/skillhandler.h index f9e965abd..db5e7c75a 100644 --- a/src/net/tmwa/skillhandler.h +++ b/src/net/tmwa/skillhandler.h @@ -25,20 +25,16 @@ #include "net/ea/skillhandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/skillrecv.cpp b/src/net/tmwa/skillrecv.cpp index aa7294de2..9c29be38c 100644 --- a/src/net/tmwa/skillrecv.cpp +++ b/src/net/tmwa/skillrecv.cpp @@ -31,6 +31,8 @@ #include "gui/windows/skilldialog.h" +#include "net/messagein.h" + #include "net/ea/skillrecv.h" #include "net/tmwa/messageout.h" diff --git a/src/net/tmwa/skillrecv.h b/src/net/tmwa/skillrecv.h index 65d4f87c5..7d0b84cc2 100644 --- a/src/net/tmwa/skillrecv.h +++ b/src/net/tmwa/skillrecv.h @@ -25,7 +25,10 @@ #include "net/ea/skillhandler.h" -#include "net/tmwa/messagehandler.h" +namespace Net +{ + class MessageIn; +} namespace TmwAthena { diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 35a1c06eb..3eccd966d 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -54,64 +54,11 @@ namespace TmwAthena { 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, - 0 - }; - handledMessages = _messages; tradeHandler = this; } - -void TradeHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("TradeHandler::handleMessage") - 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; - - default: - break; - } - BLOCK_END("TradeHandler::handleMessage") -} - void TradeHandler::request(const Being *const being) const { if (!being) diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h index 125131204..f64b946d2 100644 --- a/src/net/tmwa/tradehandler.h +++ b/src/net/tmwa/tradehandler.h @@ -25,20 +25,16 @@ #include "net/ea/tradehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp index fce1576cb..654b9eeb5 100644 --- a/src/net/tmwa/traderecv.cpp +++ b/src/net/tmwa/traderecv.cpp @@ -34,13 +34,14 @@ #include "gui/windows/tradewindow.h" +#include "net/messagein.h" + +#include "net/ea/eaprotocol.h" #include "net/ea/traderecv.h" #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" -#include "net/ea/eaprotocol.h" - #include "utils/stringutils.h" #include "debug.h" diff --git a/src/net/tmwa/traderecv.h b/src/net/tmwa/traderecv.h index 8702478d7..3b7166267 100644 --- a/src/net/tmwa/traderecv.h +++ b/src/net/tmwa/traderecv.h @@ -25,8 +25,6 @@ #include "net/ea/tradehandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { namespace TradeRecv diff --git a/src/net/tmwa/vendinghandler.cpp b/src/net/tmwa/vendinghandler.cpp index 67e39fd6a..bba591809 100644 --- a/src/net/tmwa/vendinghandler.cpp +++ b/src/net/tmwa/vendinghandler.cpp @@ -27,21 +27,11 @@ extern Net::VendingHandler *vendingHandler; namespace TmwAthena { -VendingHandler::VendingHandler() : - MessageHandler() +VendingHandler::VendingHandler() { - static const uint16_t _messages[] = - { - 0 - }; - handledMessages = _messages; vendingHandler = this; } -void VendingHandler::handleMessage(Net::MessageIn &msg A_UNUSED) -{ -} - void VendingHandler::close() const { } diff --git a/src/net/tmwa/vendinghandler.h b/src/net/tmwa/vendinghandler.h index ddfe72971..36b6031df 100644 --- a/src/net/tmwa/vendinghandler.h +++ b/src/net/tmwa/vendinghandler.h @@ -25,21 +25,16 @@ #include "net/vendinghandler.h" -#include "net/tmwa/messagehandler.h" - namespace TmwAthena { -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; -- cgit v1.2.3-70-g09d2