summaryrefslogtreecommitdiff
path: root/src/net/eathena/skillhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-02 13:23:54 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-02 13:23:54 +0300
commit2e0f3379ea7f8440815b6615345778874fcf5a3a (patch)
tree2ddd711082003e900f851451dcd3a5506ae8cc73 /src/net/eathena/skillhandler.cpp
parentddb66943018528128b65f2d9967ad2393c3f2863 (diff)
downloadplus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.gz
plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.bz2
plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.xz
plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.zip
eathena: add packet SMSG_PLAYER_ADD_SKILL 0x0111.
Diffstat (limited to 'src/net/eathena/skillhandler.cpp')
-rw-r--r--src/net/eathena/skillhandler.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index b6e2b2cd2..de1b53c18 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -58,6 +58,7 @@ SkillHandler::SkillHandler() :
SMSG_PLAYER_SKILL_COOLDOWN,
SMSG_PLAYER_SKILL_COOLDOWN_LIST,
SMSG_SKILL_SNAP,
+ SMSG_PLAYER_ADD_SKILL,
0
};
handledMessages = _messages;
@@ -92,6 +93,10 @@ void SkillHandler::handleMessage(Net::MessageIn &msg)
processSkillSnap(msg);
break;
+ case SMSG_PLAYER_ADD_SKILL:
+ processSkillAdd(msg);
+ break;
+
default:
break;
}
@@ -174,6 +179,34 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
}
}
+void SkillHandler::processSkillAdd(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 std::string name = msg.readString(24, "skill name");
+ 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, name, level, range, up, inf, sp);
+ }
+ skillDialog->update();
+ if (updateSkill)
+ skillDialog->playUpdateEffect(updateSkill);
+ }
+}
+
void SkillHandler::processSkillCoolDown(Net::MessageIn &msg)
{
const int skillId = msg.readInt16("skill id");