summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-18 12:52:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-18 12:52:40 +0300
commit64fc4f0ccf6cfb25864e67e3f8cf29d4671c64d5 (patch)
treefa6dff8aa086eef0a8ecfc0eb67bb2028b86e772 /src
parentea62d7b05f332f13e3a88ee24c3946600a77a085 (diff)
downloadManaVerse-64fc4f0ccf6cfb25864e67e3f8cf29d4671c64d5.tar.gz
ManaVerse-64fc4f0ccf6cfb25864e67e3f8cf29d4671c64d5.tar.bz2
ManaVerse-64fc4f0ccf6cfb25864e67e3f8cf29d4671c64d5.tar.xz
ManaVerse-64fc4f0ccf6cfb25864e67e3f8cf29d4671c64d5.zip
Add skills duration/cooldown.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/skillinfo.cpp2
-rw-r--r--src/gui/widgets/skillinfo.h2
-rw-r--r--src/gui/windows/skilldialog.cpp15
-rw-r--r--src/gui/windows/skilldialog.h2
-rw-r--r--src/net/eathena/skillhandler.cpp7
5 files changed, 25 insertions, 3 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp
index c3987eed0..feb4d7023 100644
--- a/src/gui/widgets/skillinfo.cpp
+++ b/src/gui/widgets/skillinfo.cpp
@@ -50,6 +50,8 @@ SkillInfo::SkillInfo() :
id(0),
range(0),
sp(0),
+ duration(0),
+ durationTime(0),
type(SkillType::Unknown),
modifiable(false),
visible(false)
diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h
index f41bc46fc..fcca73dce 100644
--- a/src/gui/widgets/skillinfo.h
+++ b/src/gui/widgets/skillinfo.h
@@ -57,6 +57,8 @@ struct SkillInfo final
unsigned int id;
int range;
int sp;
+ int duration;
+ int durationTime;
SkillType::SkillType type;
bool modifiable;
bool visible;
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 07a60b594..073cf11bd 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -48,6 +48,7 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
+#include "utils/timer.h"
#include "resources/beingcommon.h"
#include "resources/skillconsts.h"
@@ -424,6 +425,20 @@ SkillInfo* SkillDialog::getSkillByItem(const int itemId) const
return nullptr;
}
+void SkillDialog::setSkillDuration(const int id, const int duration)
+{
+ SkillMap::const_iterator it = mSkills.find(id);
+ if (it != mSkills.end())
+ {
+ SkillInfo *const info = (*it).second;
+ if (info)
+ {
+ info->duration = duration / 10;
+ info->durationTime = tick_time;
+ }
+ }
+}
+
void SkillDialog::widgetResized(const Event &event)
{
Window::widgetResized(event);
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 17641cd0f..b01adcabd 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -95,6 +95,8 @@ class SkillDialog final : public Window,
SkillInfo* getSkillByItem(const int itemId) const A_WARN_UNUSED;
+ void setSkillDuration(const int id, const int duration);
+
bool hasSkills() const A_WARN_UNUSED
{ return !mSkills.empty(); }
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index da8b94d11..640b6fbbc 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -149,9 +149,10 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
void SkillHandler::processSkillCoolDown(Net::MessageIn &msg)
{
- // +++ need add cool down bar in skills window and in ministatus?
- msg.readInt16("skill id");
- msg.readInt32("duration");
+ const int skillId = msg.readInt16("skill id");
+ const int duration = msg.readInt32("duration");
+ if (skillDialog)
+ skillDialog->setSkillDuration(skillId, duration);
}
} // namespace EAthena