Beispiel #1
0
        void _addThreat(Unit victim, float threat)
        {
            var reff = threatContainer.addThreat(victim, threat);

            // Ref is not in the online refs, search the offline refs next
            if (reff == null)
            {
                reff = threatOfflineContainer.addThreat(victim, threat);
            }

            if (reff == null) // there was no ref => create a new one
            {
                bool isFirst = threatContainer.empty();

                // threat has to be 0 here
                var hostileRef = new HostileReference(victim, this, 0);
                threatContainer.addReference(hostileRef);
                hostileRef.addThreat(threat); // now we add the real threat
                if (victim.IsTypeId(TypeId.Player) && victim.ToPlayer().IsGameMaster())
                {
                    hostileRef.setOnlineOfflineState(false); // GM is always offline
                }
                else if (isFirst)
                {
                    setCurrentVictim(hostileRef);
                }
            }
        }
Beispiel #2
0
        public void setOnlineOfflineState(bool isOnline)
        {
            HostileReference refe = getFirst();

            while (refe != null)
            {
                refe.setOnlineOfflineState(isOnline);
                refe = refe.next();
            }
        }
Beispiel #3
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;
            }
        }