diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-24 21:40:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-24 21:40:11 +0300 |
commit | 94a3b513dda2189a49f8f5e0d131b9f644d60cef (patch) | |
tree | e2027f225f9a14cb935df099e74eec5c190c6d39 /src/net/eathena/homunculushandler.cpp | |
parent | 73c360768c4d0a9013073fb86123eab858ff79d7 (diff) | |
download | ManaVerse-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.gz ManaVerse-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.bz2 ManaVerse-94a3b513dda2189a49f8f5e0d131b9f644d60cef.tar.xz ManaVerse-94a3b513dda2189a49f8f5e0d131b9f644d60cef.zip |
eathena: add packet SMSG_HOMUNCULUS_DATA 0x0230.
Diffstat (limited to 'src/net/eathena/homunculushandler.cpp')
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 41 |
1 files changed, 41 insertions, 0 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 |