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:
hondacrx
2021-11-01 11:19:47 -04:00
parent fd24603aea
commit ffb04bffc0
12 changed files with 132 additions and 109 deletions
+3 -3
View File
@@ -112,7 +112,7 @@ namespace Game
return;
}
if (pet != GetPlayer().GetPet() && pet != GetPlayer().GetCharm())
if (pet != GetPlayer().GetPet() && pet != GetPlayer().GetCharmed())
{
Log.outError(LogFilter.Network, "HandlePetStopAttack: {0} isn't a pet or charmed creature of player {1}", packet.PetGUID.ToString(), GetPlayer().GetName());
return;
@@ -609,7 +609,7 @@ namespace Game
return;
}
if (pet != GetPlayer().GetGuardianPet() && pet != GetPlayer().GetCharm())
if (pet != GetPlayer().GetGuardianPet() && pet != GetPlayer().GetCharmed())
{
Log.outError(LogFilter.Network, "WorldSession.HandlePetSpellAutocast: {0} isn't pet of player {1} ({2}).",
packet.PetGUID.ToString(), GetPlayer().GetName(), GetPlayer().GetGUID().ToString());
@@ -660,7 +660,7 @@ namespace Game
}
// This opcode is also sent from charmed and possessed units (players and creatures)
if (caster != GetPlayer().GetGuardianPet() && caster != GetPlayer().GetCharm())
if (caster != GetPlayer().GetGuardianPet() && caster != GetPlayer().GetCharmed())
{
Log.outError(LogFilter.Network, "WorldSession.HandlePetCastSpell: {0} isn't pet of player {1} ({2}).", petCastSpell.PetGUID.ToString(), GetPlayer().GetName(), GetPlayer().GetGUID().ToString());
return;