summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-09 12:05:10 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-09 12:05:10 +0300
commite26586ce6efaceb31ec534d488dace4d73702f56 (patch)
tree547db865ddb0fb3c82f60ebee0bb13879e465c4c
parentd472a3cf2a40169ffb4eca900e9cc53e6bcc4cc7 (diff)
downloadmanaverse-e26586ce6efaceb31ec534d488dace4d73702f56.tar.gz
manaverse-e26586ce6efaceb31ec534d488dace4d73702f56.tar.bz2
manaverse-e26586ce6efaceb31ec534d488dace4d73702f56.tar.xz
manaverse-e26586ce6efaceb31ec534d488dace4d73702f56.zip
Add skill attributes with effect id what will play on caster and target while casting skill.
New skill attributes: skillCastingSrcEffectId - will play this effect on caster while casting skill skillCastingDstEffectId - will play this effect on target while casting skill. This effects for casting skill, not for skill attack.
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/gui/widgets/skillinfo.cpp2
-rw-r--r--src/gui/widgets/skillinfo.h2
-rw-r--r--src/gui/windows/skilldialog.cpp28
-rw-r--r--src/gui/windows/skilldialog.h6
-rw-r--r--src/net/eathena/beinghandler.cpp35
6 files changed, 68 insertions, 7 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index a6a0911b6..c0dce23ff 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -503,6 +503,8 @@ DefaultsData* getPathsDefaults()
AddDEF("completeQuestEffectId", -1);
AddDEF("skillLevelUpEffectId", -1);
AddDEF("skillRemoveEffectId", -1);
+ AddDEF("skillCastingSrcEffectId", -1);
+ AddDEF("skillCastingDstEffectId", -1);
AddDEF("minimaps", "graphics/minimaps/");
AddDEF("maps", "maps/");
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp
index 6aef016e5..864d973ea 100644
--- a/src/gui/widgets/skillinfo.cpp
+++ b/src/gui/widgets/skillinfo.cpp
@@ -54,6 +54,8 @@ SkillInfo::SkillInfo() :
duration(0),
durationTime(0),
cooldown(0),
+ castingSrcEffectId(-1),
+ castingDstEffectId(-1),
type(SkillType::Unknown),
owner(SkillOwner::Player),
modifiable(false),
diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h
index 4ab0331af..3e4d99820 100644
--- a/src/gui/widgets/skillinfo.h
+++ b/src/gui/widgets/skillinfo.h
@@ -62,6 +62,8 @@ struct SkillInfo final
int duration;
int durationTime;
int cooldown;
+ int castingSrcEffectId;
+ int castingDstEffectId;
SkillType::SkillType type;
SkillOwner::Type owner;
bool modifiable;
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 04d883402..31cf81ad4 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -325,6 +325,10 @@ void SkillDialog::loadXmlFile(const std::string &fileName)
node, "errorText", name);
skill->alwaysVisible = XML::getBoolProperty(
node, "alwaysVisible", false);
+ skill->castingSrcEffectId = XML::getProperty(
+ node, "castingSrcEffectId", -1);
+ skill->castingDstEffectId = XML::getProperty(
+ node, "castingDstEffectId", -1);
skill->visible = skill->alwaysVisible;
model->addSkill(skill);
mSkills[id] = skill;
@@ -614,6 +618,30 @@ void SkillDialog::playRemoveEffect(const int id) const
paths.getIntValue("skillRemoveEffectId"));
}
+void SkillDialog::playCastingSrcEffect(const int id, Being *const being) const
+{
+ if (!effectManager)
+ return;
+ SkillInfo *const info = getSkill(id);
+ if (!info)
+ return;
+ effectManager->triggerDefault(info->castingSrcEffectId,
+ being,
+ paths.getIntValue("skillCastingSrcEffectId"));
+}
+
+void SkillDialog::playCastingDstEffect(const int id, Being *const being) const
+{
+ if (!effectManager)
+ return;
+ SkillInfo *const info = getSkill(id);
+ if (!info)
+ return;
+ effectManager->triggerDefault(info->castingDstEffectId,
+ being,
+ paths.getIntValue("skillCastingDstEffectId"));
+}
+
void SkillDialog::useSkill(const SkillInfo *const info)
{
const SkillData *const data = info->data;
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 0b2180191..9388e96cb 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -120,6 +120,12 @@ class SkillDialog final : public Window,
void playRemoveEffect(const int id) const;
+ void playCastingSrcEffect(const int id,
+ Being *const being) const;
+
+ void playCastingDstEffect(const int id,
+ Being *const being) const;
+
void slowLogic();
void removeSkill(const int id);
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 7667edcbb..3f0ecf4ac 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -34,8 +34,8 @@
#include "input/keyboardconfig.h"
+#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
-
#include "gui/windows/outfitwindow.h"
#include "net/serverfeatures.h"
@@ -1137,15 +1137,36 @@ void BeingHandler::processMapType(Net::MessageIn &msg)
void BeingHandler::processSkillCasting(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readInt32("src id");
- msg.readInt32("dst id");
- msg.readInt16("dst x");
- msg.readInt16("dst y");
- msg.readInt16("skill id");
+ // +++ need use other parameters
+
+ const int srcId = msg.readInt32("src id");
+ const int dstId = msg.readInt32("dst id");
+ const int dstX = msg.readInt16("dst x");
+ const int dstY = msg.readInt16("dst y");
+ const int skillId = msg.readInt16("skill id");
msg.readInt32("property"); // can be used to trigger effect
msg.readInt32("cast time");
msg.readInt8("dispossable");
+
+ if (!effectManager)
+ return;
+
+ if (srcId == 0)
+ {
+ UNIMPLIMENTEDPACKET;
+ return;
+ }
+ else if (dstId != 0)
+ { // being to being
+ Being *const srcBeing = actorManager->findBeing(srcId);
+ Being *const dstBeing = actorManager->findBeing(dstId);
+ skillDialog->playCastingSrcEffect(skillId, srcBeing);
+ skillDialog->playCastingDstEffect(skillId, dstBeing);
+ }
+ else if (dstX != 0 || dstY != 0)
+ { // being to position
+ UNIMPLIMENTEDPACKET;
+ }
}
void BeingHandler::processBeingStatusChange(Net::MessageIn &msg)