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
+9 -15
View File
@@ -5411,22 +5411,16 @@ namespace Game.Spells
return SpellCastResult.SummonPending;
// check if our map is dungeon
MapRecord map = CliDB.MapStorage.LookupByKey(m_caster.GetMapId());
if (map.IsDungeon())
InstanceMap map = m_caster.GetMap().ToInstanceMap();
if (map != null)
{
uint mapId = m_caster.GetMap().GetId();
Difficulty difficulty = m_caster.GetMap().GetDifficultyID();
if (map.IsRaid())
{
InstanceBind targetBind = target.GetBoundInstance(mapId, difficulty);
if (targetBind != null)
{
InstanceBind casterBind = m_caster.ToPlayer().GetBoundInstance(mapId, difficulty);
if (casterBind != null)
if (targetBind.perm && targetBind.save != casterBind.save)
return SpellCastResult.TargetLockedToRaidInstance;
}
}
uint mapId = map.GetId();
Difficulty difficulty = map.GetDifficultyID();
InstanceLock mapLock = map.GetInstanceLock();
if (mapLock != null)
if (Global.InstanceLockMgr.CanJoinInstanceLock(target.GetGUID(), new MapDb2Entries(mapId, difficulty), mapLock) != TransferAbortReason.None)
return SpellCastResult.TargetLockedToRaidInstance;
if (!target.Satisfy(Global.ObjectMgr.GetAccessRequirement(mapId, difficulty), mapId))
return SpellCastResult.BadTargets;
}