From 709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Sep 2014 18:34:40 +0300 Subject: eathena: add mercenary skills. --- src/net/eathena/mercenaryhandler.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src') 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( + 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); + } + } } } -- cgit v1.2.3-70-g09d2