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 hateres for the victim // The victim is hated than by them as well // use for buffs and healing threat functionality public void threatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null) { HostileReference refe = getFirst(); float threat = ThreatManager.calcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell); threat /= getSize(); 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(); } }