summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/chathandler.cpp7
-rw-r--r--src/net/eathena/mercenaryhandler.cpp32
-rw-r--r--src/net/eathena/mercenaryhandler.h2
3 files changed, 40 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);