summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-20 18:34:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-20 18:34:40 +0300
commit709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e (patch)
tree34b2b1d7eaea0c07e5e2e8e7a9d2d8ce7e10ae08 /src
parent5f7a8dd28733fd460578e43c6b2ea4990afa0670 (diff)
downloadmanaplus-709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e.tar.gz
manaplus-709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e.tar.bz2
manaplus-709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e.tar.xz
manaplus-709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e.zip
eathena: add mercenary skills.
Diffstat (limited to 'src')
-rw-r--r--src/net/eathena/mercenaryhandler.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp
index 0000d0139..2a44e86ca 100644
--- a/src/net/eathena/mercenaryhandler.cpp
+++ b/src/net/eathena/mercenaryhandler.cpp
@@ -24,6 +24,9 @@
#include "logger.h"
#include "being/being.h"
+#include "being/playerinfo.h"
+
+#include "gui/windows/skilldialog.h"
#include "net/ea/eaprotocol.h"
@@ -112,17 +115,28 @@ void MercenaryHandler::processMercenaryInfo(Net::MessageIn &msg)
void MercenaryHandler::processMercenarySkills(Net::MessageIn &msg)
{
- // +++ need create if need mercenary being and update stats
+ if (skillDialog)
+ skillDialog->hideSkills(SkillOwner::Mercenary);
const int count = (msg.readInt16("len") - 4) / 37;
for (int f = 0; f < count; f ++)
{
- msg.readInt16("skill id");
- msg.readInt32("inf");
- msg.readInt16("level");
- msg.readInt16("sp");
- msg.readInt16("attack range");
- msg.readString(24, "name");
- msg.readUInt8("upgradable");
+ const int skillId = msg.readInt16("skill id");
+ const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
+ msg.readInt32("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::Mercenary,
+ skillId, name, level, range, up, inf, sp);
+ }
+ }
}
}