Core/Objects: Cleanup SmoothPhasing code - move to separate files and better integrate it with visibility system
Port From (https://github.com/TrinityCore/TrinityCore/commit/70442041300bb0a1146717497fd5f771d874befa)
This commit is contained in:
@@ -167,9 +167,11 @@ namespace Game.Maps
|
||||
|
||||
public class VisibleChangesNotifier : Notifier
|
||||
{
|
||||
public VisibleChangesNotifier(WorldObject obj)
|
||||
ICollection<WorldObject> i_objects;
|
||||
|
||||
public VisibleChangesNotifier(ICollection<WorldObject> objects)
|
||||
{
|
||||
i_object = obj;
|
||||
i_objects = objects;
|
||||
}
|
||||
|
||||
public override void Visit(IList<Player> objs)
|
||||
@@ -177,19 +179,14 @@ namespace Game.Maps
|
||||
for (var i = 0; i < objs.Count; ++i)
|
||||
{
|
||||
Player player = objs[i];
|
||||
if (player.GetGUID() == i_object.GetGUID())
|
||||
return;
|
||||
|
||||
player.UpdateVisibilityOf(i_object);
|
||||
player.UpdateVisibilityOf(i_objects);
|
||||
|
||||
if (player.HasSharedVision())
|
||||
foreach (var visionPlayer in player.GetSharedVisionList())
|
||||
{
|
||||
foreach (var visionPlayer in player.GetSharedVisionList())
|
||||
{
|
||||
if (visionPlayer.seerView == player)
|
||||
visionPlayer.UpdateVisibilityOf(i_object);
|
||||
}
|
||||
}
|
||||
if (visionPlayer.seerView == player)
|
||||
visionPlayer.UpdateVisibilityOf(i_objects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,12 +195,9 @@ namespace Game.Maps
|
||||
for (var i = 0; i < objs.Count; ++i)
|
||||
{
|
||||
Creature creature = objs[i];
|
||||
if (creature.HasSharedVision())
|
||||
{
|
||||
foreach (var visionPlayer in creature.GetSharedVisionList())
|
||||
if (visionPlayer.seerView == creature)
|
||||
visionPlayer.UpdateVisibilityOf(i_object);
|
||||
}
|
||||
foreach (var visionPlayer in creature.GetSharedVisionList())
|
||||
if (visionPlayer.seerView == creature)
|
||||
visionPlayer.UpdateVisibilityOf(i_objects);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,12 +211,10 @@ namespace Game.Maps
|
||||
{
|
||||
Player pl = caster.ToPlayer();
|
||||
if (pl && pl.seerView == dynamicObject)
|
||||
pl.UpdateVisibilityOf(i_object);
|
||||
pl.UpdateVisibilityOf(i_objects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldObject i_object;
|
||||
}
|
||||
|
||||
public class PlayerRelocationNotifier : VisibleNotifier
|
||||
|
||||
+14
-7
@@ -4022,7 +4022,7 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
public TempSummon SummonCreature(uint entry, Position pos, SummonPropertiesRecord properties = null, uint duration = 0, WorldObject summoner = null, uint spellId = 0, uint vehId = 0, ObjectGuid privateObjectOwner = default, ObjectGuid replaceObject = default)
|
||||
public TempSummon SummonCreature(uint entry, Position pos, SummonPropertiesRecord properties = null, uint duration = 0, WorldObject summoner = null, uint spellId = 0, uint vehId = 0, ObjectGuid privateObjectOwner = default, SmoothPhasingInfo smoothPhasingInfo = null)
|
||||
{
|
||||
var mask = UnitTypeMask.Summon;
|
||||
if (properties != null)
|
||||
@@ -4072,10 +4072,6 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
WorldObject objectOwner = Global.ObjAccessor.GetWorldObject(summoner, privateObjectOwner);
|
||||
if (objectOwner != null)
|
||||
summoner = objectOwner;
|
||||
|
||||
Unit summonerUnit = summoner != null ? summoner.ToUnit() : null;
|
||||
|
||||
TempSummon summon;
|
||||
@@ -4112,8 +4108,19 @@ namespace Game.Maps
|
||||
summon.InitStats(duration);
|
||||
summon.SetPrivateObjectOwner(privateObjectOwner);
|
||||
|
||||
if (summoner != null && !replaceObject.IsEmpty())
|
||||
PhasingHandler.ReplaceObject(summoner, summon, replaceObject);
|
||||
if (smoothPhasingInfo != null)
|
||||
{
|
||||
if (summoner != null && smoothPhasingInfo.ReplaceObject.HasValue)
|
||||
{
|
||||
SmoothPhasingInfo originalSmoothPhasingInfo = smoothPhasingInfo;
|
||||
originalSmoothPhasingInfo.ReplaceObject = summon.GetGUID();
|
||||
summoner.GetOrCreateSmoothPhasing().SetViewerDependentInfo(privateObjectOwner, originalSmoothPhasingInfo);
|
||||
|
||||
summon.SetDemonCreatorGUID(privateObjectOwner);
|
||||
}
|
||||
|
||||
summon.GetOrCreateSmoothPhasing().SetSingleInfo(smoothPhasingInfo);
|
||||
}
|
||||
|
||||
if (!AddToMap(summon.ToCreature()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user