diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-21 14:44:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-21 14:44:03 +0300 |
commit | ba07ca55476c488504a8d8bf9318f15aab687f12 (patch) | |
tree | 3907bcceabda445a9fa8498ff92af09df2c11e08 /src/net | |
parent | 46d1266f00dfde5d04d7980daea4bab02e77cb69 (diff) | |
download | manaplus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.gz manaplus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.bz2 manaplus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.xz manaplus-ba07ca55476c488504a8d8bf9318f15aab687f12.zip |
Fix mercenary removing.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/chathandler.cpp | 7 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.cpp | 32 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.h | 2 | ||||
-rw-r--r-- | src/net/mercenaryhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/mercenaryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/mercenaryhandler.h | 2 |
6 files changed, 48 insertions, 1 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 028cc68a8..758bd37d4 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -32,6 +32,8 @@ #include "gui/windows/chatwindow.h" +#include "net/mercenaryhandler.h" + #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -332,7 +334,10 @@ void ChatHandler::processFormatMessage(Net::MessageIn &msg) int msgId = msg.readInt16("msg id"); // +++ here need load message from configuration file const std::string chatMsg = strprintf("Message #%d", msgId); - processChatContinue(chatMsg); + if (msgId >= 1266 && msgId <= 1269) + mercenaryHandler->handleMercenaryMessage(msgId - 1266); + else + processChatContinue(chatMsg); } void ChatHandler::processFormatMessageNumber(Net::MessageIn &msg) diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index a614cf429..0726f5281 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -22,6 +22,7 @@ #include "actormanager.h" #include "logger.h" +#include "notifymanager.h" #include "being/being.h" #include "being/localplayer.h" @@ -35,6 +36,8 @@ #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" +#include "resources/notifytypes.h" + #include "debug.h" extern Net::MercenaryHandler *mercenaryHandler; @@ -152,4 +155,33 @@ void MercenaryHandler::processMercenarySkills(Net::MessageIn &msg) skillDialog->update(); } +void MercenaryHandler::handleMercenaryMessage(const int cmd) +{ + PlayerInfo::setMercenary(nullptr); + if (skillDialog) + { + skillDialog->hideSkills(SkillOwner::Mercenary); + skillDialog->update(); + } + + switch (cmd) + { + case 0: + NotifyManager::notify(NotifyTypes::MERCENARY_EXPIRED); + break; + case 1: + NotifyManager::notify(NotifyTypes::MERCENARY_KILLED); + break; + case 2: + NotifyManager::notify(NotifyTypes::MERCENARY_FIRED); + break; + case 3: + NotifyManager::notify(NotifyTypes::MERCENARY_RUN); + break; + default: + NotifyManager::notify(NotifyTypes::MERCENARY_UNKNOWN); + break; + } +} + } // namespace EAthena diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index 8a1ea03d9..39af9605b 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -39,6 +39,8 @@ class MercenaryHandler final : public MessageHandler, void handleMessage(Net::MessageIn &msg) override final; + void handleMercenaryMessage(const int cmd) override final; + protected: void processMercenaryUpdate(Net::MessageIn &msg); diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h index 55ad14818..69ad75cb6 100644 --- a/src/net/mercenaryhandler.h +++ b/src/net/mercenaryhandler.h @@ -33,6 +33,8 @@ class MercenaryHandler notfinal public: virtual ~MercenaryHandler() { } + + virtual void handleMercenaryMessage(const int cmd) = 0; }; } // namespace Net diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp index f6b722326..b0afca919 100644 --- a/src/net/tmwa/mercenaryhandler.cpp +++ b/src/net/tmwa/mercenaryhandler.cpp @@ -42,4 +42,8 @@ void MercenaryHandler::handleMessage(Net::MessageIn &msg A_UNUSED) { } +void MercenaryHandler::handleMercenaryMessage(const int cmd A_UNUSED) +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h index e44d98ad1..0e795d347 100644 --- a/src/net/tmwa/mercenaryhandler.h +++ b/src/net/tmwa/mercenaryhandler.h @@ -37,6 +37,8 @@ class MercenaryHandler final : public MessageHandler, A_DELETE_COPY(MercenaryHandler) void handleMessage(Net::MessageIn &msg) override final; + + void handleMercenaryMessage(const int cmd) override final; }; } // namespace TmwAthena |