summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/widgets/skilldata.cpp4
-rw-r--r--src/gui/widgets/skilldata.h1
-rw-r--r--src/gui/windows/skilldialog.cpp49
-rw-r--r--src/gui/windows/skilldialog.h8
-rw-r--r--src/net/eathena/skillhandler.cpp2
6 files changed, 49 insertions, 16 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 82adc3b0c..a6a0911b6 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -502,6 +502,7 @@ DefaultsData* getPathsDefaults()
AddDEF("newQuestEffectId", -1);
AddDEF("completeQuestEffectId", -1);
AddDEF("skillLevelUpEffectId", -1);
+ AddDEF("skillRemoveEffectId", -1);
AddDEF("minimaps", "graphics/minimaps/");
AddDEF("maps", "maps/");
diff --git a/src/gui/widgets/skilldata.cpp b/src/gui/widgets/skilldata.cpp
index e1bf50d79..f06dede07 100644
--- a/src/gui/widgets/skilldata.cpp
+++ b/src/gui/widgets/skilldata.cpp
@@ -40,7 +40,9 @@ SkillData::SkillData() :
particle(),
invokeCmd(),
soundHit(std::string(), 0),
- soundMiss(std::string(), 0)
+ soundMiss(std::string(), 0),
+ updateEffectId(-1),
+ removeEffectId(-1)
{
}
diff --git a/src/gui/widgets/skilldata.h b/src/gui/widgets/skilldata.h
index 5885b1ba9..03bc021a9 100644
--- a/src/gui/widgets/skilldata.h
+++ b/src/gui/widgets/skilldata.h
@@ -44,6 +44,7 @@ struct SkillData final
SoundInfo soundMiss;
int updateEffectId;
+ int removeEffectId;
SkillData();
A_DELETE_COPY(SkillData)
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 2804b8734..fb82633fe 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -368,6 +368,8 @@ void SkillDialog::loadXmlFile(const std::string &fileName)
node, "invokeCmd", "");
data->updateEffectId = XML::getProperty(
node, "levelUpEffectId", -1);
+ data->removeEffectId = XML::getProperty(
+ node, "removeEffectId", -1);
skill->addData(level, data);
}
@@ -576,27 +578,46 @@ void SkillDialog::updateQuest(const int var, const int val)
}
}
-void SkillDialog::playUpdateEffect(const int id) const
+SkillData *SkillDialog::getSkillData(const int id) const
{
- if (!effectManager)
- return;
const SkillMap::const_iterator it = mSkills.find(id);
if (it != mSkills.end())
{
SkillInfo *const info = it->second;
if (info)
- {
- const SkillData *const data = info->data;
- if (!data)
- return;
- int effectId = data->updateEffectId;
- if (effectId == -1)
- effectId = paths.getIntValue("skillLevelUpEffectId");
- if (effectId == -1)
- return;
- effectManager->trigger(effectId, localPlayer);
- }
+ return info->data;
}
+ return nullptr;
+}
+
+void SkillDialog::triggerEffect(int effectId,
+ const int defaultEffectId) const
+{
+ if (!effectManager)
+ return;
+ if (effectId == -1)
+ effectId = defaultEffectId;
+ if (effectId == -1)
+ return;
+ effectManager->trigger(effectId, localPlayer);
+}
+
+void SkillDialog::playUpdateEffect(const int id) const
+{
+ const SkillData *const data = getSkillData(id);
+ if (!data)
+ return;
+ triggerEffect(data->updateEffectId,
+ paths.getIntValue("skillLevelUpEffectId"));
+}
+
+void SkillDialog::playRemoveEffect(const int id) const
+{
+ const SkillData *const data = getSkillData(id);
+ if (!data)
+ return;
+ triggerEffect(data->removeEffectId,
+ paths.getIntValue("skillRemoveEffectId"));
}
void SkillDialog::useSkill(const SkillInfo *const info)
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 2628a3d80..1fa182e8b 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -36,6 +36,7 @@ class SkillModel;
class Tab;
class TabbedArea;
+struct SkillData;
struct SkillInfo;
/**
@@ -116,15 +117,22 @@ class SkillDialog final : public Window,
void playUpdateEffect(const int id) const;
+ void playRemoveEffect(const int id) const;
+
void slowLogic();
void removeSkill(const int id);
static void useSkill(const SkillInfo *const info);
+ SkillData *getSkillData(const int id) const;
+
private:
void addSkillDuration(SkillInfo *const skill);
+ void triggerEffect(int effectId,
+ const int defaultEffectId) const;
+
typedef std::map<int, SkillInfo*> SkillMap;
SkillMap mSkills;
std::vector<SkillInfo*> mDurations;
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index 742b3f0f6..af6dd2857 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -303,7 +303,7 @@ void SkillHandler::processSkillDelete(Net::MessageIn &msg)
skillDialog->removeSkill(skillId);
skillDialog->update();
if (updateSkill)
- skillDialog->playUpdateEffect(updateSkill);
+ skillDialog->playRemoveEffect(updateSkill);
}
}