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);
        }
示例#2
0
 public void AddEventSubscription(NewBuff buff, byte eventID)
 {
     lock (_buffCombatSubs[eventID - 1])
     {
         _buffCombatSubs[eventID - 1].Add(buff);
     }
 }
示例#3
0
 public void RemoveEventSubscription(NewBuff buff, byte eventID)
 {
     lock (_buffCombatSubs[eventID - 1])
     {
         _buffCombatSubs[eventID - 1].Remove(buff);
     }
 }
        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);
        }
示例#5
0
        public void RegisterSavedBuff(NewBuff b)
        {
            if (_playerOwner == null)
            {
                return;
            }

            foreach (CharacterSavedBuff buffSave in _playerOwner.Info.Buffs)
            {
                if (buffSave.BuffId == b.Entry)
                {
                    buffSave.EndTimeSeconds = (uint)TCPManager.GetTimeStamp() + b.Duration;
                    buffSave.Level          = b.BuffLevel;
                    buffSave.Dirty          = true;
                    CharMgr.Database.SaveObject(buffSave);
                    return;
                }
            }

            CharacterSavedBuff save = new CharacterSavedBuff {
                CharacterId = _playerOwner.Info.CharacterId, BuffId = b.Entry, Level = b.BuffLevel, StackLevel = b.StackLevel, EndTimeSeconds = (uint)TCPManager.GetTimeStamp() + b.Duration
            };

            _playerOwner.Info.Buffs.Add(save);
            CharMgr.Database.AddObject(save);
        }
示例#6
0
 public virtual void NotifyInteractionBroken(NewBuff b)
 {
     if (CapturingPlayer == b.Target)
     {
         CapturingPlayer = null;
     }
 }
        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 void Update(long tick)
 {
     if (TCPManager.GetTimeStampMS() >= _channelStartTime + _channelInfo.CastTime)
     {
         SendChannelEnd();
         _parent.NotifyChannelEnded();
         _channelInfo = null;
         _channelBuff = null;
     }
     else if (TCPManager.GetTimeStampMS() >= _nextTickTime)
     {
         if (_channelInfo.ApCost > 0 && !_host.ConsumeActionPoints(_channelInfo.ApCost))
         {
             _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_AP);
         }
         else if (_playerHost != null && _channelInfo.SpecialCost > 3 && !_playerHost.CrrInterface.ConsumeResource((byte)_channelInfo.SpecialCost, true))
         {
             _parent.CancelCast(1);
         }
         else if (_target != _host && !_host.IsInCastRange(_target, Math.Max((uint)25, _channelInfo.Range)))
         {
             _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_OUTOFRANGE);
         }
         else if (_checkVisibility && !_host.LOSHit(_target))
         {
             _parent.CancelCast((byte)GameData.AbilityResult.ABILITYRESULT_NOT_VISIBLE);
         }
         else
         {
             _nextTickTime += 1000;
         }
     }
 }
 /// <summary>
 /// Callback to start the channel proper
 /// </summary>
 public void ChannelInitialization(NewBuff channelBuff)
 {
     // Was cancelled before the channel callback
     if (_channelInfo == null || _host == null || _host.IsDead)
     {
         if (channelBuff != null)
         {
             channelBuff.BuffHasExpired = true;
             _channelBuff = null;
         }
     }
     // Couldn't create a channel buff, so cancel
     else if (channelBuff == null)
     {
         _parent.CancelCast(0);
         _channelInfo = null;
     }
     // Successful link
     else
     {
         _channelBuff = channelBuff;
         _channelBuff.ChannelHandler = this;
         // Oil
         if (_host is Siege)
         {
             _channelBuff.OptionalObject = _host;
         }
         _host.BuffInterface.NotifyAbilityCasted(_channelInfo);
     }
 }
        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);
        }
示例#11
0
        public override void NotifyInteractionComplete(NewBuff b)
        {
            Player plrCaster = (Player)b.Caster;

            _interactors.Remove(plrCaster);
            _interactionBuffs.Remove((InteractionBuff)b);
        }
        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 void NotifyInteractionComplete(NewBuff b)
        {
            HandleInteractionEvents(CapturingPlayer);

            _onCapture?.Invoke(CapturingPlayer, this);

            base.NotifyInteractionComplete(b);
        }
        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;
 }
示例#16
0
 // cross thread
 public void RegisterOYG(NewBuff B)
 {
     if (B != null)
     {
         lock (_groupPendingTargetList)
             _groupPendingTargetList.Add(B);
         (B as OYGBuff).MasterAuraBuff = this;
     }
 }
示例#17
0
        public void PostTargetCreate(NewBuff B)
        {
            if (B == null)
            {
                return;
            }
            _targetBuff = B;

            _Caster.BuffInterface.QueueBuff(new BuffQueueInfo(_Caster, _Caster.Level, AbilityMgr.GetBuffInfo(_desiredBuff, _Caster, _Caster), _creator, PostCasterCreate));
        }
示例#18
0
        /// <summary>
        /// <para>Creates and returns a new buff applied to the owner of this AbilityInterface.</para>
        /// </summary>
        public NewBuff TryCreateBuff(BuffQueueInfo buffQueueInfo)
        {
            if (buffQueueInfo.BuffInfo == null)
            {
                Log.Error("TryCreateBuff", "NULL BUFFINFO");
                return(null);
            }

            #if DEBUG && ABILITY_DEVELOPMENT
            _Owner.Say("+++ " + buffQueueInfo.BuffInfo.Name + " (" + buffQueueInfo.BuffInfo.Type + ")");
            #endif

            // Cap the level of same-faction buffs
            if (buffQueueInfo.Caster.Realm == _unitOwner.Realm && (float)buffQueueInfo.Caster.EffectiveLevel / _unitOwner.EffectiveLevel > 1.3f)
            {
                buffQueueInfo.DesiredLevel = _unitOwner.EffectiveLevel;
            }

            Tuple <ushort, byte> buffSlotInfo = CanAcceptBuff(buffQueueInfo);

            if (buffSlotInfo == null || buffSlotInfo.Item1 == 32000)
            {
                return(null);
            }

            NewBuff myBuff = buffQueueInfo.BuffCreator == null ? new NewBuff() : buffQueueInfo.BuffCreator();

            if (myBuff != null)
            {
                myBuff.Initialize(buffQueueInfo.Caster, (Unit)_Owner, buffSlotInfo.Item1,
                                  buffQueueInfo.DesiredLevel, Math.Min(buffQueueInfo.BuffInfo.MaxStack, buffSlotInfo.Item2),
                                  buffQueueInfo.BuffInfo, this);

                if (myBuff.BuffGroup == BuffGroups.SelfClassBuff)
                {
                    _careerBuffs[0] = myBuff;
                }
                else if (myBuff.BuffGroup == BuffGroups.SelfClassSecondaryBuff)
                {
                    _careerBuffs[1] = myBuff;
                }
                else if (myBuff.BuffGroup == BuffGroups.Guard && _Owner != myBuff.Caster)
                {
                    myBuff.IsGroupBuff = true;
                    _backingGuardBuffs?.Add((GuardBuff)myBuff);
                    _guardsChanged = true;
                }
                else if (myBuff is AuraBuff && myBuff.Caster == _Owner)
                {
                    _auraCount++;
                }
            }

            return(myBuff);
        }
示例#19
0
 public void BuffCallback(NewBuff buff)
 {
     if (_buffCallback != null)
     {
         if (buff == null && BuffInfo.BuffClass == BuffClass.Tactic)
         {
             Log.Info(BuffInfo.Name, "Tactic buff unsuccessfully applied!");
         }
         _buffCallback(buff);
     }
 }
示例#20
0
        public void InsertUnstoppable(BuffQueueInfo bqi)
        {
            NewBuff buff = TryCreateBuff(bqi);

            if (buff != null)
            {
                _pendingBuffs.Add(buff);
                _filledSlots[buff.BuffId] = true;
            }

            buff?.StartBuff();
        }
示例#21
0
        public void PostCasterCreate(NewBuff B)
        {
            //This shouldn't really happen
            if (B == null)
            {
                _targetBuff.BuffHasExpired = true;
                return;
            }

            B.SetLinkedBuff(_targetBuff);
            _targetBuff.SetLinkedBuff(B);
        }
示例#22
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;
        }
示例#23
0
        public virtual void LinkToCaptureBuff(NewBuff b)
        {
            if (b != null)
            {
                InteractionBuff captureBuff = (InteractionBuff)b;
                captureBuff.SetObject(this);
            }

            else
            {
                CapturingPlayer = null;
            }
        }
示例#24
0
        public void Hotswap(NewBuff oldBuff, ushort newBuffEntry)
        {
            BuffInfo newInfo = AbilityMgr.GetBuffInfo(newBuffEntry);

            NewBuff buff = new NewBuff();

            buff.Initialize(oldBuff.Caster, (Unit)_Owner, oldBuff.BuffId, 40, newInfo.MaxStack, newInfo, this);

            _pendingBuffs[_pendingBuffs.IndexOf(oldBuff)] = buff;
            _buffs[_buffs.IndexOf(oldBuff)] = buff;

            buff.StartBuff();
        }
示例#25
0
        public void RegisterUserBuff(NewBuff b)
        {
            if (b != null)
            {
                if (_interactors.Contains((Player)b.Target))
                {
                    _interactionBuffs.Add(b);
                }

                else
                {
                    b.BuffHasExpired = 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);
        }
 /// <summary>
 /// <para>Root command used for Champion's Challenge.</para>
 /// <para>Prevents either target from being punted or punting themselves.</para>
 /// </summary>
 public void EnterGrapple(NewBuff hostBuff, bool triggersImmunity)
 {
     lock (MovementCCLock)
     {
         if (!IsImmovable && !NoKnockbacks)
         {
             if (triggersImmunity)
             {
                 IsImmovable = true;
                 BuffInterface.QueueBuff(new BuffQueueInfo(this, EffectiveLevel, AbilityMgr.GetBuffInfo((ushort)GameBuffs.Immovable)));
             }
         }
         NoKnockbacks = true;
         StsInterface.AddVelocityModifier(hostBuff, 0);
     }
 }
示例#28
0
        public void RemoveVanityPet()
        {
            Owner.Companion.Dismiss(null, null);
            Owner.Companion = null;

            NewBuff vanityPet = Owner.BuffInterface.GetBuff(15188, null);

            if (vanityPet != null)
            {
                Owner.BuffInterface.RemoveBuffByEntry(15188);
            }
            vanityPet = Owner.BuffInterface.GetBuff(15190, null);
            if (vanityPet != null)
            {
                Owner.BuffInterface.RemoveBuffByEntry(15188);
            }
        }
示例#29
0
        public void PassPreviousBounces(NewBuff B)
        {
            if (B == null)
            {
                Log.Error("Bouncing Buff", "Received NULL buff!");
                return;
            }
            BouncingBuff bBuff = B as BouncingBuff;

            if (bBuff == null)
            {
                Log.Error("Bouncing Buff", "Received buff was not a BouncingBuff!");
                return;
            }

            bBuff.previousPlayers.AddRange(previousPlayers);
        }
        private static void AddLavaBuff(NewBuff lavaBuff)
        {
            if (lavaBuff == null)
            {
                return;
            }

            if (_lavaBuffs.ContainsKey(lavaBuff.Caster))
            {
                _lavaBuffs[lavaBuff.Caster] = lavaBuff;
            }

            else
            {
                _lavaBuffs.Add(lavaBuff.Caster, lavaBuff);
            }
        }