summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-22 19:16:53 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-22 19:25:44 +0300
commit09e8d7ba7a5e29e4991b21056e358a7dcf0dd2df (patch)
tree4d6667c430fa75dd020a0c55272c4a110cfce841
parentc10c3b3e5ae49719a6f52873b003ef2643df3e60 (diff)
downloadplus-09e8d7ba7a5e29e4991b21056e358a7dcf0dd2df.tar.gz
plus-09e8d7ba7a5e29e4991b21056e358a7dcf0dd2df.tar.bz2
plus-09e8d7ba7a5e29e4991b21056e358a7dcf0dd2df.tar.xz
plus-09e8d7ba7a5e29e4991b21056e358a7dcf0dd2df.zip
Add chat command /selectskilllevel for select skill level in skills dialog.
-rw-r--r--src/actions/commands.cpp14
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/dyetool/actions/commands.cpp2
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/windows/skilldialog.cpp13
-rw-r--r--src/gui/windows/skilldialog.h3
-rw-r--r--src/input/inputactionmap.h6
7 files changed, 39 insertions, 1 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 337174c25..5dcbc3d93 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -40,6 +40,7 @@
#include "gui/viewport.h"
#include "gui/windows/chatwindow.h"
+#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/outfitwindow.h"
@@ -1062,4 +1063,17 @@ impHandler(slide)
return false;
}
+impHandler(selectSkillLevel)
+{
+ int skill = 0;
+ int level = 0;
+
+ if (skillDialog && parse2Int(event.args, skill, level))
+ {
+ skillDialog->selectSkillLevel(skill, level);
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index c3102b8c0..0e71f409c 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -90,6 +90,7 @@ namespace Actions
decHandler(confGet);
decHandler(serverConfGet);
decHandler(slide);
+ decHandler(selectSkillLevel);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 17aa14083..60206a5a7 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -90,5 +90,5 @@ impHandlerVoid(serverConfSet)
impHandlerVoid(confGet)
impHandlerVoid(serverConfGet)
impHandlerVoid(slide)
-
+impHandlerVoid(selectSkillLevel)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 628f70b82..936aa9403 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -605,6 +605,7 @@ enumStart(InputAction)
CHANGE_TARGETING_TYPE,
TEST_INFO,
SLIDE,
+ SELECT_SKILL_LEVEL,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index bcc023731..49b89c951 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -831,3 +831,16 @@ void SkillDialog::slowLogic()
}
}
}
+
+void SkillDialog::selectSkillLevel(const int skillId,
+ const int level)
+{
+ SkillInfo *const info = getSkill(skillId);
+ if (!info)
+ return;
+ if (level > info->level)
+ info->selectedLevel = info->level;
+ else
+ info->selectedLevel = level;
+ info->update();
+}
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 1e5740f58..47458e2db 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -147,6 +147,9 @@ class SkillDialog final : public Window,
SkillData *getSkillDataByLevel(const int id,
const int level) const;
+ void selectSkillLevel(const int skillId,
+ const int level);
+
private:
void addSkillDuration(SkillInfo *const skill);
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 7beafa6c3..c814e5ee6 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5072,6 +5072,12 @@ static const InputActionData inputActionData
"slide",
UseArgs_true,
Protected_false},
+ {"keySelectSkillLevel",
+ defaultAction(&Actions::selectSkillLevel),
+ InputCondition::INGAME,
+ "selectskilllevel",
+ UseArgs_true,
+ Protected_false},
};
#undef defaultAction