summaryrefslogtreecommitdiff
path: root/src/gui/windows/skilldialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-23 01:00:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-23 01:00:04 +0300
commit26c14e5269feafec782166f80c31fe1a7c2b3d53 (patch)
tree3e3af33e53421438332a8738f273d032d7165640 /src/gui/windows/skilldialog.cpp
parent9a50b90628eb61e1e48db35a36e9ad5c2a9a2bd5 (diff)
downloadmanaverse-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.gz
manaverse-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.bz2
manaverse-26c14e5269feafec782166f80c31fe1a7c2b3d53.tar.xz
manaverse-26c14e5269feafec782166f80c31fe1a7c2b3d53.zip
Add chat command skill.
New chat command: /skill ID[ LEVEL[ TEXT]]
Diffstat (limited to 'src/gui/windows/skilldialog.cpp')
-rw-r--r--src/gui/windows/skilldialog.cpp58
1 files changed, 43 insertions, 15 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 44d02b573..e163923cc 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -704,9 +704,27 @@ void SkillDialog::playCastingDstTileEffect(const int id,
paths.getIntValue("skillCastingGroundEffectId"));
}
+void SkillDialog::useSkill(const int skillId,
+ const AutoTarget autoTarget,
+ int level,
+ const bool withText,
+ const std::string &text)
+{
+ SkillInfo *const info = skillDialog->getSkill(skillId);
+ if (!info)
+ return;
+ useSkill(info,
+ autoTarget,
+ level,
+ withText,
+ text);
+}
+
void SkillDialog::useSkill(const SkillInfo *const info,
const AutoTarget autoTarget,
- int level)
+ int level,
+ const bool withText,
+ const std::string &text)
{
if (!info || !localPlayer)
return;
@@ -766,20 +784,30 @@ void SkillDialog::useSkill(const SkillInfo *const info,
viewport->getMouseTile(x, y);
if (info->useTextParameter)
{
- textSkillListener.setSkill(info->id,
- x,
- y,
- level);
- TextDialog *const dialog = CREATEWIDGETR(TextDialog,
- // TRANSLATORS: text skill dialog header
- strprintf(_("Add text to skill %s"),
- data->name.c_str()),
- // TRANSLATORS: text skill dialog field
- _("Text: "));
- dialog->setModal(Modal_true);
- textSkillListener.setDialog(dialog);
- dialog->setActionEventId("ok");
- dialog->addActionListener(&textSkillListener);
+ if (withText)
+ {
+ skillHandler->usePos(info->id,
+ level,
+ x, y,
+ text);
+ }
+ else
+ {
+ textSkillListener.setSkill(info->id,
+ x,
+ y,
+ level);
+ TextDialog *const dialog = CREATEWIDGETR(TextDialog,
+ // TRANSLATORS: text skill dialog header
+ strprintf(_("Add text to skill %s"),
+ data->name.c_str()),
+ // TRANSLATORS: text skill dialog field
+ _("Text: "));
+ dialog->setModal(Modal_true);
+ textSkillListener.setDialog(dialog);
+ dialog->setActionEventId("ok");
+ dialog->addActionListener(&textSkillListener);
+ }
}
else
{