From 2291f18b6366312916903de6cfe973379ebd536d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 May 2017 01:53:49 +0300 Subject: Add chat command for move monster in priority attack list into one position down. --- src/actions/commands.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/actions/commands.h | 1 + 2 files changed, 40 insertions(+) (limited to 'src/actions') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 13b88499b..71dd2e7b4 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1996,6 +1996,45 @@ impHandler(movePriorityAttackUp) socialWindow->updateAttackFilter(); return true; } + return false; +} + +impHandler(movePriorityAttackDown) +{ + if (!actorManager) + return false; + const std::string args = event.args; + const int idx = actorManager + ->getPriorityAttackMobIndex(args); + const int size = actorManager->getPriorityAttackMobsSize(); + if (idx + 1 < size) + { + std::list mobs + = actorManager->getPriorityAttackMobs(); + 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->setPriorityAttackMobs(mobs); + actorManager->rebuildPriorityAttackMobs(); + break; + } + ++ it; + ++ it2; + } + + if (socialWindow) + socialWindow->updateAttackFilter(); + return true; + } + return false; } } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 26907f7ac..6c2c6cc9d 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -156,6 +156,7 @@ namespace Actions decHandler(moveAttackUp); decHandler(moveAttackDown); decHandler(movePriorityAttackUp); + decHandler(movePriorityAttackDown); } // namespace Actions #undef decHandler -- cgit v1.2.3-60-g2f50