From 8ca5407776fa9c3038b608f9caf401952c2631d6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 May 2017 01:07:30 +0300 Subject: Add chat command for move monster in attack list into one position down. --- src/actions/commands.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/actions/commands.cpp') 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 mobs + = actorManager->getAttackMobs(); + std::list::iterator it = mobs.begin(); + std::list::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 -- cgit v1.2.3-70-g09d2