summaryrefslogtreecommitdiff
path: root/src/net/eathena/skillhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/skillhandler.cpp')
-rw-r--r--src/net/eathena/skillhandler.cpp32
1 files changed, 32 insertions, 0 deletions
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<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 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.