summaryrefslogtreecommitdiff
path: root/src
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
parent2e59954b0a4c754098ca25829ace944814fabd80 (diff)
downloadplus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.gz
plus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.bz2
plus-580928d0c66ed4fe5274133f7eb19e8d60d76446.tar.xz
plus-580928d0c66ed4fe5274133f7eb19e8d60d76446.zip
eathena: add packet SMSG_HOMUNCULUS_SKILLS 0x0235.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/homunculushandler.cpp39
-rw-r--r--src/net/eathena/homunculushandler.h3
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h2
4 files changed, 45 insertions, 1 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
diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h
index 9a2e5bd76..25ea59622 100644
--- a/src/net/eathena/homunculushandler.h
+++ b/src/net/eathena/homunculushandler.h
@@ -38,6 +38,9 @@ class HomunculusHandler final : public MessageHandler,
A_DELETE_COPY(HomunculusHandler)
void handleMessage(Net::MessageIn &msg) override final;
+
+ protected:
+ void processHomunculusSkills(Net::MessageIn &msg);
};
} // namespace EAthena
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index d12377763..feead5c1a 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 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 3fa1bbb5c..024743c8f 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -258,6 +258,8 @@
#define SMSG_MERCENARY_INFO 0x029b
#define SMSG_MERCENARY_SKILLS 0x029d
+#define SMSG_HOMUNCULUS_SKILLS 0x0235
+
/**********************************
* Packets from client to server *
**********************************/