aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2017-06-03 16:44:54 +0200
committertreeston <treeston.mmoc@gmail.com>2017-06-03 16:44:54 +0200
commita3b198c7e19d6627e6078702ffcbaa67969e4943 (patch)
treea27d8730dc68015e5737f5b196138016c105b05b /src
parenta97439e8d63c0a78bda8a6ed4801f122385936e3 (diff)
Some improvements to .debug raidreset command. Now supports heroic difficulty 5-man dungeons and outputs sensible text, as opposed to silently doing (or not doing) stuff.
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index bf69bc4defb..18b7c077608 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -1489,29 +1489,56 @@ public:
return true;
}
- static bool HandleDebugRaidResetCommand(ChatHandler* /*handler*/, char const* args)
+ static bool HandleDebugRaidResetCommand(ChatHandler* handler, char const* args)
{
char* map_str = args ? strtok((char*)args, " ") : nullptr;
char* difficulty_str = args ? strtok(nullptr, " ") : nullptr;
int32 map = map_str ? atoi(map_str) : -1;
- if (map <= 0)
- return false;
- MapEntry const* mEntry = sMapStore.LookupEntry(map);
- if (!mEntry || !mEntry->IsRaid())
+ MapEntry const* mEntry = (map >= 0) ? sMapStore.LookupEntry(map) : nullptr;
+ if (!mEntry)
+ {
+ handler->PSendSysMessage("Invalid map specified.");
return false;
- int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1;
+ }
+ if (!mEntry->IsDungeon())
+ {
+ handler->PSendSysMessage("'%s' is not a dungeon map.", mEntry->name[LOCALE_enUS]);
+ return true;
+ }
+ Difficulty difficulty = Difficulty(difficulty_str ? atoi(difficulty_str) : -1);
if (difficulty >= MAX_RAID_DIFFICULTY || difficulty < -1)
+ {
+ handler->PSendSysMessage("Invalid difficulty %d - specify in range [0,%d).", difficulty, MAX_RAID_DIFFICULTY);
return false;
+ }
+ if (difficulty >= 0 && !GetMapDifficultyData(mEntry->MapID, difficulty))
+ {
+ handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->name[LOCALE_enUS]);
+ return true;
+ }
- if (difficulty == -1)
- for (uint8 diff = 0; diff < MAX_RAID_DIFFICULTY; ++diff)
+ if (difficulty == Difficulty(-1))
+ {
+ handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->name[LOCALE_enUS]);
+ for (uint8 diff = (mEntry->IsRaid() ? 0 : 1); diff < (mEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY); ++diff)
{
if (GetMapDifficultyData(mEntry->MapID, Difficulty(diff)))
+ {
+ handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff, mEntry->name[LOCALE_enUS]);
sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(diff));
+ }
}
+ }
+ else if (mEntry->IsNonRaidDungeon() && difficulty == DUNGEON_DIFFICULTY_NORMAL)
+ {
+ handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", mEntry->name[LOCALE_enUS], difficulty);
+ }
else
- sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(difficulty));
+ {
+ handler->PSendSysMessage("Resetting difficulty %d for '%s'.", difficulty, mEntry->name[LOCALE_enUS]);
+ sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, difficulty);
+ }
return true;
}