summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 6b51d2270..235afecb5 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -33,11 +33,14 @@
#include "being/homunculusinfo.h"
#include "being/playerinfo.h"
+#include "const/resources/skill.h"
+
#include "gui/viewport.h"
#include "gui/popups/popupmenu.h"
#include "gui/shortcut/emoteshortcut.h"
+#include "gui/shortcut/itemshortcut.h"
#include "gui/windows/mailwindow.h"
@@ -45,6 +48,7 @@
#include "gui/windows/inventorywindow.h"
#include "gui/windows/npcdialog.h"
#include "gui/windows/outfitwindow.h"
+#include "gui/windows/shortcutwindow.h"
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
@@ -71,6 +75,8 @@
#include "resources/map/map.h"
+#include "resources/skill/skillinfo.h"
+
#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
#include "utils/copynpaste.h"
@@ -2091,4 +2097,40 @@ impHandler(movePriorityAttackDown)
return false;
}
+impHandler(addSkillShortcut)
+{
+ const std::string args = event.args;
+ if (args.empty() ||
+ itemShortcutWindow == nullptr)
+ {
+ return false;
+ }
+ const SkillInfo *restrict const skill = skillDialog->getSkill(
+ atoi(args.c_str()));
+ if (skill == nullptr)
+ return false;
+
+ const int num = itemShortcutWindow->getTabIndex();
+ if (num < 0 ||
+ num >= CAST_S32(SHORTCUT_TABS) ||
+ num == SHORTCUT_AUTO_TAB)
+ {
+ return false;
+ }
+
+ ItemShortcut *const selShortcut = itemShortcut[num];
+ const int index = selShortcut->getFreeIndex();
+ if (index < 0)
+ return true;
+
+ selShortcut->setItem(index,
+ skill->id + SKILL_MIN_ID,
+ fromInt(skill->customSelectedLevel, ItemColor));
+ selShortcut->setItemData(index,
+ skill->toDataStr());
+
+// popupMenu->showSkillLevelPopup(skill);
+ return true;
+}
+
} // namespace Actions