summaryrefslogtreecommitdiff
path: root/src/net/eathena/skillhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-02 16:41:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-02 16:41:10 +0300
commit00e080c7230e68ec62ba30a32ac13fbafcab1946 (patch)
tree612bcdfcd339f83cb86eb31a27287d2b455ac531 /src/net/eathena/skillhandler.cpp
parenta4fb6c80502e707c19ab70432418295ea4c48d6a (diff)
downloadplus-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.gz
plus-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.bz2
plus-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.xz
plus-00e080c7230e68ec62ba30a32ac13fbafcab1946.zip
eathena: add packet SMSG_PLAYER_UPDATE_SKILL 0x07e1.
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.