Core/Unit: Store charmer and charmed pointers on Unit directly, no more map lookups for Unit::GetCharmer and Unit::GetCharmed
Port From (https://github.com/TrinityCore/TrinityCore/commit/a5989dcee9150565e7f4b8e3f7a62a414a484a3f)
This commit is contained in:
@@ -1335,7 +1335,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// if we have charmed npc, stun him also (everywhere)
|
||||
Unit charm = player.GetCharm();
|
||||
Unit charm = player.GetCharmed();
|
||||
if (charm)
|
||||
if (charm.GetTypeId() == TypeId.Unit)
|
||||
charm.AddUnitFlag(UnitFlags.Stunned);
|
||||
@@ -1383,7 +1383,7 @@ namespace Game.Entities
|
||||
player.ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
// if we have charmed npc, remove stun also
|
||||
Unit charm = player.GetCharm();
|
||||
Unit charm = player.GetCharmed();
|
||||
if (charm)
|
||||
if (charm.GetTypeId() == TypeId.Unit && charm.HasUnitFlag(UnitFlags.Stunned) && !charm.HasUnitState(UnitState.Stunned))
|
||||
charm.RemoveUnitFlag(UnitFlags.Stunned);
|
||||
|
||||
Reference in New Issue
Block a user