summaryrefslogtreecommitdiff
path: root/src/net/eathena/homunculushandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-24 20:59:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-24 20:59:51 +0300
commit580928d0c66ed4fe5274133f7eb19e8d60d76446 (patch)
tree9d5b4e52bdc47f4b22e93dd7130dd45a0fa4f9b8 /src/net/eathena/homunculushandler.cpp
parent2e59954b0a4c754098ca25829ace944814fabd80 (diff)
downloadmanaplus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.gz
manaplus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.bz2
manaplus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.xz
manaplus-580928d0c66ed4fe5274133f7eb19e8d60d76446.zip
eathena: add packet SMSG_HOMUNCULUS_SKILLS 0x0235.
Diffstat (limited to 'src/net/eathena/homunculushandler.cpp')
-rw-r--r--src/net/eathena/homunculushandler.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp
index c00025daa..e99f7f1d0 100644
--- a/src/net/eathena/homunculushandler.cpp
+++ b/src/net/eathena/homunculushandler.cpp
@@ -22,6 +22,10 @@
#include "logger.h"
+#include "being/playerinfo.h"
+
+#include "gui/windows/skilldialog.h"
+
#include "net/ea/eaprotocol.h"
#include "net/eathena/messageout.h"
@@ -39,6 +43,7 @@ HomunculusHandler::HomunculusHandler() :
{
static const uint16_t _messages[] =
{
+ SMSG_HOMUNCULUS_SKILLS,
0
};
handledMessages = _messages;
@@ -49,9 +54,43 @@ void HomunculusHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
+ case SMSG_HOMUNCULUS_SKILLS:
+ processHomunculusSkills(msg);
+ break;
+
default:
break;
}
}
+void HomunculusHandler::processHomunculusSkills(Net::MessageIn &msg)
+{
+ if (skillDialog)
+ skillDialog->hideSkills(SkillOwner::Homunculus);
+
+ const int count = (msg.readInt16("len") - 4) / 37;
+ for (int f = 0; f < count; f ++)
+ {
+ const int skillId = msg.readInt16("skill id");
+ const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
+ msg.readInt16("inf"));
+ const int level = msg.readInt16("skill level");
+ const int sp = msg.readInt16("sp");
+ const int range = msg.readInt16("range");
+ const std::string name = msg.readString(24, "skill name");
+ const int up = msg.readUInt8("up flag");
+ PlayerInfo::setSkillLevel(skillId, level);
+ if (skillDialog)
+ {
+ if (!skillDialog->updateSkill(skillId, range, up, inf, sp))
+ {
+ skillDialog->addSkill(SkillOwner::Homunculus,
+ skillId, name, level, range, up, inf, sp);
+ }
+ }
+ }
+ if (skillDialog)
+ skillDialog->updateModels();
+}
+
} // namespace EAthena