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:
@@ -1253,7 +1253,7 @@ namespace Game.DungeonFinding
|
||||
error = LfgTeleportResult.Exhaustion;
|
||||
else if (player.GetVehicle())
|
||||
error = LfgTeleportResult.OnTransport;
|
||||
else if (!player.GetCharmGUID().IsEmpty())
|
||||
else if (!player.GetCharmedGUID().IsEmpty())
|
||||
error = LfgTeleportResult.ImmuneToSummons;
|
||||
else if (player.HasAura(9454)) // check Freeze debuff
|
||||
error = LfgTeleportResult.NoReturnLocation;
|
||||
|
||||
@@ -970,7 +970,7 @@ namespace Game.Entities
|
||||
|
||||
public void StopCastingCharm()
|
||||
{
|
||||
Unit charm = GetCharm();
|
||||
Unit charm = GetCharmed();
|
||||
if (!charm)
|
||||
return;
|
||||
|
||||
@@ -981,12 +981,12 @@ namespace Game.Entities
|
||||
else if (charm.IsVehicle())
|
||||
ExitVehicle();
|
||||
}
|
||||
if (!GetCharmGUID().IsEmpty())
|
||||
if (!GetCharmedGUID().IsEmpty())
|
||||
charm.RemoveCharmAuras();
|
||||
|
||||
if (!GetCharmGUID().IsEmpty())
|
||||
if (!GetCharmedGUID().IsEmpty())
|
||||
{
|
||||
Log.outFatal(LogFilter.Player, "Player {0} (GUID: {1} is not able to uncharm unit (GUID: {2} Entry: {3}, Type: {4})", GetName(), GetGUID(), GetCharmGUID(), charm.GetEntry(), charm.GetTypeId());
|
||||
Log.outFatal(LogFilter.Player, "Player {0} (GUID: {1} is not able to uncharm unit (GUID: {2} Entry: {3}, Type: {4})", GetName(), GetGUID(), GetCharmedGUID(), charm.GetEntry(), charm.GetTypeId());
|
||||
if (!charm.GetCharmerGUID().IsEmpty())
|
||||
{
|
||||
Log.outFatal(LogFilter.Player, "Charmed unit has charmer guid {0}", charm.GetCharmerGUID());
|
||||
@@ -1036,7 +1036,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void PossessSpellInitialize()
|
||||
{
|
||||
Unit charm = GetCharm();
|
||||
Unit charm = GetCharmed();
|
||||
if (!charm)
|
||||
return;
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Game.Entities
|
||||
base.InitSummon();
|
||||
|
||||
if (GetOwner().IsTypeId(TypeId.Player) && GetOwner().GetMinionGUID() == GetGUID()
|
||||
&& GetOwner().GetCharmGUID().IsEmpty())
|
||||
&& GetOwner().GetCharmedGUID().IsEmpty())
|
||||
{
|
||||
GetOwner().ToPlayer().CharmSpellInitialize();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ namespace Game.Entities
|
||||
//Charm
|
||||
public List<Unit> m_Controlled = new();
|
||||
List<Player> m_sharedVision = new();
|
||||
Unit m_charmer; // Unit that is charming ME
|
||||
Unit m_charmed; // Unit that is being charmed BY ME
|
||||
CharmInfo m_charmInfo;
|
||||
protected bool m_ControlledByPlayer;
|
||||
public ObjectGuid LastCharmerGUID { get; set; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Game.Entities
|
||||
|
||||
SetMinionGUID(unit.GetGUID());
|
||||
// show another pet bar if there is no charm bar
|
||||
if (GetTypeId() == TypeId.Player && GetCharmGUID().IsEmpty())
|
||||
if (GetTypeId() == TypeId.Player && GetCharmedGUID().IsEmpty())
|
||||
{
|
||||
if (unit.IsPet())
|
||||
ToPlayer().PetSpellInitialize();
|
||||
@@ -501,7 +501,13 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (!IsPlayer() || charmer.IsCreature())
|
||||
GetAI().OnCharmed(false); // AI will potentially schedule a charm ai update
|
||||
{
|
||||
UnitAI charmedAI = GetAI();
|
||||
if (charmedAI != null)
|
||||
charmedAI.OnCharmed(false); // AI will potentially schedule a charm ai update
|
||||
else
|
||||
ScheduleAIChange();
|
||||
}
|
||||
|
||||
Player player = ToPlayer();
|
||||
if (player != null)
|
||||
@@ -545,10 +551,8 @@ namespace Game.Entities
|
||||
{
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (GetCharmGUID().IsEmpty())
|
||||
SetCharmGUID(charm.GetGUID());
|
||||
else
|
||||
Log.outFatal(LogFilter.Unit, "Player {0} is trying to charm unit {1}, but it already has a charmed unit {2}", GetName(), charm.GetEntry(), GetCharmGUID());
|
||||
if (!SetCharmedData(charm))
|
||||
Log.outFatal(LogFilter.Unit, "Player {0} is trying to charm unit {1}, but it already has a charmed unit {2}", GetName(), charm.GetEntry(), GetCharmedGUID());
|
||||
|
||||
charm.m_ControlledByPlayer = true;
|
||||
// @todo maybe we can use this flag to check if controlled by player
|
||||
@@ -560,9 +564,7 @@ namespace Game.Entities
|
||||
// PvP, FFAPvP
|
||||
charm.SetPvpFlags(GetPvpFlags());
|
||||
|
||||
if (charm.GetCharmGUID().IsEmpty())
|
||||
charm.SetCharmerGUID(GetGUID());
|
||||
else
|
||||
if (!charm.SetCharmerData(this))
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is being charmed, but it already has a charmer {1}", charm.GetEntry(), charm.GetCharmerGUID());
|
||||
|
||||
_isWalkingBeforeCharm = charm.IsWalking();
|
||||
@@ -578,15 +580,11 @@ namespace Game.Entities
|
||||
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (GetCharmGUID() == charm.GetGUID())
|
||||
SetCharmGUID(ObjectGuid.Empty);
|
||||
else
|
||||
Log.outFatal(LogFilter.Unit, "Player {0} is trying to uncharm unit {1}, but it has another charmed unit {2}", GetName(), charm.GetEntry(), GetCharmGUID());
|
||||
if (!ClearCharmedData(charm))
|
||||
Log.outFatal(LogFilter.Unit, "Player {0} is trying to uncharm unit {1}, but it has another charmed unit {2}", GetName(), charm.GetEntry(), GetCharmedGUID());
|
||||
}
|
||||
|
||||
if (charm.GetCharmerGUID() == GetGUID())
|
||||
charm.SetCharmerGUID(ObjectGuid.Empty);
|
||||
else
|
||||
if (!charm.ClearCharmerData(this))
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is being uncharmed, but it has another charmer {1}", charm.GetEntry(), charm.GetCharmerGUID());
|
||||
|
||||
Player player = charm.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
@@ -625,7 +623,7 @@ namespace Game.Entities
|
||||
public Unit GetFirstControlled()
|
||||
{
|
||||
// Sequence: charmed, pet, other guardians
|
||||
Unit unit = GetCharm();
|
||||
Unit unit = GetCharmed();
|
||||
if (!unit)
|
||||
{
|
||||
ObjectGuid guid = GetMinionGUID();
|
||||
@@ -665,8 +663,8 @@ namespace Game.Entities
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is not able to release its pet {1}", GetEntry(), GetPetGUID());
|
||||
if (!GetMinionGUID().IsEmpty())
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is not able to release its minion {1}", GetEntry(), GetMinionGUID());
|
||||
if (!GetCharmGUID().IsEmpty())
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is not able to release its charm {1}", GetEntry(), GetCharmGUID());
|
||||
if (!GetCharmedGUID().IsEmpty())
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} is not able to release its charm {1}", GetEntry(), GetCharmedGUID());
|
||||
if (!IsPet()) // pets don't use the flag for this
|
||||
RemoveUnitFlag(UnitFlags.PetInCombat); // m_controlled is now empty, so we know none of our minions are in combat
|
||||
}
|
||||
|
||||
@@ -465,10 +465,12 @@ namespace Game.Entities
|
||||
|
||||
RemoveAllFollowers();
|
||||
|
||||
if (!GetCharmerGUID().IsEmpty())
|
||||
{
|
||||
Log.outFatal(LogFilter.Unit, "Unit {0} has charmer guid when removed from world", GetEntry());
|
||||
}
|
||||
if (IsCharmed())
|
||||
RemoveCharmedBy(null);
|
||||
|
||||
Cypher.Assert(!GetCharmedGUID().IsEmpty(), $"Unit {GetEntry()} has charmed guid when removed from world");
|
||||
Cypher.Assert(!GetCharmerGUID().IsEmpty(), $"Unit {GetEntry()} has charmer guid when removed from world");
|
||||
|
||||
Unit owner = GetOwner();
|
||||
if (owner != null)
|
||||
{
|
||||
@@ -665,7 +667,7 @@ namespace Game.Entities
|
||||
if (m_gameObj.Empty())
|
||||
return;
|
||||
|
||||
for (var i =0; i < m_gameObj.Count; ++i)
|
||||
for (var i = 0; i < m_gameObj.Count; ++i)
|
||||
{
|
||||
var obj = m_gameObj[i];
|
||||
if (spellid == 0 || obj.GetSpellId() == spellid)
|
||||
@@ -797,7 +799,7 @@ namespace Game.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void SetHoverHeight(float hoverHeight) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.HoverHeight), hoverHeight); }
|
||||
|
||||
public override float GetCollisionHeight()
|
||||
@@ -1209,31 +1211,17 @@ namespace Game.Entities
|
||||
AIUpdateTick(0, true);
|
||||
}
|
||||
|
||||
|
||||
public bool IsPossessing()
|
||||
{
|
||||
Unit u = GetCharm();
|
||||
Unit u = GetCharmed();
|
||||
if (u != null)
|
||||
return u.IsPossessed();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public Unit GetCharm()
|
||||
{
|
||||
ObjectGuid charm_guid = GetCharmGUID();
|
||||
if (!charm_guid.IsEmpty())
|
||||
{
|
||||
Unit pet = Global.ObjAccessor.GetUnit(this, charm_guid);
|
||||
if (pet != null)
|
||||
return pet;
|
||||
|
||||
Log.outError(LogFilter.Unit, "Unit.GetCharm: Charmed creature {0} not exist.", charm_guid);
|
||||
SetCharmGUID(ObjectGuid.Empty);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool IsCharmed() { return !GetCharmerGUID().IsEmpty(); }
|
||||
|
||||
public bool IsPossessed() { return HasUnitState(UnitState.Possessed); }
|
||||
|
||||
public void OnPhaseChange()
|
||||
@@ -1498,7 +1486,7 @@ namespace Game.Entities
|
||||
|
||||
bool HasInterruptFlag(SpellAuraInterruptFlags flags) { return m_interruptMask.HasAnyFlag(flags); }
|
||||
bool HasInterruptFlag(SpellAuraInterruptFlags2 flags) { return m_interruptMask2.HasAnyFlag(flags); }
|
||||
|
||||
|
||||
public void AddInterruptMask(SpellAuraInterruptFlags flags, SpellAuraInterruptFlags2 flags2)
|
||||
{
|
||||
m_interruptMask |= flags;
|
||||
@@ -1567,44 +1555,44 @@ namespace Game.Entities
|
||||
displayPower = PowerType.Mana;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
var powerTypeAuras = GetAuraEffectsByType(AuraType.ModPowerDisplay);
|
||||
if (!powerTypeAuras.Empty())
|
||||
{
|
||||
var powerTypeAuras = GetAuraEffectsByType(AuraType.ModPowerDisplay);
|
||||
if (!powerTypeAuras.Empty())
|
||||
AuraEffect powerTypeAura = powerTypeAuras.First();
|
||||
displayPower = (PowerType)powerTypeAura.GetMiscValue();
|
||||
}
|
||||
else if (GetTypeId() == TypeId.Player)
|
||||
{
|
||||
ChrClassesRecord cEntry = CliDB.ChrClassesStorage.LookupByKey(GetClass());
|
||||
if (cEntry != null && cEntry.DisplayPower < PowerType.Max)
|
||||
displayPower = cEntry.DisplayPower;
|
||||
}
|
||||
else if (GetTypeId() == TypeId.Unit)
|
||||
{
|
||||
Vehicle vehicle = GetVehicleKit();
|
||||
if (vehicle)
|
||||
{
|
||||
AuraEffect powerTypeAura = powerTypeAuras.First();
|
||||
displayPower = (PowerType)powerTypeAura.GetMiscValue();
|
||||
PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(vehicle.GetVehicleInfo().PowerDisplayID[0]);
|
||||
if (powerDisplay != null)
|
||||
displayPower = (PowerType)powerDisplay.ActualType;
|
||||
else if (GetClass() == Class.Rogue)
|
||||
displayPower = PowerType.Energy;
|
||||
}
|
||||
else if (GetTypeId() == TypeId.Player)
|
||||
else
|
||||
{
|
||||
ChrClassesRecord cEntry = CliDB.ChrClassesStorage.LookupByKey(GetClass());
|
||||
if (cEntry != null && cEntry.DisplayPower < PowerType.Max)
|
||||
displayPower = cEntry.DisplayPower;
|
||||
}
|
||||
else if (GetTypeId() == TypeId.Unit)
|
||||
{
|
||||
Vehicle vehicle = GetVehicleKit();
|
||||
if (vehicle)
|
||||
Pet pet = ToPet();
|
||||
if (pet)
|
||||
{
|
||||
PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(vehicle.GetVehicleInfo().PowerDisplayID[0]);
|
||||
if (powerDisplay != null)
|
||||
displayPower = (PowerType)powerDisplay.ActualType;
|
||||
else if (GetClass() == Class.Rogue)
|
||||
if (pet.GetPetType() == PetType.Hunter) // Hunter pets have focus
|
||||
displayPower = PowerType.Focus;
|
||||
else if (pet.IsPetGhoul() || pet.IsPetAbomination()) // DK pets have energy
|
||||
displayPower = PowerType.Energy;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pet pet = ToPet();
|
||||
if (pet)
|
||||
{
|
||||
if (pet.GetPetType() == PetType.Hunter) // Hunter pets have focus
|
||||
displayPower = PowerType.Focus;
|
||||
else if (pet.IsPetGhoul() || pet.IsPetAbomination()) // DK pets have energy
|
||||
displayPower = PowerType.Energy;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPowerType(displayPower);
|
||||
@@ -1848,7 +1836,7 @@ namespace Game.Entities
|
||||
public void SetMountDisplayId(uint mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.MountDisplayID), mountDisplayId); }
|
||||
uint GetCosmeticMountDisplayId() { return m_unitData.CosmeticMountDisplayID; }
|
||||
public void SetCosmeticMountDisplayId(uint mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CosmeticMountDisplayID), mountDisplayId); }
|
||||
|
||||
|
||||
public virtual float GetFollowAngle() { return MathFunctions.PiOver2; }
|
||||
|
||||
public override ObjectGuid GetOwnerGUID() { return m_unitData.SummonedBy; }
|
||||
@@ -1876,10 +1864,6 @@ namespace Game.Entities
|
||||
public void SetCreatorGUID(ObjectGuid creator) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CreatedBy), creator); }
|
||||
public ObjectGuid GetMinionGUID() { return m_unitData.Summon; }
|
||||
public void SetMinionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Summon), guid); }
|
||||
public ObjectGuid GetCharmerGUID() { return m_unitData.CharmedBy; }
|
||||
public void SetCharmerGUID(ObjectGuid owner) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), owner); }
|
||||
public ObjectGuid GetCharmGUID() { return m_unitData.Charm; }
|
||||
public void SetCharmGUID(ObjectGuid charm) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Charm), charm); }
|
||||
public ObjectGuid GetPetGUID() { return m_SummonSlot[0]; }
|
||||
public void SetPetGUID(ObjectGuid guid) { m_SummonSlot[0] = guid; }
|
||||
public ObjectGuid GetCritterGUID() { return m_unitData.Critter; }
|
||||
@@ -1887,9 +1871,53 @@ namespace Game.Entities
|
||||
public ObjectGuid GetBattlePetCompanionGUID() { return m_unitData.BattlePetCompanionGUID; }
|
||||
public void SetBattlePetCompanionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.BattlePetCompanionGUID), guid); }
|
||||
|
||||
public void SetWildBattlePetLevel(uint wildBattlePetLevel) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.WildBattlePetLevel), wildBattlePetLevel); }
|
||||
public uint GetWildBattlePetLevel() { return m_unitData.WildBattlePetLevel; }
|
||||
|
||||
public bool SetCharmerData(Unit unit)
|
||||
{
|
||||
if (!GetCharmerGUID().IsEmpty())
|
||||
return false;
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), unit.GetGUID());
|
||||
m_charmer = unit;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ClearCharmerData(Unit verify)
|
||||
{
|
||||
if (GetCharmerGUID() != verify.GetGUID())
|
||||
return false;
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), ObjectGuid.Empty);
|
||||
m_charmer = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ObjectGuid GetCharmerGUID() { return m_unitData.CharmedBy; }
|
||||
|
||||
public Unit GetCharmer() { return m_charmer; }
|
||||
|
||||
public bool SetCharmedData(Unit unit)
|
||||
{
|
||||
if (!GetCharmedGUID().IsEmpty())
|
||||
return false;
|
||||
|
||||
m_charmed = unit;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ClearCharmedData(Unit verify)
|
||||
{
|
||||
if (GetCharmedGUID() != verify.GetGUID())
|
||||
return false;
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Charm), ObjectGuid.Empty);
|
||||
m_charmed = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ObjectGuid GetCharmedGUID() { return m_unitData.Charm; }
|
||||
|
||||
public Unit GetCharmed() { return m_charmed; }
|
||||
|
||||
public override ObjectGuid GetCharmerOrOwnerGUID()
|
||||
{
|
||||
return IsCharmed() ? GetCharmerGUID() : GetOwnerGUID();
|
||||
@@ -1909,20 +1937,15 @@ namespace Game.Entities
|
||||
else
|
||||
return ToPlayer();
|
||||
}
|
||||
|
||||
public Unit GetCharmer()
|
||||
{
|
||||
ObjectGuid charmerid = GetCharmerGUID();
|
||||
if (!charmerid.IsEmpty())
|
||||
return Global.ObjAccessor.GetUnit(this, charmerid);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Unit GetCharmerOrOwner()
|
||||
{
|
||||
return !GetCharmerGUID().IsEmpty() ? GetCharmer() : GetOwner();
|
||||
return IsCharmed() ? GetCharmer() : GetOwner();
|
||||
}
|
||||
|
||||
public void SetWildBattlePetLevel(uint wildBattlePetLevel) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.WildBattlePetLevel), wildBattlePetLevel); }
|
||||
public uint GetWildBattlePetLevel() { return m_unitData.WildBattlePetLevel; }
|
||||
|
||||
public bool HasUnitFlag(UnitFlags flags) { return (m_unitData.Flags & (uint)flags) != 0; }
|
||||
public void AddUnitFlag(UnitFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Flags), (uint)flags); }
|
||||
public void RemoveUnitFlag(UnitFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Flags), (uint)flags); }
|
||||
@@ -2823,7 +2846,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long ModifyHealth(long dVal)
|
||||
{
|
||||
long gain = 0;
|
||||
@@ -2865,6 +2887,7 @@ namespace Game.Entities
|
||||
|
||||
return gain;
|
||||
}
|
||||
|
||||
public long GetHealthGain(long dVal)
|
||||
{
|
||||
long gain = 0;
|
||||
@@ -3095,7 +3118,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public uint GetComboPoints() { return (uint)GetPower(PowerType.ComboPoints); }
|
||||
|
||||
|
||||
public void AddComboPoints(sbyte count, Spell spell = null)
|
||||
{
|
||||
if (count == 0)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer().GetGuardianPet() && pet != GetPlayer().GetCharm())
|
||||
if (pet != GetPlayer().GetGuardianPet() && pet != GetPlayer().GetCharmed())
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandlePetCancelAura: {0} is not a pet of player '{1}'", packet.PetGUID.ToString(), GetPlayer().GetName());
|
||||
return;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.MoveDismissVehicle, Processing = PacketProcessing.ThreadSafe)]
|
||||
void HandleMoveDismissVehicle(MoveDismissVehicle packet)
|
||||
{
|
||||
ObjectGuid vehicleGUID = GetPlayer().GetCharmGUID();
|
||||
ObjectGuid vehicleGUID = GetPlayer().GetCharmedGUID();
|
||||
if (vehicleGUID.IsEmpty()) // something wrong here...
|
||||
return;
|
||||
|
||||
|
||||
@@ -3158,7 +3158,7 @@ namespace Game.Spells
|
||||
// Unsummon summon as possessed creatures on spell cancel
|
||||
if (m_spellInfo.IsChanneled() && unitCaster.IsTypeId(TypeId.Player))
|
||||
{
|
||||
Unit charm = unitCaster.GetCharm();
|
||||
Unit charm = unitCaster.GetCharmed();
|
||||
if (charm != null)
|
||||
if (charm.IsTypeId(TypeId.Unit) && charm.ToCreature().HasUnitTypeMask(UnitTypeMask.Puppet)
|
||||
&& charm.m_unitData.CreatedBySpell == m_spellInfo.Id)
|
||||
@@ -5032,7 +5032,7 @@ namespace Game.Spells
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
goto case SummonCategory.Puppet;
|
||||
case SummonCategory.Puppet:
|
||||
if (!unitCaster.GetCharmGUID().IsEmpty())
|
||||
if (!unitCaster.GetCharmedGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveCharm;
|
||||
break;
|
||||
}
|
||||
@@ -5073,7 +5073,7 @@ namespace Game.Spells
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
}
|
||||
|
||||
if (!unitCaster.GetCharmGUID().IsEmpty())
|
||||
if (!unitCaster.GetCharmedGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveCharm;
|
||||
break;
|
||||
}
|
||||
@@ -5281,7 +5281,7 @@ namespace Game.Spells
|
||||
if (!m_spellInfo.HasAttribute(SpellAttr1.DismissPet) && !unitCaster1.GetPetGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
|
||||
if (!unitCaster1.GetCharmGUID().IsEmpty())
|
||||
if (!unitCaster1.GetCharmedGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveCharm;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ namespace Scripts.Spells.Hunter
|
||||
if (!caster.GetPetGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveSummon;
|
||||
|
||||
if (!caster.GetCharmGUID().IsEmpty())
|
||||
if (!caster.GetCharmedGUID().IsEmpty())
|
||||
return SpellCastResult.AlreadyHaveCharm;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user