public void UpdateVisibility() { HostileReference refe = GetFirst(); while (refe != null) { HostileReference nextRef = refe.Next(); if (!refe.GetSource().GetOwner().CanSeeOrDetect(GetOwner())) { nextRef = refe.Next(); refe.RemoveReference(); } refe = nextRef; } }
void AddThreatPercent(int percent) { HostileReference refe = GetFirst(); while (refe != null) { refe.AddThreatPercent(percent); refe = refe.Next(); } }
public void SetOnlineOfflineState(bool isOnline) { HostileReference refe = GetFirst(); while (refe != null) { refe.SetOnlineOfflineState(isOnline); refe = refe.Next(); } }
public void UpdateThreatTables() { HostileReference refe = GetFirst(); while (refe != null) { refe.UpdateOnlineStatus(); refe = refe.Next(); } }
// The references are not needed anymore // tell the source to remove them from the list and free the mem public void DeleteReferences() { HostileReference refe = GetFirst(); while (refe != null) { HostileReference nextRef = refe.Next(); refe.RemoveReference(); refe = nextRef; } }
// Remove specific faction references public void DeleteReferencesForFaction(uint faction) { HostileReference refe = GetFirst(); while (refe != null) { HostileReference nextRef = refe.Next(); if (refe.GetSource().GetOwner().GetFactionTemplateEntry().Faction == faction) { refe.RemoveReference(); } refe = nextRef; } }
// delete one reference, defined by Unit public void DeleteReference(Unit creature) { HostileReference refe = GetFirst(); while (refe != null) { HostileReference nextRef = refe.Next(); if (refe.GetSource().GetOwner() == creature) { refe.RemoveReference(); break; } refe = nextRef; } }
// set state for one reference, defined by Unit public void SetOnlineOfflineState(Unit creature, bool isOnline) { HostileReference refe = GetFirst(); while (refe != null) { HostileReference nextRef = refe.Next(); if (refe.GetSource().GetOwner() == creature) { refe.SetOnlineOfflineState(isOnline); break; } refe = nextRef; } }
// delete all references out of specified range public void DeleteReferencesOutOfRange(float range) { HostileReference refe = GetFirst(); range = range * range; while (refe != null) { HostileReference nextRef = refe.Next(); Unit owner = refe.GetSource().GetOwner(); if (!owner.IsActiveObject() && owner.GetExactDist2dSq(GetOwner()) > range) { refe.RemoveReference(); } refe = nextRef; } }
// send threat to all my haters for the victim // The victim is then hated by them as well // use for buffs and healing threat functionality public void ThreatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null) { float threat = ThreatManager.CalcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell); threat /= GetSize(); HostileReference refe = GetFirst(); while (refe != null) { if (ThreatManager.IsValidProcess(victim, refe.GetSource().GetOwner(), threatSpell)) { refe.GetSource().DoAddThreat(victim, threat); } refe = refe.Next(); } }
public void AddTempThreat(float threat, bool apply) { HostileReference refe = GetFirst(); while (refe != null) { if (apply) { if (refe.GetTempThreatModifier() == 0.0f) { refe.AddTempThreat(threat); } } else { refe.ResetTempThreat(); } refe = refe.Next(); } }