summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-24 21:40:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-24 21:40:11 +0300
commit94a3b513dda2189a49f8f5e0d131b9f644d60cef (patch)
treee2027f225f9a14cb935df099e74eec5c190c6d39 /src/net/eathena
parent73c360768c4d0a9013073fb86123eab858ff79d7 (diff)
downloadplus-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.gz
plus-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.bz2
plus-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.xz
plus-94a3b513dda2189a49f8f5e0d131b9f644d60cef.zip
eathena: add packet SMSG_HOMUNCULUS_DATA 0x0230.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/homunculushandler.cpp41
-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, 45 insertions, 1 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp
index e99f7f1d0..6b752daad 100644
--- a/src/net/eathena/homunculushandler.cpp
+++ b/src/net/eathena/homunculushandler.cpp
@@ -20,8 +20,10 @@
#include "net/eathena/homunculushandler.h"
+#include "actormanager.h"
#include "logger.h"
+#include "being/homunculusinfo.h"
#include "being/playerinfo.h"
#include "gui/windows/skilldialog.h"
@@ -44,6 +46,7 @@ HomunculusHandler::HomunculusHandler() :
static const uint16_t _messages[] =
{
SMSG_HOMUNCULUS_SKILLS,
+ SMSG_HOMUNCULUS_DATA,
0
};
handledMessages = _messages;
@@ -58,6 +61,10 @@ void HomunculusHandler::handleMessage(Net::MessageIn &msg)
processHomunculusSkills(msg);
break;
+ case SMSG_HOMUNCULUS_DATA:
+ processHomunculusData(msg);
+ break;
+
default:
break;
}
@@ -93,4 +100,38 @@ void HomunculusHandler::processHomunculusSkills(Net::MessageIn &msg)
skillDialog->updateModels();
}
+void HomunculusHandler::processHomunculusData(Net::MessageIn &msg)
+{
+ msg.readUInt8("unused");
+ const int cmd = msg.readUInt8("state");
+ const int id = msg.readInt32("homunculus id");
+ Being *const dstBeing = actorManager->findBeing(id);
+ const int data = msg.readInt32("data");
+ if (!cmd) // pre init
+ {
+ HomunculusInfo *const info = new HomunculusInfo;
+ info->id = id;
+ PlayerInfo::setHomunculus(info);
+ PlayerInfo::setHomunculusBeing(dstBeing);
+ return;
+ }
+ HomunculusInfo *const info = PlayerInfo::getHomunculus();
+ if (!info)
+ return;
+ switch (cmd)
+ {
+ case 1: // intimacy
+ info->intimacy = data;
+ break;
+ case 2: // hunger
+ info->hungry = data;
+ break;
+ case 3: // accesory
+ info->equip = data;
+ break;
+ default:
+ break;
+ }
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h
index 25ea59622..c172adb90 100644
--- a/src/net/eathena/homunculushandler.h
+++ b/src/net/eathena/homunculushandler.h
@@ -41,6 +41,8 @@ class HomunculusHandler final : public MessageHandler,
protected:
void processHomunculusSkills(Net::MessageIn &msg);
+
+ void processHomunculusData(Net::MessageIn &msg);
};
} // namespace EAthena
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index feead5c1a..28002d4e4 100644
--- a/src/net/eathena/packets.h
+++ b/src/net/eathena/packets.h
@@ -86,7 +86,7 @@ int16_t packet_lengths[] =
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, 0, 0,
- 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 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,
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 024743c8f..74ddf6dda 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -259,6 +259,7 @@
#define SMSG_MERCENARY_SKILLS 0x029d
#define SMSG_HOMUNCULUS_SKILLS 0x0235
+#define SMSG_HOMUNCULUS_DATA 0x0230
/**********************************
* Packets from client to server *