summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-10 01:07:30 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-10 01:07:30 +0300
commit8ca5407776fa9c3038b608f9caf401952c2631d6 (patch)
tree1a30526373487e4c4a18b22a965b75ca369b0fdd /src/actions
parente62ca47b5ec9c8e630933a674c1419d911722f85 (diff)
downloadmv-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.gz
mv-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.bz2
mv-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.xz
mv-8ca5407776fa9c3038b608f9caf401952c2631d6.zip
Add chat command for move monster in attack list into one position down.
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp38
-rw-r--r--src/actions/commands.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 79ed06f3c..d033413bd 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -1897,6 +1897,8 @@ impHandler0(outfitToChat)
impHandler(moveAttackUp)
{
+ if (!actorManager)
+ return false;
const std::string args = event.args;
const int idx = actorManager->getAttackMobIndex(args);
if (idx > 0)
@@ -1926,4 +1928,40 @@ impHandler(moveAttackUp)
return false;
}
+impHandler(moveAttackDown)
+{
+ if (!actorManager)
+ return false;
+ const std::string args = event.args;
+ const int idx = actorManager->getAttackMobIndex(args);
+ const int size = actorManager->getAttackMobsSize();
+ if (idx + 1 < size)
+ {
+ std::list<std::string> mobs
+ = actorManager->getAttackMobs();
+ std::list<std::string>::iterator it = mobs.begin();
+ std::list<std::string>::iterator it2 = it;
+ while (it != mobs.end())
+ {
+ if (*it == args)
+ {
+ ++ it2;
+ if (it2 == mobs.end())
+ break;
+
+ mobs.splice(it, mobs, it2);
+ actorManager->setAttackMobs(mobs);
+ actorManager->rebuildAttackMobs();
+ break;
+ }
+ ++ it;
+ ++ it2;
+ }
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 6b97f295e..5340f1b5b 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -154,6 +154,7 @@ namespace Actions
decHandler(partyAutoItemShare);
decHandler(outfitToChat);
decHandler(moveAttackUp);
+ decHandler(moveAttackDown);
} // namespace Actions
#undef decHandler