diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-02 13:23:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-02 13:23:54 +0300 |
commit | 2e0f3379ea7f8440815b6615345778874fcf5a3a (patch) | |
tree | 2ddd711082003e900f851451dcd3a5506ae8cc73 | |
parent | ddb66943018528128b65f2d9967ad2393c3f2863 (diff) | |
download | plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.gz plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.bz2 plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.tar.xz plus-2e0f3379ea7f8440815b6615345778874fcf5a3a.zip |
eathena: add packet SMSG_PLAYER_ADD_SKILL 0x0111.
-rw-r--r-- | src/net/eathena/protocol.h | 1 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 33 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.h | 2 |
3 files changed, 36 insertions, 0 deletions
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index d2ea66446..4a88e44db 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -78,6 +78,7 @@ #define SMSG_PLAYER_ARROW_EQUIP 0x013c #define SMSG_PLAYER_ARROW_MESSAGE 0x013b #define SMSG_PLAYER_SKILLS 0x010f +#define SMSG_PLAYER_ADD_SKILL 0x0111 #define SMSG_PLAYER_SKILL_UP 0x010e #define SMSG_PLAYER_HEAL 0x013d #define SMSG_PLAYER_SKILL_COOLDOWN 0x043d 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"); diff --git a/src/net/eathena/skillhandler.h b/src/net/eathena/skillhandler.h index f18d6ac96..571947491 100644 --- a/src/net/eathena/skillhandler.h +++ b/src/net/eathena/skillhandler.h @@ -61,6 +61,8 @@ class SkillHandler final : public MessageHandler, public Ea::SkillHandler void processSkillCoolDownList(Net::MessageIn &msg); void processSkillSnap(Net::MessageIn &msg); + + void processSkillAdd(Net::MessageIn &msg); }; } // namespace EAthena |