summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gui/windows/skilldialog.cpp39
3 files changed, 39 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 24ea0e3fa..c44faad51 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1224,6 +1224,8 @@ SET(SRCS
listeners/statlistener.cpp
listeners/statlistener.h
listeners/tablemodellistener.h
+ listeners/textskilllistener.cpp
+ listeners/textskilllistener.h
listeners/tooltiplistener.cpp
listeners/tooltiplistener.h
listeners/updatestatuslistener.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 9e7d0a6fe..86315260c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1039,6 +1039,8 @@ manaplus_SOURCES += main.cpp \
listeners/renamelistener.cpp \
listeners/renamelistener.h \
listeners/requesttradelistener.h \
+ listeners/textskilllistener.cpp \
+ listeners/textskilllistener.h \
particle/rotationalparticle.cpp \
particle/rotationalparticle.h \
navigationmanager.cpp \
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 3567a23bb..60eb32b64 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -40,6 +40,10 @@
#include "gui/widgets/tabs/skilltab.h"
+#include "gui/windows/textdialog.h"
+
+#include "listeners/textskilllistener.h"
+
#include "net/playerhandler.h"
#include "net/skillhandler.h"
@@ -53,6 +57,11 @@
SkillDialog *skillDialog = nullptr;
+namespace
+{
+ TextSkillListener textSkillListener;
+} // namespace
+
static SkillOwner::Type parseOwner(const std::string &str)
{
if (str == "player")
@@ -687,7 +696,9 @@ void SkillDialog::useSkill(const SkillInfo *const info,
{
if (!info || !localPlayer)
return;
- const SkillData *const data = info->data;
+ const SkillData *data = info->data;
+ if (!data)
+ data = info->getData1(info->level);
if (data)
{
const std::string cmd = data->invokeCmd;
@@ -733,9 +744,29 @@ void SkillDialog::useSkill(const SkillInfo *const info,
int x = 0;
int y = 0;
viewport->getMouseTile(x, y);
- skillHandler->usePos(info->id,
- info->level,
- x, y);
+ if (info->useTextParameter)
+ {
+ textSkillListener.setSkill(info->id,
+ x,
+ y,
+ info->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
+ {
+ skillHandler->usePos(info->id,
+ info->level,
+ x, y);
+ }
break;
}