public bool CheckHP(Object Obj, object instigator)
        {
            Creature c = Obj as Creature;

            if (c != null)
            {
                if (Stage < 0 && !c.IsDead)
                {
                    Stage = 0; // Setting control value to 0
                }
                else if (c.Health < c.TotalHealth * 0.05 && Stage < 1 && !c.IsDead)
                {
                    foreach (Player player in Obj.PlayersInRange.ToList())
                    {
                        player.BuffInterface.RemoveBuffByEntry(5240); // Removing Disable
                        NewBuff newBuff = player.BuffInterface.GetBuff(5240, null);
                        if (newBuff != null)
                        {
                            newBuff.RemoveBuff(true);
                        }

                        player.BuffInterface.RemoveBuffByEntry(5239); // Removing Disable
                        newBuff = player.BuffInterface.GetBuff(5239, null);
                        if (newBuff != null)
                        {
                            newBuff.RemoveBuff(true);
                        }
                    }

                    Stage = 1;
                }
            }

            return(false);
        }
        public override bool OnLeaveCombat(Object npc = null, object instigator = null)
        {
            Creature c = Obj as Creature;

            c.IsInvulnerable = false;
            Stage            = -1;

            foreach (Creature creature in addList)
            {
                creature.Destroy();
            }
            foreach (GameObject go in goList)
            {
                go.Destroy();
            }

            addList = new List <Creature>();
            goList  = new List <GameObject>();

            if (c != null && !c.IsDead)
            {
                c.BuffInterface.RemoveBuffByEntry(13155);
                NewBuff newBuff = c.BuffInterface.GetBuff(13155, null);
                if (newBuff != null)
                {
                    newBuff.RemoveBuff(true);
                }
            }

            return(false);
        }
        public override void OnDie(Object Obj)
        {
            Creature c = Obj as Creature;

            Stage = -1;
            stuffInRange.Clear();

            foreach (Creature crea in addList)
            {
                crea.Destroy();
            }
            foreach (GameObject go in goList)
            {
                go.Destroy();
            }

            addList = new List <Creature>();
            goList  = new List <GameObject>();

            foreach (Object o in c.ObjectsInRange)
            {
                Creature creature = o as Creature;
                if (creature != null && creature.Entry == 38907 && !creature.IsDead)
                {
                    creature.BuffInterface.RemoveBuffByEntry(14897);
                    NewBuff newBuff = creature.BuffInterface.GetBuff(14897, null);
                    if (newBuff != null)
                    {
                        newBuff.RemoveBuff(true);
                    }

                    break;
                }
            }
        }
        public override bool OnEnterCombat(Object npc = null, object instigator = null)
        {
            Creature c = Obj as Creature;

            c.IsInvulnerable = false;
            Stage            = -1;

            var prms = new List <object>()
            {
                36598, (Obj.WorldPosition.X + 250 - (50 * random.Next(1, 11))), (Obj.WorldPosition.Y + 250 - (50 * random.Next(1, 11))), Obj.WorldPosition.Z, Obj.Heading
            };                                                                                                                                                                                           // Spawn snotling

            c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

            c.EvtInterface.AddEvent(SpawnSnotlings, 100, 1);

            c.EvtInterface.AddEvent(SpawnSnotlings, 60 * 1000, 0);

            c.Say("Com 'er Chipfang, we 'l show 'em!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

            c.BuffInterface.RemoveBuffByEntry(13155); // Removing rage
            NewBuff newBuff = c.BuffInterface.GetBuff(13155, null);

            if (newBuff != null)
            {
                newBuff.RemoveBuff(true);
            }

            return(false);
        }
        public override bool OnEnterCombat(Object npc = null, object instigator = null)
        {
            Creature c = Obj as Creature;

            c.Say("Come, mortals, and bathe in my Power!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

            c.BuffInterface.RemoveBuffByEntry(14897); // Removing Iron Body
            NewBuff newBuff = c.BuffInterface.GetBuff(14897, null);

            if (newBuff != null)
            {
                newBuff.RemoveBuff(true);
            }

            if (c != null)
            {
                c.IsInvulnerable = false;
                Stage            = -1;

                var prms = new List <object>()
                {
                    100523, 1110218, 1118213, 19460, (int)Obj.Heading, (uint)0
                };                                                                                            // Solithex Soulstone
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    100524, 1110226, 1118211, 19459, (int)Obj.Heading, (uint)0
                };                                                                                        // Solithex Barrier
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);
            }
            return(false);
        }
        public override bool OnLeaveCombat(Object npc = null, object instigator = null)
        {
            Creature c = Obj as Creature;

            c.IsInvulnerable = false;
            Stage            = -1;

            foreach (Creature creature in addList)
            {
                creature.Destroy();
            }
            foreach (GameObject go in goList)
            {
                go.Destroy();
            }
            foreach (Object obj in c.ObjectsInRange.ToList())
            {
                GameObject go = obj as GameObject;
                if (go != null && go.Entry == 2000561)
                {
                    go.Destroy();
                }

                if (go != null && go.Entry == 100523)
                {
                    go.Destroy();
                }

                if (go != null && go.Entry == 100524)
                {
                    go.Destroy();
                }

                Creature creature = obj as Creature;
                if (creature != null && creature.Entry == 2000876)
                {
                    creature.Destroy();
                }

                if (creature != null && creature.Entry == 42211)
                {
                    creature.Destroy();
                }
            }

            addList = new List <Creature>();
            goList  = new List <GameObject>();

            c.BuffInterface.RemoveBuffByEntry(14897); // Removing Iron Body
            NewBuff newBuff = c.BuffInterface.GetBuff(14897, null);

            if (newBuff != null)
            {
                newBuff.RemoveBuff(true);
            }

            return(false);
        }
 public void Interrupt()
 {
     _channelInfo = null;
     if (_channelBuff != null && !_channelBuff.BuffHasExpired)
     {
         _channelBuff.RemoveBuff(true);
     }
     _channelBuff = null;
 }
Пример #8
0
        public void RemoveFromPending(NewBuff buff, bool suppressNotify = false)
        {
            // Testing for Soul Willpower I proc
            if (suppressNotify && buff.Entry == 18139)
            {
                buff.SuppressEndNotification = true;
            }
            _pendingBuffs.Remove(buff);
            buff.RemoveBuff(true);

            _filledSlots[buff.BuffId] = false;
        }
Пример #9
0
        public void ClearImmunities()
        {
            Creature c = Obj as Creature;

            if (c != null && !c.IsDead)
            {
                foreach (Player player in c.PlayersInRange.ToList())
                {
                    player.BuffInterface.RemoveBuffByEntry(402); // Removing Immunity
                    NewBuff newBuff = player.BuffInterface.GetBuff(402, null);
                    if (newBuff != null)
                    {
                        newBuff.RemoveBuff(true);
                    }

                    player.BuffInterface.RemoveBuffByEntry(403); // Removing Immunity
                    newBuff = player.BuffInterface.GetBuff(403, null);
                    if (newBuff != null)
                    {
                        newBuff.RemoveBuff(true);
                    }
                }
            }
        }
        public bool CheckHP(Object Obj, object instigator)
        {
            GameObject go = this.Obj as GameObject; // We are casting the script initiator as a Creature

            if (Stage < 0 && !go.IsDead)
            {
                Stage = 0; // Setting control value to 0
            }
            if (go.Health < go.TotalHealth * 0.1)
            {
                go.PlayEffect(2185);

                go.Say("*** The cursed gem breaks into milion pieces! ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);

                foreach (Object o in go.ObjectsInRange.ToList())
                {
                    Player plr = o as Player;
                    if (plr != null)
                    {
                        plr.BuffInterface.RemoveBuffByEntry(13058); // Removing killer dot
                        NewBuff newBuff = plr.BuffInterface.GetBuff(13058, null);
                        if (newBuff != null)
                        {
                            newBuff.RemoveBuff(true);
                        }

                        plr.SendClientMessage("The sinister force that consumed your soul is lifted from you!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);
                    }

                    Creature c = o as Creature;
                    if (c != null && c.Entry == 42207)
                    {
                        c.BuffInterface.RemoveBuffByEntry(14897); // Removing Iron Body
                        NewBuff newBuff = c.BuffInterface.GetBuff(14897, null);
                        if (newBuff != null)
                        {
                            newBuff.RemoveBuff(true);
                        }
                    }

                    go.Destroy();
                }

                Stage = 1;
            }

            return(false);
        }
Пример #11
0
        public override void Update(long tick)
        {
            bool bBuffsModified             = false;
            List <BuffQueueInfo> queuedList = null;

            // Pull in the buffinfo for buffs that are pending creation
            lock (_queuedInfo)
            {
                if (_queuedInfo.Count > 0)
                {
                    queuedList = new List <BuffQueueInfo>();
                    queuedList.AddRange(_queuedInfo);
                    _queuedInfo.Clear();
                }
            }

            int pendingLen = _pendingBuffs.Count;

            // Clear out any expired buffs from the pendingBuffs array
            for (int i = 0; i < pendingLen; ++i)
            {
                if (!_pendingBuffs[i].BuffHasExpired)
                {
                    continue;
                }

                NewBuff curBuff = _pendingBuffs[i];

                bBuffsModified = true;

                curBuff.RemoveBuff(false);

                if (curBuff.PersistsOnLogout && curBuff.BuffState == (byte)EBuffState.Ended)
                {
                    RemoveSavedBuff(curBuff);
                }

                _filledSlots[curBuff.BuffId] = false;

                if (curBuff.BuffGroup == BuffGroups.Guard && _Owner != curBuff.Caster)
                {
                    _backingGuardBuffs.Remove((GuardBuff)curBuff);
                    _guardsChanged = true;
                }
                else if (curBuff is AuraBuff && curBuff.Caster == _Owner)
                {
                    _auraCount--;
                }
                else if (curBuff.BuffGroup == BuffGroups.SelfClassBuff)
                {
                    _careerBuffs[0] = null;
                }
                else if (curBuff.BuffGroup == BuffGroups.SelfClassSecondaryBuff)
                {
                    _careerBuffs[1] = null;
                }

                #if DEBUG && ABILITY_DEVELOPMENT
                _Owner.Say("[X] " + curBuff.BuffName);
                #endif

                _pendingBuffs.RemoveAt(i);

                --i;
                pendingLen = _pendingBuffs.Count;
            }

            // Then add any queued buffs
            if (queuedList != null)
            {
                foreach (BuffQueueInfo bqi in queuedList)
                {
                    if (_unitOwner.IsDead && bqi.BuffInfo.RequiresTargetAlive)
                    {
                        continue;
                    }

                    if (!_unitOwner.IsDead && bqi.BuffInfo.RequiresTargetDead)
                    {
                        continue;
                    }

                    NewBuff buff = TryCreateBuff(bqi);
                    if (buff != null)
                    {
                        bBuffsModified = true;
                        _pendingBuffs.Add(buff);

                        _filledSlots[buff.BuffId] = true;
                    }

                    // Let the invoker of the buff know the result.
                    bqi.BuffCallback(buff);

                    if (buff != null)
                    {
                        buff.StartBuff();

                        if (buff.PersistsOnLogout)
                        {
                            RegisterSavedBuff(buff);
                        }
                    }
                }
            }

            if (_unitOwner != null && _unitOwner.IsDead && bBuffsModified)
            {
                pendingLen = _pendingBuffs.Count;

                for (int i = 0; i < pendingLen; ++i)
                {
                    if (_pendingBuffs[i].RequiresTargetAlive)
                    {
                        RemoveFromPending(_pendingBuffs[i]);
                        --pendingLen;
                        --i;
                    }
                }
            }

            // Manage Guard
            if (_guardsChanged)
            {
                _guardBuffs    = new List <GuardBuff>(_backingGuardBuffs);
                _guardsChanged = false;
            }

            // Copy the pending buffs into the used buff array
            if (bBuffsModified)
            {
                _buffRWLock.EnterWriteLock();
                try
                {
                    _buffs.Clear();
                    _buffs.AddRange(_pendingBuffs);
                }
                finally
                {
                    _buffRWLock.ExitWriteLock();
                }
            }

            // Update all the buffs
            if (_buffs.Count > 0 && TCPManager.GetTimeStampMS() > _nextBuffUpdateTime)
            {
                for (int index = 0; index < _buffs.Count; index++)
                {
                    _buffs[index].Update(tick);
                }

                _nextBuffUpdateTime = TCPManager.GetTimeStampMS() + BUFF_UPDATE_INTERVAL;
            }
        }
        // This is for handling custom GO interaction
        private void HandleCustomInteraction()
        {
            if (Entry == 2000579) // This is Mourkain Gem for Ard 'ta Feed Gunbad Boss and part of his mechanics
            {
                if (LastUsedTimestamp == 0)
                {
                    Say("*** Sinister energy is gone from the gem... ***", ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
                }

                LastUsedTimestamp = TCPManager.GetTimeStampMS();

                bool removeBuff = false;

                foreach (Object o in ObjectsInRange)
                {
                    GameObject go = o as GameObject;
                    if (go != null && go != this && go.Entry == 2000579) // This is 2nd Mourkain Gem
                    {
                        if (go.LastUsedTimestamp != 0 && (LastUsedTimestamp - go.LastUsedTimestamp < 2001))
                        {
                            LastUsedTimestamp    = 0;
                            go.LastUsedTimestamp = 0;
                            removeBuff           = true;
                        }
                        else if (go.LastUsedTimestamp != 0)
                        {
                            LastUsedTimestamp    = 0;
                            go.LastUsedTimestamp = 0;
                            Say("*** You are too late! Better hurry and try again! ***", ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
                        }
                    }
                }

                if (removeBuff)
                {
                    foreach (Object ob in ObjectsInRange) // This is looking for ard to feed in range
                    {
                        Creature c = ob as Creature;
                        if (c != null && c.Entry == 15102) // This is ard ta feed
                        {
                            c.BuffInterface.RemoveBuffByEntry(20364);
                            NewBuff newBuff = c.BuffInterface.GetBuff(20364, null);
                            if (newBuff != null)
                            {
                                newBuff.RemoveBuff(true);
                            }

                            c.AbtInterface.StartCast(c, 5308, 0);
                            Say("*** Wicked energy evaporates from the cursed jewel... ***", ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
                            c.Say("*** Monstrous squig calms a bit... ***", ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
                        }

                        GameObject gobject = ob as GameObject;
                        if (gobject != null && gobject.Entry == 98876) // This is Mourkain Henge
                        {
                            gobject.VfxState = 0;
                            foreach (Player player in gobject.PlayersInRange)
                            {
                                gobject.SendMeTo(player);
                            }
                        }
                    }
                }
            }
        }