diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-26 13:21:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-26 13:21:00 +0300 |
commit | 669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d (patch) | |
tree | 7fbfb330d11a85ef4dde139bbb87c56ed44e0a0f /src/net/eathena/homunculushandler.cpp | |
parent | a9f4333410bf9ef9448d3868587271b8e948807b (diff) | |
download | mv-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.gz mv-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.bz2 mv-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.xz mv-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.zip |
eathena: add packet SMSG_HOMUNCULUS_FOOD 0x022f.
Diffstat (limited to 'src/net/eathena/homunculushandler.cpp')
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 29 |
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); |