summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-10 01:21:18 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-10 01:21:18 +0300
commit5ac88f3197be965804827751e8679cc6dd59b188 (patch)
treeb1b1852ba9c386029cdcc4128826d1bea4f955a9
parent8ca5407776fa9c3038b608f9caf401952c2631d6 (diff)
downloadplus-5ac88f3197be965804827751e8679cc6dd59b188.tar.gz
plus-5ac88f3197be965804827751e8679cc6dd59b188.tar.bz2
plus-5ac88f3197be965804827751e8679cc6dd59b188.tar.xz
plus-5ac88f3197be965804827751e8679cc6dd59b188.zip
Add chat command for move monster in priority attack list into one position up.
-rw-r--r--src/actions/commands.cpp34
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/dyetool/actions/commands.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp38
-rw-r--r--src/input/inputactionmap.h6
6 files changed, 47 insertions, 34 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index d033413bd..13b88499b 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1960,8 +1960,42 @@ impHandler(moveAttackDown)
if (socialWindow)
socialWindow->updateAttackFilter();
+ return true;
}
return false;
}
+impHandler(movePriorityAttackUp)
+{
+ if (!actorManager)
+ return false;
+ const std::string args = event.args;
+ const int idx = actorManager->
+ getPriorityAttackMobIndex(args);
+ if (idx > 0)
+ {
+ std::list<std::string> mobs
+ = actorManager->getPriorityAttackMobs();
+ std::list<std::string>::iterator it = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
+ while (it != mobs.end())
+ {
+ if (*it == args)
+ {
+ -- it2;
+ mobs.splice(it2, mobs, it);
+ actorManager->setPriorityAttackMobs(mobs);
+ actorManager->rebuildPriorityAttackMobs();
+ break;
+ }
+ ++ it;
+ ++ it2;
+ }
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+ return true;
+ }
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 5340f1b5b..26907f7ac 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -155,6 +155,7 @@ namespace Actions
decHandler(outfitToChat);
decHandler(moveAttackUp);
decHandler(moveAttackDown);
+ decHandler(movePriorityAttackUp);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp
index 40ada1494..87645ed4f 100644
--- a/src/dyetool/actions/commands.cpp
+++ b/src/dyetool/actions/commands.cpp
@@ -155,5 +155,6 @@ impHandlerVoid(partyAutoItemShare)
impHandlerVoid(outfitToChat)
impHandlerVoid(moveAttackUp)
impHandlerVoid(moveAttackDown)
+impHandlerVoid(movePriorityAttackUp)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 6e0a2560c..59d7cf59c 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -690,6 +690,7 @@ enumStart(InputAction)
COMMAND_SEND_GUI_KEY,
MOVE_ATTACK_UP,
MOVE_ATTACK_DOWN,
+ MOVE_PRIORITY_ATTACK_UP,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index d1d5ddd8a..aa5a05625 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1239,37 +1239,6 @@ void PopupMenu::handleLink(const std::string &link,
dialog->setActionEventId("ok");
dialog->addActionListener(&mPlayerListener);
}
- else if (link == "priority moveup")
- {
- if (actorManager)
- {
- const int idx = actorManager->
- getPriorityAttackMobIndex(mName);
- if (idx > 0)
- {
- std::list<std::string> mobs
- = actorManager->getPriorityAttackMobs();
- std::list<std::string>::iterator it = mobs.begin();
- std::list<std::string>::iterator it2 = it;
- while (it != mobs.end())
- {
- if (*it == mName)
- {
- -- it2;
- mobs.splice(it2, mobs, it);
- actorManager->setPriorityAttackMobs(mobs);
- actorManager->rebuildPriorityAttackMobs();
- break;
- }
- ++ it;
- ++ it2;
- }
-
- if (socialWindow)
- socialWindow->updateAttackFilter();
- }
- }
- }
else if (link == "priority movedown")
{
if (localPlayer && actorManager)
@@ -2099,9 +2068,10 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y,
const int size = actorManager->getPriorityAttackMobsSize();
if (idx > 0)
{
- // TRANSLATORS: popup menu item
- // TRANSLATORS: move attack target up
- mBrowserBox->addRow("priority moveup", _("Move up"));
+ mBrowserBox->addRow("/movepriorityattackup 'NAME'",
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: move attack target up
+ _("Move up"));
}
if (idx + 1 < size)
{
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 7751bbaae..6ea9ea303 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5630,6 +5630,12 @@ static const InputActionData inputActionData
"attackmovedown|moveattackdown",
UseArgs_true,
Protected_true},
+ {"keyMovePriorityAttackUp",
+ defaultAction(&Actions::movePriorityAttackUp),
+ InputCondition::ENABLED,
+ "attackmovepriorityup|movepriorityattackup",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction