summaryrefslogtreecommitdiff
path: root/src/net/eathena/homunculushandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/homunculushandler.cpp')
-rw-r--r--src/net/eathena/homunculushandler.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp
index 6f7aaaa40..f96ad006b 100644
--- a/src/net/eathena/homunculushandler.cpp
+++ b/src/net/eathena/homunculushandler.cpp
@@ -22,6 +22,7 @@
#include "actormanager.h"
#include "logger.h"
+#include "notifymanager.h"
#include "being/homunculusinfo.h"
#include "being/playerinfo.h"
@@ -33,6 +34,13 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
+#include "resources/iteminfo.h"
+#include "resources/notifytypes.h"
+
+#include "resources/db/itemdb.h"
+
+#include "utils/stringutils.h"
+
#include "debug.h"
extern Net::HomunculusHandler *homunculusHandler;
@@ -49,6 +57,7 @@ HomunculusHandler::HomunculusHandler() :
SMSG_HOMUNCULUS_DATA,
SMSG_HOMUNCULUS_INFO,
SMSG_HOMUNCULUS_SKILL_UP,
+ SMSG_HOMUNCULUS_FOOD,
0
};
handledMessages = _messages;
@@ -75,6 +84,10 @@ void HomunculusHandler::handleMessage(Net::MessageIn &msg)
processHomunculusSkillUp(msg);
break;
+ case SMSG_HOMUNCULUS_FOOD:
+ processHomunculusFood(msg);
+ break;
+
default:
break;
}
@@ -207,6 +220,22 @@ void HomunculusHandler::processHomunculusSkillUp(Net::MessageIn &msg)
}
}
+void HomunculusHandler::processHomunculusFood(Net::MessageIn &msg)
+{
+ const int flag = msg.readUInt8("fail");
+ const int itemId = msg.readInt16("food id");
+ if (flag)
+ {
+ NotifyManager::notify(NotifyTypes::HOMUNCULUS_FEED_OK);
+ }
+ else
+ {
+ const std::string name = strprintf("[@@%d|%s@@]", itemId,
+ ItemDB::get(itemId).getName().c_str());
+ NotifyManager::notify(NotifyTypes::HOMUNCULUS_FEED_FAIL, name);
+ }
+}
+
void HomunculusHandler::setName(const std::string &name) const
{
createOutPacket(CMSG_HOMUNCULUS_SET_NAME);