Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        void addThreatPercent(int percent)
        {
            HostileReference refe = getFirst();

            while (refe != null)
            {
                refe.addThreatPercent(percent);
                refe = refe.next();
            }
        }
Esempio n. 3
0
        public void setOnlineOfflineState(bool isOnline)
        {
            HostileReference refe = getFirst();

            while (refe != null)
            {
                refe.setOnlineOfflineState(isOnline);
                refe = refe.next();
            }
        }
Esempio n. 4
0
        public void updateThreatTables()
        {
            HostileReference refe = getFirst();

            while (refe != null)
            {
                refe.updateOnlineStatus();
                refe = refe.next();
            }
        }
Esempio n. 5
0
        // 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;
            }
        }
Esempio n. 6
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;
            }
        }
Esempio n. 7
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;
            }
        }
Esempio n. 8
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;
            }
        }
Esempio n. 9
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;
            }
        }
Esempio n. 10
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();
            }
        }
Esempio n. 11
0
        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();
            }
        }