Пример #1
0
        // 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();
            }
        }
Пример #2
0
        // 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;
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        // 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;
            }
        }
Пример #5
0
        // 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;
            }
        }
Пример #6
0
        // 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;
            }
        }