summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-21 14:44:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-21 14:44:03 +0300
commitba07ca55476c488504a8d8bf9318f15aab687f12 (patch)
tree3907bcceabda445a9fa8498ff92af09df2c11e08
parent46d1266f00dfde5d04d7980daea4bab02e77cb69 (diff)
downloadplus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.gz
plus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.bz2
plus-ba07ca55476c488504a8d8bf9318f15aab687f12.tar.xz
plus-ba07ca55476c488504a8d8bf9318f15aab687f12.zip
Fix mercenary removing.
-rw-r--r--src/actormanager.cpp14
-rw-r--r--src/net/eathena/chathandler.cpp7
-rw-r--r--src/net/eathena/mercenaryhandler.cpp32
-rw-r--r--src/net/eathena/mercenaryhandler.h2
-rw-r--r--src/net/mercenaryhandler.h2
-rw-r--r--src/net/tmwa/mercenaryhandler.cpp4
-rw-r--r--src/net/tmwa/mercenaryhandler.h2
-rw-r--r--src/resources/notifications.h20
-rw-r--r--src/resources/notifytypes.h5
9 files changed, 73 insertions, 15 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 5bb9c64aa..0f30fa215 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -813,20 +813,6 @@ void ActorManager::logic()
if (beingEquipmentWindow)
beingEquipmentWindow->resetBeing(being);
}
-/*
- else if (localPlayer && type == ActorType::Mercenary)
- {
- if (actor->getId() == localPlayer->getMercenary())
- {
- localPlayer->setMercenary(0);
- if (skillDialog)
- {
- skillDialog->hideSkills(SkillOwner::Mercenary);
- skillDialog->updateModels();
- }
- }
- }
-*/
if (localPlayer)
{
if (localPlayer->getTarget() == actor)
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
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 952bc0a9e..b4439ada8 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -334,6 +334,26 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Pet catch unkown error: %d."),
NotifyFlags::INT},
+ {"mercenary expired",
+ // TRANSLATORS: notification message
+ N_("Your mercenary duty hour is over."),
+ NotifyFlags::EMPTY},
+ {"mercenary killed",
+ // TRANSLATORS: notification message
+ N_("Your mercenary was killed."),
+ NotifyFlags::EMPTY},
+ {"mercenary fired",
+ // TRANSLATORS: notification message
+ N_("Your mercenary was fired."),
+ NotifyFlags::EMPTY},
+ {"mercenary run",
+ // TRANSLATORS: notification message
+ N_("Your mercenary run away."),
+ NotifyFlags::EMPTY},
+ {"mercenary unknown",
+ // TRANSLATORS: notification message
+ N_("Mercenary unknown state."),
+ NotifyFlags::EMPTY}
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H
diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h
index 36b1f3047..14ff47265 100644
--- a/src/resources/notifytypes.h
+++ b/src/resources/notifytypes.h
@@ -103,6 +103,11 @@ namespace NotifyTypes
PET_CATCH_FAILED,
PET_CATCH_SUCCESS,
PET_CATCH_UNKNOWN,
+ MERCENARY_EXPIRED,
+ MERCENARY_KILLED,
+ MERCENARY_FIRED,
+ MERCENARY_RUN,
+ MERCENARY_UNKNOWN,
TYPE_END
};