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 | |
parent | a9f4333410bf9ef9448d3868587271b8e948807b (diff) | |
download | manaverse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.gz manaverse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.bz2 manaverse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.xz manaverse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.zip |
eathena: add packet SMSG_HOMUNCULUS_FOOD 0x022f.
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 29 | ||||
-rw-r--r-- | src/net/eathena/homunculushandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 | ||||
-rw-r--r-- | src/resources/notifications.h | 10 | ||||
-rw-r--r-- | src/resources/notifytypes.h | 2 |
6 files changed, 44 insertions, 2 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); diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index c86dfb58e..94e3807f0 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -59,6 +59,8 @@ class HomunculusHandler final : public MessageHandler, void processHomunculusInfo(Net::MessageIn &msg); void processHomunculusSkillUp(Net::MessageIn &msg); + + void processHomunculusFood(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index f9a917418..b42712d2b 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -85,7 +85,7 @@ int16_t packet_lengths[] = // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, 22, -1, 16, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, 122, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 19, 71, 0, + -1, 122, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 19, 71, 5, 12, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x0240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index d36a0fa8f..562489397 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -263,6 +263,7 @@ #define SMSG_HOMUNCULUS_DATA 0x0230 #define SMSG_HOMUNCULUS_INFO 0x022e #define SMSG_HOMUNCULUS_SKILL_UP 0x0239 +#define SMSG_HOMUNCULUS_FOOD 0x022f /********************************** * Packets from client to server * diff --git a/src/resources/notifications.h b/src/resources/notifications.h index b4439ada8..dec091468 100644 --- a/src/resources/notifications.h +++ b/src/resources/notifications.h @@ -353,7 +353,15 @@ namespace NotifyManager {"mercenary unknown", // TRANSLATORS: notification message N_("Mercenary unknown state."), - NotifyFlags::EMPTY} + NotifyFlags::EMPTY}, + {"homunculus feed ok", + // TRANSLATORS: notification message + N_("Your feed your homunculus."), + NotifyFlags::EMPTY}, + {"homunculus feed failed", + // TRANSLATORS: notification message + N_("You cant feed homunculus, because not have %s."), + NotifyFlags::STRING} }; } // namespace NotifyManager #endif // RESOURCES_NOTIFICATIONS_H diff --git a/src/resources/notifytypes.h b/src/resources/notifytypes.h index 14ff47265..c1de1d201 100644 --- a/src/resources/notifytypes.h +++ b/src/resources/notifytypes.h @@ -108,6 +108,8 @@ namespace NotifyTypes MERCENARY_FIRED, MERCENARY_RUN, MERCENARY_UNKNOWN, + HOMUNCULUS_FEED_OK, + HOMUNCULUS_FEED_FAIL, TYPE_END }; |