diff options
author | treeston <treeston.mmoc@gmail.com> | 2017-06-03 16:44:54 +0200 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2020-07-16 21:47:15 +0200 |
commit | 4179036bbeb775aa631b262fc38ab8bd9ccd502b (patch) | |
tree | 0ddb793f4e4b7aa4b7be0be673355adb630eaa58 /src | |
parent | 259bde591444980c27a17524c140f078c4159f55 (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.
(cherry picked from commit a3b198c7e19d6627e6078702ffcbaa67969e4943)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 81bc3e533e1..ae5a2a6bc84 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1238,31 +1238,62 @@ 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; + } + if (!mEntry->IsDungeon()) + { + handler->PSendSysMessage("'%s' is not a dungeon map.", + mEntry->MapName[handler->GetSessionDbcLocale()]); + return true; + } int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1; if (!sDifficultyStore.HasRecord(difficulty) || difficulty < -1) + { + handler->PSendSysMessage("Invalid difficulty %d.", difficulty); return false; + } + if (difficulty >= 0 && !sDB2Manager.GetMapDifficultyData(mEntry->ID, Difficulty(difficulty))) + { + handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", + difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); + return true; + } if (difficulty == -1) { - for (DifficultyEntry const* difficulty : sDifficultyStore) + handler->PSendSysMessage("Resetting all difficulties for '%s'.", + mEntry->MapName[handler->GetSessionDbcLocale()]); + for (DifficultyEntry const* diff : sDifficultyStore) { - if (sDB2Manager.GetMapDifficultyData(map, Difficulty(difficulty->ID))) - sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(difficulty->ID)); + if (sDB2Manager.GetMapDifficultyData(map, Difficulty(diff->ID))) + { + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", + diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]); + sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(diff->ID)); + } } } + else if (mEntry->IsNonRaidDungeon() && difficulty == DIFFICULTY_NORMAL) + { + handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", + mEntry->MapName[handler->GetSessionDbcLocale()], difficulty); + } else + { + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", + difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(difficulty)); + } return true; } |