From 00e080c7230e68ec62ba30a32ac13fbafcab1946 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 2 Oct 2014 16:41:10 +0300 Subject: eathena: add packet SMSG_PLAYER_UPDATE_SKILL 0x07e1. --- src/net/eathena/skillhandler.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/net/eathena/skillhandler.cpp') diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 595f5a8a2..73a3793ef 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -60,6 +60,7 @@ SkillHandler::SkillHandler() : SMSG_SKILL_SNAP, SMSG_PLAYER_ADD_SKILL, SMSG_PLAYER_DELETE_SKILL, + SMSG_PLAYER_UPDATE_SKILL, 0 }; handledMessages = _messages; @@ -98,6 +99,10 @@ void SkillHandler::handleMessage(Net::MessageIn &msg) processSkillAdd(msg); break; + case SMSG_PLAYER_UPDATE_SKILL: + processSkillUpdate(msg); + break; + case SMSG_PLAYER_DELETE_SKILL: processSkillDelete(msg); break; @@ -212,6 +217,33 @@ void SkillHandler::processSkillAdd(Net::MessageIn &msg) } } +void SkillHandler::processSkillUpdate(Net::MessageIn &msg) +{ + int updateSkill = 0; + 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 int up = msg.readUInt8("up flag"); + const int oldLevel = PlayerInfo::getSkillLevel(skillId); + if (oldLevel && oldLevel != level) + updateSkill = skillId; + PlayerInfo::setSkillLevel(skillId, level); + if (skillDialog) + { + if (!skillDialog->updateSkill(skillId, range, up, inf, sp)) + { + skillDialog->addSkill(SkillOwner::Player, + skillId, "", level, range, up, inf, sp); + } + skillDialog->update(); + if (updateSkill) + skillDialog->playUpdateEffect(updateSkill); + } +} + void SkillHandler::processSkillDelete(Net::MessageIn &msg) { // ignored, because after this packet server will send all skills. -- cgit v1.2.3-60-g2f50