Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr

Port From (https://github.com/TrinityCore/TrinityCore/commit/9b924522d0549dd67b10e2cbdfc20297dd21e182)
This commit is contained in:
hondacrx
2022-10-04 10:57:04 -04:00
parent 793cf91a24
commit 66c7047a29
27 changed files with 186 additions and 1545 deletions
@@ -879,28 +879,6 @@ namespace Game.Chat
return true;
}
if (difficulty == 0)
{
handler.SendSysMessage($"Resetting all difficulties for '{mEntry.MapName[handler.GetSessionDbcLocale()]}'.");
foreach (var diff in CliDB.DifficultyStorage.Values)
{
if (Global.DB2Mgr.GetMapDifficultyData(mapId, (Difficulty)diff.Id) != null)
{
handler.SendSysMessage($"Resetting difficulty {diff.Id} for '{mEntry.MapName[handler.GetSessionDbcLocale()]}'.");
Global.InstanceSaveMgr.ForceGlobalReset(mapId, (Difficulty)diff.Id);
}
}
}
else if (mEntry.IsNonRaidDungeon() && difficulty == (int)Difficulty.Normal)
{
handler.SendSysMessage($"'{mEntry.MapName[handler.GetSessionDbcLocale()]}' does not have any permanent saves for difficulty {(Difficulty)difficulty}.");
}
else
{
handler.SendSysMessage($"Resetting difficulty {(Difficulty)difficulty} for '{mEntry.MapName[handler.GetSessionDbcLocale()]}'.");
Global.InstanceSaveMgr.ForceGlobalReset(mapId, (Difficulty)difficulty);
}
return true;
}
@@ -74,7 +74,7 @@ namespace Game.Chat
[Command("listbinds", RBACPermissions.CommandInstanceListbinds)]
static bool HandleInstanceListBindsCommand(CommandHandler handler)
{
Player player = handler.GetSelectedPlayer();
/*Player player = handler.GetSelectedPlayer();
if (!player)
player = handler.GetSession().GetPlayer();
@@ -110,7 +110,7 @@ namespace Game.Chat
}
}
}
handler.SendSysMessage("group binds: {0}", counter);
handler.SendSysMessage("group binds: {0}", counter);*/
return true;
}
@@ -186,9 +186,9 @@ namespace Game.Chat
{
handler.SendSysMessage("instances loaded: {0}", Global.MapMgr.GetNumInstances());
handler.SendSysMessage("players in instances: {0}", Global.MapMgr.GetNumPlayersInInstances());
handler.SendSysMessage("instance saves: {0}", Global.InstanceSaveMgr.GetNumInstanceSaves());
handler.SendSysMessage("players bound: {0}", Global.InstanceSaveMgr.GetNumBoundPlayersTotal());
handler.SendSysMessage("groups bound: {0}", Global.InstanceSaveMgr.GetNumBoundGroupsTotal());
//handler.SendSysMessage("instance saves: {0}", Global.InstanceSaveMgr.GetNumInstanceSaves());
//handler.SendSysMessage("players bound: {0}", Global.InstanceSaveMgr.GetNumBoundPlayersTotal());
//handler.SendSysMessage("groups bound: {0}", Global.InstanceSaveMgr.GetNumBoundGroupsTotal());
return true;
}
@@ -196,7 +196,7 @@ namespace Game.Chat
[Command("unbind", RBACPermissions.CommandInstanceUnbind)]
static bool HandleInstanceUnbindCommand(CommandHandler handler, string mapArg, byte? difficultyArg)
{
Player player = handler.GetSelectedPlayer();
/*Player player = handler.GetSelectedPlayer();
if (!player)
player = handler.GetSession().GetPlayer();
@@ -223,7 +223,7 @@ namespace Game.Chat
}
}
}
handler.SendSysMessage("instances unbound: {0}", counter);
handler.SendSysMessage("instances unbound: {0}", counter);*/
return true;
}