diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-01-02 14:19:35 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-10-04 00:19:38 +0200 |
commit | 9b924522d0549dd67b10e2cbdfc20297dd21e182 (patch) | |
tree | f0fcdf96902b7c497c1bc65db83621a8dfadf43a /src/server/scripts | |
parent | a131542855d23022714a97640be1c8d68a741c31 (diff) |
Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
Diffstat (limited to 'src/server/scripts')
-rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 22 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_instance.cpp | 161 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 1 |
3 files changed, 80 insertions, 104 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 72e3ffc6838..c242f96ae94 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -37,7 +37,6 @@ EndScriptData */ #include "DB2Stores.h" #include "GameTime.h" #include "GridNotifiersImpl.h" -#include "InstanceSaveMgr.h" #include "InstanceScript.h" #include "Language.h" #include "Log.h" @@ -1347,27 +1346,6 @@ public: return true; } - if (!difficulty) - { - handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->MapName[handler->GetSessionDbcLocale()]); - for (DifficultyEntry const* diff : sDifficultyStore) - { - if (sDB2Manager.GetMapDifficultyData(mapId, Difficulty(diff->ID))) - { - handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]); - sInstanceSaveMgr->ForceGlobalReset(mapId, 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(mapId, Difficulty(*difficulty)); - } return true; } diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index a00853298c0..63d43b525bf 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -28,7 +28,6 @@ EndScriptData */ #include "DB2Stores.h" #include "GameTime.h" #include "Group.h" -#include "InstanceSaveMgr.h" #include "InstanceScript.h" #include "Language.h" #include "Map.h" @@ -65,89 +64,89 @@ public: return commandTable; } - static bool HandleInstanceListBindsCommand(ChatHandler* handler) + static bool HandleInstanceListBindsCommand(ChatHandler* /*handler*/) { - Player* player = handler->getSelectedPlayer(); - if (!player) - player = handler->GetSession()->GetPlayer(); - - uint32 counter = 0; - for (DifficultyEntry const* difficulty : sDifficultyStore) - { - auto binds = player->GetBoundInstances(Difficulty(difficulty->ID)); - if (binds != player->m_boundInstances.end()) - { - for (auto const& [mapId, bind] : binds->second) - { - InstanceSave* save = bind.save; - std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); - handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, mapId, save->GetInstanceId(), bind.perm ? "yes" : "no", bind.extendState == EXTEND_STATE_EXPIRED ? "expired" : bind.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - counter++; - } - } - } - handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_PLAYER_BINDS, counter); - - counter = 0; - if (Group* group = player->GetGroup()) - { - for (DifficultyEntry const* difficulty : sDifficultyStore) - { - auto binds = group->GetBoundInstances(Difficulty(difficulty->ID)); - if (binds != group->GetBoundInstanceEnd()) - { - for (auto const& [mapId, bind] : binds->second) - { - InstanceSave* save = bind.save; - std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); - handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, mapId, save->GetInstanceId(), bind.perm ? "yes" : "no", "-", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - counter++; - } - } - } - } - handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_GROUP_BINDS, counter); + //Player* player = handler->getSelectedPlayer(); + //if (!player) + // player = handler->GetSession()->GetPlayer(); + + //uint32 counter = 0; + //for (DifficultyEntry const* difficulty : sDifficultyStore) + //{ + // auto binds = player->GetBoundInstances(Difficulty(difficulty->ID)); + // if (binds != player->m_boundInstances.end()) + // { + // for (auto const& [mapId, bind] : binds->second) + // { + // InstanceSave* save = bind.save; + // std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); + // handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, mapId, save->GetInstanceId(), bind.perm ? "yes" : "no", bind.extendState == EXTEND_STATE_EXPIRED ? "expired" : bind.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + // counter++; + // } + // } + //} + //handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_PLAYER_BINDS, counter); + + //counter = 0; + //if (Group* group = player->GetGroup()) + //{ + // for (DifficultyEntry const* difficulty : sDifficultyStore) + // { + // auto binds = group->GetBoundInstances(Difficulty(difficulty->ID)); + // if (binds != group->GetBoundInstanceEnd()) + // { + // for (auto const& [mapId, bind] : binds->second) + // { + // InstanceSave* save = bind.save; + // std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); + // handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, mapId, save->GetInstanceId(), bind.perm ? "yes" : "no", "-", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + // counter++; + // } + // } + // } + //} + //handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_GROUP_BINDS, counter); return true; } - static bool HandleInstanceUnbindCommand(ChatHandler* handler, Variant<uint32, EXACT_SEQUENCE("all")> mapArg, Optional<uint8> difficultyArg) + static bool HandleInstanceUnbindCommand(ChatHandler* /*handler*/, Variant<uint32, EXACT_SEQUENCE("all")> /*mapArg*/, Optional<uint8> /*difficultyArg*/) { - Player* player = handler->getSelectedPlayer(); - if (!player) - player = handler->GetSession()->GetPlayer(); - - uint16 counter = 0; - uint32 mapId = 0; - - if (mapArg.holds_alternative<uint32>()) - { - mapId = mapArg.get<uint32>(); - if (!mapId) - return false; - } - - for (DifficultyEntry const* difficulty : sDifficultyStore) - { - auto binds = player->GetBoundInstances(Difficulty(difficulty->ID)); - if (binds != player->m_boundInstances.end()) - { - for (auto itr = binds->second.begin(); itr != binds->second.end();) - { - InstanceSave const* save = itr->second.save; - if (itr->first != player->GetMapId() && (!mapId || mapId == itr->first) && (!difficultyArg || difficultyArg == save->GetDifficultyID())) - { - std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); - handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); - player->UnbindInstance(itr, binds); - counter++; - } - else - ++itr; - } - } - } - handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBOUND, counter); + //Player* player = handler->getSelectedPlayer(); + //if (!player) + // player = handler->GetSession()->GetPlayer(); + + //uint16 counter = 0; + //uint32 mapId = 0; + + //if (mapArg.holds_alternative<uint32>()) + //{ + // mapId = mapArg.get<uint32>(); + // if (!mapId) + // return false; + //} + + //for (DifficultyEntry const* difficulty : sDifficultyStore) + //{ + // auto binds = player->GetBoundInstances(Difficulty(difficulty->ID)); + // if (binds != player->m_boundInstances.end()) + // { + // for (auto itr = binds->second.begin(); itr != binds->second.end();) + // { + // InstanceSave const* save = itr->second.save; + // if (itr->first != player->GetMapId() && (!mapId || mapId == itr->first) && (!difficultyArg || difficultyArg == save->GetDifficultyID())) + // { + // std::string timeleft = secsToTimeString(save->GetResetTime() - GameTime::GetGameTime(), TimeFormat::ShortText); + // handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + // player->UnbindInstance(itr, binds); + // counter++; + // } + // else + // ++itr; + // } + // } + //} + //handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBOUND, counter); return true; } @@ -156,9 +155,9 @@ public: { handler->PSendSysMessage(LANG_COMMAND_INST_STAT_LOADED_INST, sMapMgr->GetNumInstances()); handler->PSendSysMessage(LANG_COMMAND_INST_STAT_PLAYERS_IN, sMapMgr->GetNumPlayersInInstances()); - handler->PSendSysMessage(LANG_COMMAND_INST_STAT_SAVES, sInstanceSaveMgr->GetNumInstanceSaves()); - handler->PSendSysMessage(LANG_COMMAND_INST_STAT_PLAYERSBOUND, sInstanceSaveMgr->GetNumBoundPlayersTotal()); - handler->PSendSysMessage(LANG_COMMAND_INST_STAT_GROUPSBOUND, sInstanceSaveMgr->GetNumBoundGroupsTotal()); + //handler->PSendSysMessage(LANG_COMMAND_INST_STAT_SAVES, sInstanceSaveMgr->GetNumInstanceSaves()); + //handler->PSendSysMessage(LANG_COMMAND_INST_STAT_PLAYERSBOUND, sInstanceSaveMgr->GetNumBoundPlayersTotal()); + //handler->PSendSysMessage(LANG_COMMAND_INST_STAT_GROUPSBOUND, sInstanceSaveMgr->GetNumBoundGroupsTotal()); return true; } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 68b6d1b4d3e..32724dd6824 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -27,7 +27,6 @@ #include "DisableMgr.h" #include "GridNotifiers.h" #include "Group.h" -#include "InstanceSaveMgr.h" #include "IpAddress.h" #include "IPLocation.h" #include "Item.h" |