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 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();
            }
        }
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();
            }
        }