/// <summary>
        /// Notifies the given player has entered the lake,
        /// removing it from the battlefront's active players list and setting the rvr buff(s).
        /// </summary>
        /// <param name="plr">Player to add, not null</param>
        public void NotifyEnteredLake(Player plr)
        {
            if (!plr.ValidInTier(Tier, true))
            {
                return;
            }

            // Player list tracking
            lock (_playersInLakeSet)
            {
                if (_playersInLakeSet.Add(plr))
                {
                    if (plr.Realm == Realms.REALMS_REALM_ORDER)
                    {
                        _orderCount++;
                    }
                    else
                    {
                        _destroCount++;
                    }
                }
            }

            _aaoTracker.NotifyEnteredLake(plr);

            // Buffs
            plr.BuffInterface.QueueBuff(new BuffQueueInfo(plr, plr.Level, AbilityMgr.GetBuffInfo((ushort)GameBuffs.FieldOfGlory), FogAssigned));
        }
 /// <summary>
 /// Invoked when a player enters the lake.
 /// </summary>
 /// <param name="plr">Player firing this event</param>
 internal void NotifyEnteredLake(Player plr)
 {
     if (plr.Realm == GetAaoRealm(_againstAllOddsMult))
     {
         plr.BuffInterface.QueueBuff(new BuffQueueInfo(plr, plr.Level, AbilityMgr.GetBuffInfo((ushort)GameBuffs.AgainstAllOdds), AaoAssigned));
     }
 }
Esempio n. 3
0
        public void AddAbilities(ushort minBound, ushort maxBound)
        {
            if (maxBound == 0)
            {
                AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(minBound);
                if (abInfo != null && abInfo.ConstantInfo.MinimumRank <= Level)
                {
                    NPCAbility npcAbility = new NPCAbility(abInfo.Entry, abInfo.ConstantInfo.AIRange, (byte)abInfo.Cooldown, true, "");
                    AbtInterface.NPCAbilities.Add(npcAbility);
                    SendPetAbility(npcAbility);
                }
            }

            else
            {
                for (ushort i = minBound; i <= maxBound; ++i)
                {
                    AbilityInfo abInfo = AbilityMgr.GetAbilityInfo(i);
                    if (abInfo == null || abInfo.ConstantInfo.MinimumRank > Level)
                    {
                        continue;
                    }
                    NPCAbility npcAbility = new NPCAbility(abInfo.Entry, abInfo.ConstantInfo.AIRange, (byte)abInfo.Cooldown, true, "");
                    AbtInterface.NPCAbilities.Add(npcAbility);
                    SendPetAbility(npcAbility);
                }
            }
        }
Esempio n. 4
0
        public override void NotifyInteractionComplete(NewBuff b)
        {
            if (CapturingPlayer == null || HeldState == EHeldState.Inactive)
            {
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH, 12);

            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(0);
            Out.Fill(0, 6);
            DispatchPacket(Out, true);

            SetHeldState(EHeldState.Carried);

            Holder          = CapturingPlayer;
            CapturingPlayer = null;

            BuffInfo buffInfo = AbilityMgr.GetBuffInfo(BuffId);

            Holder.BuffInterface.QueueBuff(new BuffQueueInfo(Holder, 1, buffInfo, HoldObjectBuff.GetNew, HoldObjectCallback));

            OnPickupAction?.Invoke(this, Holder);
        }
Esempio n. 5
0
        private void ExecuteCommand(string cmd, byte stat, int value)
        {
            switch (cmd)
            {
            case "ModifyStat":
                _player.StsInterface.SetRenownStat((Stats)stat, (ushort)value);
                break;

            case "ModifyEvasion":
                _player.StsInterface.SetRenownStat(Stats.Evade, (ushort)value);
                _player.StsInterface.SetRenownStat(Stats.Disrupt, (ushort)value);
                break;

            case "IncreaseAPPool":
                _player.MaxActionPoints = (ushort)(_player.MaxActionPoints + value);
                break;

            case "AddAbility":
                _activeAbilities.Add((ushort)value);
                _player.AbtInterface.GrantAbility((ushort)value);
                break;

            case "AddBuff":
                BuffInfo buffInfo = AbilityMgr.GetBuffInfo((ushort)value);
                if (buffInfo == null)
                {
                    _player.SendClientMessage("The requested ability is not implemented.");
                }
                else
                {
                    _player.BuffInterface.QueueBuff(new BuffQueueInfo(_player, _player.EffectiveLevel, buffInfo));
                }
                break;
            }
        }
Esempio n. 6
0
        private void LoadSavedBuffs()
        {
            List <CharacterSavedBuff> buffList = _playerOwner.Info.Buffs;

            if (buffList.Count == 0)
            {
                return;
            }

            uint curTime = (uint)TCPManager.GetTimeStamp();

            for (int i = 0; i < buffList.Count; ++i)
            {
                if (buffList[i].EndTimeSeconds < curTime + 1)
                {
                    CharMgr.Database.DeleteObject(buffList[i]);
                    buffList.RemoveAt(i);
                    --i;
                    continue;
                }

                BuffInfo newInfo = AbilityMgr.GetBuffInfo(buffList[i].BuffId);

                newInfo.Duration = (uint)(buffList[i].EndTimeSeconds - curTime);
                if (buffList[i].StackLevel > 1)
                {
                    newInfo.InitialStacks = buffList[i].StackLevel;
                }

                QueueBuff(new BuffQueueInfo(_playerOwner, buffList[i].Level, newInfo));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Reload abilities.
        /// </summary>
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">List of command arguments (after command name)</param>
        /// <returns>True if command was correctly handled, false if operation was canceled</returns>
        public static bool ReloadAbilities(Player plr, ref List <string> values)
        {
            lock (Player._Players)
            {
                foreach (Player player in Player._Players)
                {
                    player.SendClientMessage("[System] Recaching ability tables...", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                }
            }

            AbilityMgr.ReloadAbilities();
            AbilityMgr.LoadCreatureAbilities();
            AbilityModifierInvoker.LoadModifierCommands();
            BuffEffectInvoker.LoadBuffCommands();

            lock (Player._Players)
            {
                foreach (Player player in Player._Players)
                {
                    player.SendClientMessage("[System] Ability tables successfully recached.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                }
            }

            return(true);
        }
        public override void TryUseAbilities()
        {
            if (_unit.AbtInterface.NPCAbilities == null)
            {
                BuildupNPCAbilities();
            }

            //base.TryUseAbilities();

            Unit boss = (Unit)_unit.ObjectsInRange.Where(x => x is InstanceBossSpawn).FirstOrDefault();

            foreach (var ability in _unit.AbtInterface.NPCAbilities)
            {
                _unit.CbtInterface.SetTarget(boss.Oid, GameData.TargetTypes.TARGETTYPES_TARGET_ALLY);
                AbilityMgr.GetAbilityInfo(ability.Entry).Target = boss;

                // This list of parameters is passed to the function that delays the cast by 1000 ms
                var prms = new List <object>()
                {
                    _unit, ability.Entry, ability.RandomTarget
                };
                if (ability.Text != "")
                {
                    _unit.Say(ability.Text.Replace("<character name>", _unit.CbtInterface.GetCurrentTarget().Name));
                }
                _unit.EvtInterface.AddEvent(StartDelayedCast, 1000, 1, prms);
                ability.AbilityUsed = 1;
            }
        }
Esempio n. 9
0
        internal void AddRationed(Player player, int index)
        {
            lock (_withinKeepRange)
                _withinKeepRange[index].Add(player);

            if (RationFactor[index] > 1f)
            {
                player.BuffInterface.QueueBuff(new BuffQueueInfo(player, 1, AbilityMgr.GetBuffInfo((ushort)GameBuffs.Rationing), RationBuff.CreateRationBuff, AssignRationDebuff));
            }
        }
Esempio n. 10
0
        public bool ApplyIronSkin(Object npc = null, object instigator = null)
        {
            Unit     u = Obj as Unit;
            BuffInfo b = AbilityMgr.GetBuffInfo(5262); // This is Iron Skin buff - Squig Commando

            b.Duration = 30;
            u.BuffInterface.QueueBuff(new BuffQueueInfo(u, u.Level, b));

            return(true);
        }
Esempio n. 11
0
        public void ApplyTerrorToEveryoneInRadius()
        {
            Unit u = Obj as Unit;

            foreach (Player player in Obj.PlayersInRange)
            {
                BuffInfo b = AbilityMgr.GetBuffInfo(5968, u, player); // This is Terror buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(u, 40, b));
            }
        }
Esempio n. 12
0
        public bool ApplyTerror(Object npc = null, object instigator = null)
        {
            Unit u = Obj as Unit;

            foreach (Player player in Obj.PlayersInRange)
            {
                BuffInfo b = AbilityMgr.GetBuffInfo(5968, u, player); // This is Terror buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(u, 40, b));
            }

            return(true);
        }
Esempio n. 13
0
        protected override void SetDeath(Unit killer)
        {
            Health = 0;

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH, 12);

            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(killer.IsPet() ? killer.GetPet().Owner.Oid : killer.Oid);
            Out.Fill(0, 6);
            DispatchPacket(Out, true);

            AbtInterface.Cancel(true);
            ScrInterface.OnDie(this);
            BuffInterface.RemoveBuffsOnDeath();

            EvtInterface.Notify(EventName.OnDie, this, killer);

            Pet    pet      = killer as Pet;
            Player credited = (pet != null) ? pet.Owner : (killer as Player);

            if (credited != null)
            {
                HandleDeathRewards(credited);
            }

            ClearTrackedDamage();

            _buildState = EConstructionState.Destroying;

            foreach (Player plr in _interactors)
            {
                plr.Palisade = null;
            }

            _interactors.Clear();

            foreach (NewBuff buff in _interactionBuffs)
            {
                buff.BuffHasExpired = true;
            }

            _interactionBuffs.Clear();

            GroundTarget gt = new GroundTarget(_constructor, new Point3D(WorldPosition), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt, Zone.ZoneId);

            gt.BuffInterface.QueueBuff(new BuffQueueInfo(_constructor, 40, AbilityMgr.GetBuffInfo(23762)));

            gt.SetExpiry(TCPManager.GetTimeStampMS() + 5000);
        }
Esempio n. 14
0
        private void BuildupNPCAbilities()
        {
            _unit.AbtInterface.NPCAbilities = new List <NPCAbility>()
            {
                //new NPCAbility(13682, 150, 0, true, "<character name>, be restored by our chaos gods!", 0, 100, 1, 1, 1, 0, 0, 0, 0)
                //new NPCAbility(1904, 150, 0, true, "<character name>, be restored by our chaos gods!", 0, 100, 1, 1, 1, 0, 0, 0, 0)
            };

            AbilityInfo abInfo     = AbilityMgr.GetAbilityInfo(13682);
            NPCAbility  npcAbility = new NPCAbility(abInfo.Entry, abInfo.ConstantInfo.AIRange, (byte)abInfo.Cooldown, true, "<character name>, be restored by our chaos gods!");

            _unit.AbtInterface.NPCAbilities.Add(npcAbility);
        }
Esempio n. 15
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();
        }
Esempio n. 16
0
        /// <summary>
        /// Initializes new aao buffs for the given realm.
        /// </summary>
        /// <param name="realm">Realm that got aao, can be neutral</param>
        private void InitAAOBuffs(Realms realm, IList <Player> players)
        {
            if (realm == Realms.REALMS_REALM_NEUTRAL)
            {
                return;
            }

            foreach (Player plr in players)
            {
                if (plr.Realm == realm)
                {
                    plr.BuffInterface.QueueBuff(new BuffQueueInfo(plr, 40, AbilityMgr.GetBuffInfo((ushort)GameBuffs.AgainstAllOdds), AaoAssigned));
                }
            }
        }
Esempio n. 17
0
        public static void ApplyRealmCaptainBuff(Player plr, ushort infoSpellId)
        {
            if (plr == null)
            {
                return;
            }
            // Remove any other RC buffs
            plr.BuffInterface.RemoveBuffByEntry(28115);
            plr.BuffInterface.RemoveBuffByEntry(28116);
            plr.BuffInterface.RemoveBuffByEntry(28117);
            plr.BuffInterface.RemoveBuffByEntry(28118);

            plr.BuffInterface.QueueBuff(new BuffQueueInfo(plr, plr.Level,
                                                          AbilityMgr.GetBuffInfo(infoSpellId)));
        }
Esempio n. 18
0
        public void EnergyFlux()
        {
            Brain.SpeakYourMind(" using EnergyFlux");

            // Remove any old electron fluxes (max of 4)
            var fluxes = Owner.GetInRange <GameObject>(150);

            if (fluxes.Count > 4)
            {
                foreach (var flux in fluxes)
                {
                    if (flux.Entry == 3100414)
                    {
                        flux.EvtInterface.AddEvent(flux.Destroy, 2 * 1000, 1);
                        break;
                    }
                }
            }

            GameObject_proto proto = GameObjectService.GetGameObjectProto(3100414);

            var newTarget = Brain.SetRandomTarget();

            if (newTarget != null)
            {
                GameObject_spawn spawn = new GameObject_spawn
                {
                    Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                    WorldO = 2093,
                    WorldX = newTarget.WorldPosition.X + StaticRandom.Instance.Next(50),
                    WorldY = newTarget.WorldPosition.Y + StaticRandom.Instance.Next(50),
                    WorldZ = newTarget.WorldPosition.Z,
                    ZoneId = (ushort)Owner.ZoneId
                };

                spawn.BuildFromProto(proto);
                proto.IsAttackable = 1;

                var go = Owner.Region.CreateGameObject(spawn);
                // When the gameobject dies, remove it.
                go.EvtInterface.AddEventNotify(EventName.OnDie, RemoveGOs);
                // When the boss dies, remove all child "fluxes"
                Owner.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAllFluxes);
                // Buff the flux with the lightning rod buff.
                go.BuffInterface.QueueBuff(new BuffQueueInfo(go, 48, AbilityMgr.GetBuffInfo((ushort)1543),
                                                             BuffAssigned));
            }
        }
Esempio n. 19
0
        public void DisablePlayer()
        {
            Creature creature = Obj as Creature;

            if (creature != null)
            {
                if (creature.PlayersInRange.Count > 0)
                {
                    bool   haveTarget     = false;
                    int    playersInRange = creature.PlayersInRange.Count();
                    Player player;
                    while (!haveTarget)
                    {
                        int    rndmPlr = random.Next(1, playersInRange + 1);
                        Object obj     = creature.PlayersInRange.ElementAt(rndmPlr - 1);
                        player = obj as Player;
                        if (player != null && !player.IsDead)
                        {
                            haveTarget = true;
                            creature.MvtInterface.TurnTo(player);
                            creature.MvtInterface.Follow(player, 5, 50);
                            creature.AiInterface.CurrentBrain.AddHatred(player, true, 5000);

                            creature.Say("*** Zapping " + player.Name + " ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                            BuffInfo b = AbilityMgr.GetBuffInfo(5240, creature, player); // Disable
                            creature.BuffInterface.QueueBuff(new BuffQueueInfo(creature, creature.Level, b));

                            player.PlayEffect(1390);

                            var prms = new List <object>()
                            {
                                player, 165
                            };
                            PlayAnimation(prms);

                            prms = new List <object>()
                            {
                                player, 0
                            };
                            player.EvtInterface.AddEvent(PlayAnimation, 595 * 100, 1, prms);

                            break;
                        }
                    }
                }
            }
        }
Esempio n. 20
0
        public BehaviourStatus PuntTarget(Creature arg)
        {
            if (!TargetInMeleeRange(arg))
            {
                return(BehaviourStatus.Failed);
            }
            if (TargetIsUnstoppable(arg))
            {
                return(BehaviourStatus.Failed);
            }


            SpeakYourMind($" using Repel vs {(arg.CbtInterface.GetCurrentTarget() as Player).Name}");
            arg.CbtInterface.GetCurrentTarget().ApplyKnockback(arg, AbilityMgr.GetKnockbackInfo(8329, 0));
            return(BehaviourStatus.Succeeded);
        }
Esempio n. 21
0
        public void DelayedBuff(object prms)
        {
            var Params = (List <object>)prms;

            Creature c      = (Creature)Params[0];
            ushort   BuffId = (ushort)Params[1];
            string   Text   = (string)Params[2];

            BuffInfo b = AbilityMgr.GetBuffInfo(BuffId, c, c);

            c.BuffInterface.QueueBuff(new BuffQueueInfo(c, c.Level, b));

            if (!String.IsNullOrEmpty(Text))
            {
                c.Say(Text, SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Gets the complete ability list of target (creature).
        /// </summary>
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">NPCAbility list of target</param>
        /// <returns></returns>
        public static bool GetAbilityList(Player plr, ref List <string> values)
        {
            Creature obj = GetObjectTarget(plr) as Creature;

            if (obj == null)
            {
                return(false);
            }

            plr.SendClientMessage("All loaded abilities of target <Entry, Name>:");

            foreach (NPCAbility ab in obj.AbtInterface.NPCAbilities)
            {
                plr.SendClientMessage("<" + ab.Entry + ", " + AbilityMgr.GetAbilityInfo(ab.Entry).Name + ">");
            }

            return(true);
        }
        /// <summary>
        /// Invokes the buff of the specified ID.
        /// </summary>
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">List of command arguments (after command name)</param>
        /// <returns>True if command was correctly handled, false if operation was canceled</returns>
        public static bool InvokeBuff(Player plr, ref List <string> values)
        {
            Unit target = GetTargetOrMe(plr);

            ushort abilityID = (ushort)GetInt(ref values);

            switch (GetInt(ref values))
            {
            case 1:
                BuffInfo b = AbilityMgr.GetBuffInfo(abilityID, plr, target);
                //b.Duration = 3600;
                target.BuffInterface.QueueBuff(new BuffQueueInfo(plr, plr.Level, b));
                return(true);

            case 0:
                target.BuffInterface.RemoveBuffByEntry(abilityID); return(true);

            default: return(true);
            }
        }
        public override void SendInteract(Player player, InteractMenu menu)
        {
            lock (_capturing)
            {
                if (!_capturing.Contains(player))
                {
                    _capturing.Add(player);
                }
            }

            BuffInfo b = AbilityMgr.GetBuffInfo((ushort)GameBuffs.Interaction);

            b.Duration = CaptureCastTime;
            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, b, InteractionBuff.GetNew, LinkToCaptureBuff));

            if (player.IsMounted)
            {
                player.Dismount();
            }
        }
        public void FlagBuffAssigned(NewBuff b)
        {
            HoldObjectBuff hB = (HoldObjectBuff)b;

            switch (hB.HeldObject.RealmCapturableFor)
            {
            case Realms.REALMS_REALM_ORDER:
                hB.FlagEffect = FLAG_EFFECTS.Red;
                break;

            case Realms.REALMS_REALM_DESTRUCTION:
                hB.FlagEffect = FLAG_EFFECTS.Blue;
                break;

            default:
                hB.FlagEffect = FLAG_EFFECTS.Mball1;
                break;
            }

            hB.Target.BuffInterface.QueueBuff(new BuffQueueInfo(hB.Target, 40, AbilityMgr.GetBuffInfo(14323)));
        }
Esempio n. 26
0
        public void BreakEgg()
        {
            GameObject go = Obj as GameObject;

            go.PlayEffect(2185);

            go.Say("*** Terrible stench of rotten wyvern eggs fills the cave... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);

            Creature OlGreenwingz = null;

            foreach (Object o in Obj.ObjectsInRange)
            {
                Creature c = o as Creature;
                if (c != null && c.Entry == 2000900)
                {
                    OlGreenwingz = c;
                }
            }

            if (OlGreenwingz != null)
            {
                foreach (Player player in Obj.PlayersInRange.ToList())
                {
                    if (player != null && !player.IsDead && !player.IsInvulnerable && go.GetDistanceToObject(player) < 31)
                    {
                        BuffInfo b = AbilityMgr.GetBuffInfo(20356, OlGreenwingz, player); // Bad Gaz
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(OlGreenwingz, OlGreenwingz.Level, b));

                        b = AbilityMgr.GetBuffInfo(1927, OlGreenwingz, player); // Sticky Feetz
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(OlGreenwingz, OlGreenwingz.Level, b));
                    }
                }
            }

            go.AbtInterface.StartCast(go, 1927, 1);

            Obj.EvtInterface.AddEvent(Obj.Destroy, 1000, 1);
        }
Esempio n. 27
0
        private void HandleUser(Player player)
        {
            if (_interactors.Contains(player))
            {
                _interactors.Remove(player);

                for (int i = 0; i < _interactionBuffs.Count; ++i)
                {
                    if (_interactionBuffs[i].Target == player)
                    {
                        _interactionBuffs[i].BuffHasExpired = true;
                        _interactionBuffs.RemoveAt(i);
                        --i;
                    }
                }

                player.SendClientMessage("You are no longer in cover behind the " + _info.Name + ".");
                player.Palisade = null;
            }

            else
            {
                _interactors.Add(player);

                player.Palisade = this;

                // Range increase buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(this, 1, AbilityMgr.GetBuffInfo(10356), RegisterUserBuff));

                // Cast time reduction buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(this, 1, AbilityMgr.GetBuffInfo(10936), RegisterUserBuff));

                player.SendClientMessage("You are in in cover behind the " + _info.Name + ".\nWhile in cover, you may not move, but your range is extended, your cast times are reduced, and the palisade will intercept direct attacks aimed at you.");

                player.EvtInterface.AddEventNotify(EventName.OnDie, EventRemovePlayer);
            }
        }
        public override void ExperimentalModeModifyBuff(BuffInfo buffInfo, Unit target)
        {
            switch (buffInfo.Entry)
            {
            // Prayer of Absolution
            case 8242:
                if (target != myPlayer)
                {
                    return;
                }

                // Reduces armor by 50% and converts Strength to Willpower
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Adds 8 RF/sec
                buffInfo.Interval = 1000;
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(8249, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8243, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 3;
                break;

            // Covenant of Tenacity
            case 9563:
                if (target != myPlayer)
                {
                    return;
                }

                // Reduces armor by 50% and converts Strength to Willpower
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Adds 8 SE/sec
                buffInfo.Interval = 1000;
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(9559, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9567, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 3;

                break;

            // Prayer of Devotion
            case 8249:
                if (target != myPlayer)
                {
                    return;
                }

                // Gain Willpower when striking a target
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                myPlayer.AbtInterface.SetCooldown(8242, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8243, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                // AoE detaunt
                CurrentStance = 2;
                break;

            // Covenant of Vitality
            case 9567:
                if (target != myPlayer)
                {
                    return;
                }
                // Gain Willpower when striking a target
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(9559, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9563, _currentStance == 1 ? DPS_SWITCH_CD_MS : SWITCH_CD_MS);
                // Neutralize SE
                if (_currentStance == 1 && myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                // AoE detaunt
                CurrentStance = 2;
                break;

            // Prayer of Righteousness
            case 8243:
                if (target != myPlayer)
                {
                    return;
                }

                // Procs on the caster also increase speed by 20%
                buffInfo.AppendBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 1), 0);
                // Damage of Path of Wrath skills increased by 1% for every 10 RF
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(8249, DPS_SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(8242, DPS_SWITCH_CD_MS);
                // Neutralize Fury
                if (myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 1;
                break;

            // Covenant of Celerity
            case 9559:
                if (target != myPlayer)
                {
                    return;
                }

                //Damage of Path of Torture skills increased by 1 % for every 10 SE
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 2));
                // Convert Willpower to Strength
                buffInfo.AddBuffCommand(AbilityMgr.GetBuffCommand(buffInfo.Entry, 3));
                myPlayer.AbtInterface.SetCooldown(9563, DPS_SWITCH_CD_MS);
                myPlayer.AbtInterface.SetCooldown(9567, DPS_SWITCH_CD_MS);
                // Neutralize SE
                if (myPlayer.CbtInterface.IsInCombat)
                {
                    myPlayer.ConsumeActionPoints(myPlayer.ActionPoints);
                    ConsumeResource(250, true);
                }
                CurrentStance = 1;
                break;

            case 8244:     // Divine Assault
            case 9554:     // Rend Soul
                if (_currentStance == 2)
                {
                    foreach (BuffCommandInfo command in buffInfo.CommandInfo)
                    {
                        for (BuffCommandInfo cmd = command; cmd != null; cmd = cmd.NextCommand)
                        {
                            // Is undefendable, to compensate deals half damage but heals for 75% more
                            if (cmd.CommandName == "StealLife")
                            {
                                cmd.PrimaryValue = (int)(cmd.PrimaryValue * 1.75f);
                            }
                            else if (cmd.DamageInfo != null)
                            {
                                cmd.DamageInfo.Undefendable  = true;
                                cmd.DamageInfo.ResultFromRaw = true;
                            }
                        }
                    }
                }
                break;

            case 8270:     // Absence of Faith becomes 50% with DPS on
                if (_currentStance == 1)
                {
                    buffInfo.CommandInfo[0].SecondaryValue = -50;
                }
                break;
            }
        }
Esempio n. 29
0
        public override void Think(long tick)
        {
            if (_unit.IsDead)
            {
                return;
            }


            base.Think(tick);

            // Only bother to seek targets if we're actually being observed by a player
            if (Combat.CurrentTarget == null && _unit.PlayersInRange.Count > 0)
            {
                if (_pet != null && (_pet.IsHeeling || ((CombatInterface_Pet)_pet.CbtInterface).IgnoreDamageEvents))
                {
                    return;
                }

                Unit target = _unit.AiInterface.GetAttackableUnit();
                if (target != null)
                {
                    _unit.AiInterface.ProcessCombatStart(target);
                }
            }

            var friendlyPlayers = _unit.GetPlayersInRange(30, false).Where(x => x.Realm == _unit.Realm).ToList();

            if (friendlyPlayers.Count() > 0)
            {
                lock (friendlyPlayers)
                {
                    var randomFriend          = StaticRandom.Instance.Next(friendlyPlayers.Count());
                    LinkedBuffInteraction lbi = new LinkedBuffInteraction((ushort)8325, _unit, friendlyPlayers[randomFriend],
                                                                          BuffEffectInvoker.CreateGuardBuff);
                    lbi.Initialize();
                }
            }

            if (Combat.IsFighting && Combat.CurrentTarget != null && _unit.AbtInterface.CanCastCooldown(0) && TCPManager.GetTimeStampMS() > NextTryCastTime)
            {
                var percentHealth = (_unit.Health * 100) / _unit.MaxHealth;
                var target        = Combat.GetCurrentTarget();

                if (percentHealth < 20f)
                {
                    // 695 is healing pot model - bit of hack
                    // This needs to be timed if we dont have a proper inventory to work with.
                    var items = CreatureService.GetCreatureItems((_unit as Creature).Entry).Where(x => x.ModelId == 695);
                    // Low health -- potion of healing
                    if (items.Count() > 0)
                    {
                        // 7872 - Potion of Healing ability
                        _logger.Debug($"{_unit} using Potion of Healing");
                        _unit.AbtInterface.StartCast(_unit, (ushort)7872, 1);
                    }
                }

                var buff = target.BuffInterface.GetBuff((ushort)GameBuffs.Unstoppable, target);

                if ((buff == null) && (_unit.GetDistanceToObject(_unit.CbtInterface.GetCurrentTarget()) < 5))
                {
                    //// If the target is guarding someone - punt them
                    //var guardBuff = target.BuffInterface.GetBuff((ushort)8325, target);

                    var randCC = StaticRandom.Instance.Next(100);

                    if (randCC < 80)
                    {
                        // 9321 - Spiteful Slam
                        _logger.Debug($"{_unit} using Spiteful Slam vs {(target as Player).Name}");
                        _unit.AbtInterface.StartCast(_unit, 9321, 1);
                    }

                    if (randCC >= 80)
                    {
                        // 9328 - Exile
                        _logger.Debug($"{_unit} using Exile vs {(target as Player).Name}");
                        //                        _unit.AbtInterface.StartCast(_unit, 8356, 1);
                        target.ApplyKnockback(_unit, AbilityMgr.GetKnockbackInfo(9328, 0));
                    }
                }


                var rand = StaticRandom.Instance.Next(20);
                switch (rand)
                {
                case 0:
                {
                    // Switch targets
                    _logger.Debug($"{_unit} using Changing Targets {(target as Player).Name}");
                    var randomTarget = SetRandomTarget();
                    _logger.Debug($"{_unit} => {(randomTarget as Player).Name}");
                    break;
                }

                case 1:
                case 2:
                {
                    // 9342 - Blade of Ruin
                    _logger.Debug($"{_unit} using Blade of Ruin vs {(target as Player).Name}");
                    _unit.AbtInterface.StartCast(_unit, 9342, 1);
                    break;
                }

                case 3:
                case 4:
                {
                    // 9349 - Choking Fury
                    _logger.Debug($"{_unit} using Choking Fury vs {(target as Player).Name}");
                    _unit.AbtInterface.StartCast(_unit, 9349, 1);
                    break;
                }

                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                {
                    // 9315 - Hateful Strike
                    _logger.Debug($"{_unit} using Hateful Strike vs {(target as Player).Name}");
                    _unit.AbtInterface.StartCast(_unit, 9315, 1);
                    break;
                }

                case 10:
                case 11:
                {
                    var tauntTarget = SetRandomTarget();
                    // 9322 - Taunt
                    _logger.Debug($"{_unit} using Taunt vs {(tauntTarget as Player).Name}");
                    _unit.AbtInterface.StartCast(_unit, 9322, 1);
                    break;
                }

                case 12:
                {
                    // 608 - Champion's Challenge
                    _logger.Debug($"{_unit} using Champion's Challenge vs {(target as Player).Name}");
                    _unit.AbtInterface.StartCast(_unit, 608, 1);
                    break;
                }

                case 13:
                case 14:
                {
                    var blessing = target.BuffInterface.HasBuffOfType((byte)BuffTypes.Blessing);
                    if (blessing && (_unit.GetDistanceToObject(_unit.CbtInterface.GetCurrentTarget()) < 5))
                    {
                        // 9337 - Shatter Enchantment
                        _logger.Debug($"{_unit} using Shatter Enchantment vs {(target as Player).Name}");
                        _unit.AbtInterface.StartCast(_unit, 9337, 1);
                    }
                    break;
                }
                }
            }
        }
        public void Lockdown()
        {
            GivePoints((byte)_capturePoints[0].OwningRealm, 80);

            _capturePoints[0].Locked = true;
            _capturePoints[1].Locked = true;

            _capturePoints[0].CountdownTimerEnd = TCPManager.GetTimeStamp() + 30;
            _capturePoints[1].CountdownTimerEnd = TCPManager.GetTimeStamp() + 30;

            _pendingLockdown = false;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAY_SOUND);

            Out.WriteByte(0);
            Out.WriteUInt16(_capturePoints[0].OwningRealm == Realms.REALMS_REALM_ORDER ? (ushort)0x0C : (ushort)0x332);
            Out.Fill(0, 10);

            foreach (Object obj in Region.Objects)
            {
                Player plr = obj as Player;
                if (plr != null)
                {
                    plr.SendLocalizeString((_capturePoints[0].OwningRealm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " has locked down " + _capturePoints[0].ObjectiveName + " and " + _capturePoints[1].ObjectiveName + "!", ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT);
                    plr.SendPacket(Out);

                    // 25% damage buff for 30 seconds
                    if (plr.Realm == _capturePoints[0].OwningRealm)
                    {
                        plr.BuffInterface.QueueBuff(new BuffQueueInfo(plr, plr.Level, AbilityMgr.GetBuffInfo(14052)));
                    }
                }
            }

            _capturePoints[0].BroadcastObjectiveInfo();
            _capturePoints[1].BroadcastObjectiveInfo();

            EvtInterface.AddEvent(ReopenObjectives, 30000, 1);
        }