From 44db10623278632b890b0e2cea4fe7add7d4cc74 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Mar 2015 15:54:55 +0300 Subject: eathena: impliment packet SMSG_PLAYER_DELETE_SKILL. --- src/gui/windows/skilldialog.cpp | 18 ++++++++++++++++++ src/gui/windows/skilldialog.h | 2 ++ src/net/eathena/skillhandler.cpp | 16 +++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 65134aac1..bbefbd5a7 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -389,6 +389,24 @@ void SkillDialog::loadXmlFile(const std::string &fileName) } } +void SkillDialog::removeSkill(const int id) +{ + const SkillMap::const_iterator it = mSkills.find(id); + + if (it != mSkills.end()) + { + SkillInfo *const info = it->second; + if (info) + { + info->level = 0; + info->update(); + PlayerInfo::setSkillLevel(id, 0); + if (!info->alwaysVisible) + info->visible = false; + } + } +} + bool SkillDialog::updateSkill(const int id, const int range, const bool modifiable, diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 6c3ab71a3..2628a3d80 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -118,6 +118,8 @@ class SkillDialog final : public Window, void slowLogic(); + void removeSkill(const int id); + static void useSkill(const SkillInfo *const info); private: diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 374952014..742b3f0f6 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -292,9 +292,19 @@ void SkillHandler::processSkillUpdate(Net::MessageIn &msg) void SkillHandler::processSkillDelete(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; - // ignored, because after this packet server will send all skills. - msg.readInt32("skill id"); + int updateSkill = 0; + const int skillId = msg.readInt16("skill id"); + const int oldLevel = PlayerInfo::getSkillLevel(skillId); + if (oldLevel && oldLevel != 0) + updateSkill = skillId; + PlayerInfo::setSkillLevel(skillId, 0); + if (skillDialog) + { + skillDialog->removeSkill(skillId); + skillDialog->update(); + if (updateSkill) + skillDialog->playUpdateEffect(updateSkill); + } } void SkillHandler::processSkillCoolDown(Net::MessageIn &msg) -- cgit v1.2.3-70-g09d2