summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-26 13:21:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-26 13:21:00 +0300
commit669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d (patch)
tree7fbfb330d11a85ef4dde139bbb87c56ed44e0a0f /src/net/eathena
parenta9f4333410bf9ef9448d3868587271b8e948807b (diff)
downloadManaVerse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.gz
ManaVerse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.bz2
ManaVerse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.tar.xz
ManaVerse-669a5f22c7ff9c63c1f19bf5fe757e8ac90ced0d.zip
eathena: add packet SMSG_HOMUNCULUS_FOOD 0x022f.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/homunculushandler.cpp29
-rw-r--r--src/net/eathena/homunculushandler.h2
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h1
4 files changed, 33 insertions, 1 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 *