Beispiel #1
0
        // Should always be from same thread as this object
        public virtual void BeginInteraction(Player interactor)
        {
            if (CapturingPlayer != null)
            {
                if (!CapturingPlayer._Value.Online || GetDistanceTo(CapturingPlayer) > 50)
                {
                    interactor.SendClientMessage($"Removed bugged capturer {CapturingPlayer.Name} from {Name}.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                }

                else
                {
                    interactor.SendClientMessage(CapturingPlayer.Name + " is already interacting with this object.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                    return;
                }
            }

            CapturingPlayer = interactor;

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

            buffInfo.Duration = CaptureDuration;
            CapturingPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(CapturingPlayer, CapturingPlayer.Level, buffInfo, InteractionBuff.GetNew, LinkToCaptureBuff));

            if (interactor.IsMounted)
            {
                interactor.Dismount();
            }
        }
Beispiel #2
0
        private void LoadSavedBuffs()
        {
            List <CharacterSavedBuff> buffList = _playerOwner.Info.Buffs;

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

            int curTime = 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));
            }
        }
        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;
            }
        }
Beispiel #4
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));
            }
        }
Beispiel #5
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);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
Beispiel #8
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();
        }
        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;
                        }
                    }
                }
            }
        }
Beispiel #10
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);
            }
        }
        /// <summary>Regular root command. Will fail if the target is Immovable.</summary>
        public virtual bool TryRoot(NewBuff hostBuff)
        {
            if (IsImmovable)
            {
                return(false);
            }
            lock (MovementCCLock)
            {
                if (IsImmovable)
                {
                    return(false);
                }
                IsImmovable = true;
            }

            BuffInterface.QueueBuff(new BuffQueueInfo(this, EffectiveLevel, AbilityMgr.GetBuffInfo((ushort)GameBuffs.Immovable)));
            StsInterface.AddVelocityModifier(hostBuff, 0);
            return(true);
        }
        protected void BuffAtCombatStart()
        {
            if (_unit.AbtInterface.NPCAbilities == null)
            {
                return;
            }

            foreach (NPCAbility ability in _unit.AbtInterface.NPCAbilities)
            {
                // If ability is set to Active = 0 it will not be played
                if (ability.Active == 0 || ability.ActivateOnCombatStart == 0)
                {
                    continue;
                }

                //_unit.AbtInterface.StartCast(_unit, ability.Entry, 1);
                BuffInfo b = AbilityMgr.GetBuffInfo(ability.Entry, _unit, _unit); // This should cast buff on self
                _unit.BuffInterface.QueueBuff(new BuffQueueInfo(_unit, _unit.Level, b));
            }
        }
        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);
        }
        private void InvokeChannelBuff()
        {
            byte desiredLevel = _channelInfo.Level;

            if (_channelInfo.BoostLevel > 0 && _caster != _target)
            {
                desiredLevel = _channelInfo.BoostLevel;

                    #if DEBUG
                ((Player)_caster).SendClientMessage("Boost debug: Casting with level " + desiredLevel + " on target " + _target.Name);
                    #endif
            }

            BuffInfo buffInfo = AbilityMgr.GetBuffInfo(_channelInfo.Entry, _host, _target);
            if (!string.IsNullOrEmpty(buffInfo.AuraPropagation))
            {
                _target.BuffInterface.QueueBuff(new BuffQueueInfo(_caster, desiredLevel, buffInfo, BuffEffectInvoker.CreateAura, ChannelInitialization));
            }
            else
            {
                _target.BuffInterface.QueueBuff(new BuffQueueInfo(_caster, desiredLevel, buffInfo, ChannelInitialization));
            }
        }
Beispiel #15
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);
            }
        }
Beispiel #16
0
        protected virtual void PropagateGroup()
        {
            if (_groupPendingTargetList.Count > 0)
            {
                List <NewBuff> locList = new List <NewBuff>();
                lock (_groupPendingTargetList)
                {
                    locList.AddRange(_groupPendingTargetList);
                    _groupPendingTargetList.Clear();
                }

                foreach (var buff in locList)
                {
                    _groupTargetList.Add(buff.Target, buff);
                }
            }

            Group myGroup = _myPlayer.PriorityGroup;

            if (myGroup != null)
            {
                foreach (var member in myGroup.GetUnitList((Player)Caster))
                {
                    if (member == Caster && Target == Caster)
                    {
                        continue;
                    }

                    if (!Target.IsDead && member.ObjectWithinRadiusFeet(Target, MAX_GROUP_RADIUS - 10))
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            if (_groupTargetList[member].BuffHasExpired)
                            {
                                _groupTargetList.Remove(member);
                            }
                            continue;
                        }

                        if (Duration == 0)
                        {
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, member), RegisterGroupBuff));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, member);
                            BI.Duration = (ushort)(Math.Max(1, RemainingTimeMs * 0.001f));
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterGroupBuff));
                        }
                    }

                    else
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            // Group member out of range - finish the buff and remove them
                            if (!_groupTargetList[member].BuffHasExpired)
                            {
                                _groupTargetList[member].BuffHasExpired = true;
                            }
                            _groupTargetList.Remove(member);
                        }
                    }
                }
            }

            else
            {
                if (_myPlayer != Target)
                {
                    if (_myPlayer.IsInCastRange(Target, MAX_GROUP_RADIUS))
                    {
                        if (_groupTargetList.ContainsKey(_myPlayer))
                        {
                            if (_groupTargetList[_myPlayer].BuffHasExpired)
                            {
                                _groupTargetList.Remove(_myPlayer);
                            }
                        }

                        else if (Duration == 0)
                        {
                            _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, _myPlayer), RegisterGroupBuff));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, _myPlayer);
                            BI.Duration = (ushort)(Math.Max(1, RemainingTimeMs * 0.001f));
                            _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterGroupBuff));
                        }
                    }

                    else
                    {
                        if (_groupTargetList.ContainsKey(_myPlayer))
                        {
                            // Group member out of range - finish the buff and remove them
                            if (!_groupTargetList[_myPlayer].BuffHasExpired)
                            {
                                _groupTargetList[_myPlayer].BuffHasExpired = true;
                            }
                            _groupTargetList.Remove(_myPlayer);
                        }
                    }
                }
            }


            List <Unit> gtlKeys = _groupTargetList.Keys.ToList();

            foreach (var guy in gtlKeys)
            {
                if (guy == _myPlayer && _myPlayer != Target)
                {
                    continue;
                }

                if (Target.IsDead || myGroup == null || !myGroup.HasUnit(guy))
                {
                    _groupTargetList[guy].BuffHasExpired = true;
                    _groupTargetList.Remove(guy);
                }
            }
        }
Beispiel #17
0
        private void PropagateFoe()
        {
            int addedThisTick = 0;

            if (_otherPendingTargetList.Count > 0)
            {
                lock (_otherPendingTargetList)
                {
                    foreach (NewBuff buff in _otherPendingTargetList)
                    {
                        _otherTargetList.Add(buff.Target, new AuraInfo(buff, _passNum));
                    }

                    _otherPendingTargetList.Clear();
                }
            }

            foreach (Object obj in Target.ObjectsInRange)
            {
                Unit foe = obj as Unit;

                if (foe == null || foe.IsInvulnerable)
                {
                    continue;
                }

                if (!Target.IsDead && foe.ObjectWithinRadiusFeet(Target, MaxFoeRadius - 10) && CombatInterface.CanAttack(Caster, foe) && ((Caster is Creature) || (!(foe is Player) || foe.CbtInterface.IsPvp)) && Target.LOSHit(foe))
                {
                    if (_otherTargetList.ContainsKey(foe))
                    {
                        if (_otherTargetList[foe].Buff.BuffHasExpired)
                        {
                            _otherTargetList.Remove(foe);
                        }
                        else
                        {
                            _otherTargetList[foe].PassNum = _passNum;
                        }
                        continue;
                    }

                    if (addedThisTick + _otherTargetList.Count == 9)
                    {
                        continue;
                    }

                    if (Duration == 0)
                    {
                        foe.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, foe), RegisterOtherBuff));
                    }
                    else
                    {
                        BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, foe);
                        BI.IsAoE    = true;
                        BI.Duration = Math.Max((ushort)1, (ushort)(RemainingTimeMs * 0.001f));
                        foe.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterOtherBuff));
                    }

                    ++addedThisTick;
                }

                else
                {
                    if (!_otherTargetList.ContainsKey(foe))
                    {
                        continue;
                    }

                    // Group member out of range - finish the buff and remove them
                    if (!_otherTargetList[foe].Buff.BuffHasExpired)
                    {
                        _otherTargetList[foe].Buff.BuffHasExpired = true;
                    }

                    _otherTargetList.Remove(foe);
                }
            }


            List <Unit> oldUnits = _otherTargetList.Keys.ToList();

            // Remove any units not refreshed on this tick
            foreach (Unit oldfoe in oldUnits)
            {
                if (_otherTargetList[oldfoe].PassNum == _passNum)
                {
                    continue;
                }

                _otherTargetList[oldfoe].Buff.BuffHasExpired = true;
                _otherTargetList.Remove(oldfoe);
            }
        }
        private void BreakMode()
        {
            myPlayer.StsInterface.RemoveItemStatGift(Stats.Willpower);
            myPlayer.StsInterface.RemoveItemStatGift(Stats.HealCritRate);
            myPlayer.StsInterface.RemoveItemStatGift(Stats.HealingPower);

            myPlayer.StsInterface.DisableItemBonus(Stats.Intelligence, false);
            myPlayer.StsInterface.DisableItemBonus(Stats.MagicCritRate, false);
            myPlayer.StsInterface.DisableItemBonus(Stats.MagicPower, false);

            /*
             * PacketOut OutRm = new PacketOut((byte)Opcodes.F_INIT_EFFECTS, 12);
             * OutRm.WriteByte(1);
             * OutRm.WriteByte(BUFF_REMOVE);
             * OutRm.WriteUInt16(0);
             * OutRm.WriteUInt16(myPlayer.Oid);
             * OutRm.WriteByte(255); // buffID - some number I pulled out of the air
             * OutRm.WriteByte(0);
             * OutRm.WriteUInt16R(_fakeBuffEntry);
             * OutRm.WriteByte(0);
             *
             * myPlayer.SendPacket(OutRm);
             */

            int IntBonus     = myPlayer.StsInterface.GiftItemStatTo(Stats.Intelligence, Stats.Willpower);
            int MagCritBonus = myPlayer.StsInterface.GiftItemStatTo(Stats.MagicCritRate, Stats.HealCritRate);
            int MagPwrBonus  = myPlayer.StsInterface.GiftItemStatTo(Stats.MagicPower, Stats.HealingPower);

            myPlayer.StsInterface.DisableItemBonus(Stats.Willpower, true);
            myPlayer.StsInterface.DisableItemBonus(Stats.HealCritRate, true);
            myPlayer.StsInterface.DisableItemBonus(Stats.HealingPower, true);

            PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS, 24);

            Out.WriteByte(1);
            Out.WriteByte(BUFF_ADD);
            Out.WriteUInt16(0xF4FF);
            Out.WriteUInt16(myPlayer.Oid);
            Out.WriteByte(255);
            Out.WriteByte(0);
            Out.WriteUInt16R(_fakeBuffEntry);
            Out.WriteZigZag(0);
            Out.WriteUInt16R(myPlayer.Oid);
            Out.WriteByte(6);

            Out.WriteByte(0);
            Out.WriteZigZag(MagCritBonus);      // magic crit

            Out.WriteByte(1);
            Out.WriteZigZag(IntBonus);    // intelligence component

            Out.WriteByte(2);
            Out.WriteZigZag(MagPwrBonus);    // magic pwr

            Out.WriteByte(3);
            Out.WriteZigZag(-MagCritBonus);      // heal crit

            Out.WriteByte(4);
            Out.WriteZigZag(-IntBonus);   // willpower component

            Out.WriteByte(5);
            Out.WriteZigZag(-MagPwrBonus);    // heal pwr
            Out.WriteByte(0);

            myPlayer.SendPacket(Out);

            if (_vfxid != 0)
            {
                if (_vfxBuff == null || _vfxBuff.BuffHasExpired)
                {
                    myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_vfxid), LinkVfxBuff));
                }
            }
            else
            {
                Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT, 10);
                Out.WriteUInt16(myPlayer.Oid);
                Out.WriteUInt16(myPlayer.Oid);
                Out.WriteUInt16(_fakeBuffEntry); // 00 00 07 D D

                Out.WriteByte(0);
                Out.WriteByte(0);
                Out.WriteByte(1);

                Out.WriteByte(0);
                myPlayer.DispatchPacket(Out, true);
            }
        }
        public void SummonPet(ushort myID)
        {
            if (_summoning)
            {
                return;
            }
            try
            {
                _summoning = true; // Happens when pet is automatically reset after zone change
                if (myPet != null)
                {
                    myPet.ReceiveDamage(myPet, uint.MaxValue);
                    myPet = null;
                }
                if (myPlayer.Zone == null)
                {
                    return;
                }

                _currentPetID = myID;

                Creature_proto Proto = new Creature_proto {
                    Faction = 129
                };

                switch (myID)
                {
                case 1841:
                    Proto.Name   = myPlayer.Name + "'s Squig";
                    Proto.Model1 = 136;
                    Proto.Ranged = 0;
                    break;

                case 1842:
                    Proto.Name   = myPlayer.Name + "'s Horned Squig";
                    Proto.Model1 = 137;
                    Proto.Ranged = 0;
                    break;

                case 1843:
                    Proto.Name   = myPlayer.Name + "'s Gas Squig";
                    Proto.Model1 = 139;
                    Proto.Ranged = 100;
                    break;

                case 1844:
                    Proto.Name   = myPlayer.Name + "'s Spiked Squig";
                    Proto.Model1 = 138;
                    Proto.Ranged = 80;
                    break;

                case 1845:
                    Proto.Name   = myPlayer.Name + "'s Battle Squig";
                    Proto.Model1 = 140;
                    Proto.Ranged = 0;
                    break;

                case 2828:
                    Proto.Name   = myPlayer.Name + "'s Horned Squig";
                    Proto.Model1 = 137;
                    Proto.Ranged = 0;
                    break;

                case 2829:
                    Proto.Name   = myPlayer.Name + "'s Gas Squig";
                    Proto.Model1 = 139;
                    Proto.Ranged = 100;
                    break;
                }

                Creature_spawn Spawn = new Creature_spawn();


                Proto.MinScale = 50;
                Proto.MaxScale = 50;
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO         = myPlayer._Value.WorldO;
                Spawn.WorldY         = myPlayer._Value.WorldY;
                Spawn.WorldZ         = myPlayer._Value.WorldZ;
                Spawn.WorldX         = myPlayer._Value.WorldX;
                Spawn.ZoneId         = myPlayer.Zone.ZoneId;
                Spawn.Icone          = 18;
                Spawn.WaypointType   = 0;
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel = myPlayer.EffectiveLevel;

                if (Spawn.Proto.MinLevel > 40)
                {
                    Spawn.Proto.MinLevel = 40;
                    Spawn.Proto.MaxLevel = 40;
                }

                _myPet = new Pet(myID, Spawn, myPlayer, _AIMode, false, true);

                if (myID == 1844)
                {
                    myPet.BuffInterface.QueueBuff(new BuffQueueInfo(myPet, 1, AbilityMgr.GetBuffInfo(14)));
                }

                myPlayer.Region.AddObject(_myPet, Spawn.ZoneId);

                myPlayer.BuffInterface.NotifyPetEvent(myPet);
            }
            finally
            {
                _summoning = false;
            }
        }
Beispiel #20
0
        private void PropagateBehind()
        {
            if (_otherPendingTargetList.Count > 0)
            {
                List <NewBuff> locList = new List <NewBuff>();
                lock (_otherPendingTargetList)
                {
                    locList.AddRange(_otherPendingTargetList);
                    _otherPendingTargetList.Clear();
                }

                foreach (var buff in locList)
                {
                    _otherTargetList.Add(buff.Target, new AuraInfo(buff, _passNum));
                }
            }

            foreach (Object obj in Target.ObjectsInRange)
            {
                Unit ally = obj as Player;

                if (ally == null || ally.Realm != Caster.Realm)
                {
                    continue;
                }

                if (Caster.CanHitWithAoE(ally, 360, MAX_HTL_RADIUS - 10) && !Caster.IsObjectInFront(ally, 270))
                {
                    if (_otherTargetList.ContainsKey(ally))
                    {
                        if (_otherTargetList[ally].Buff.BuffHasExpired) // Group member already has this buff and it's still active, so sustain it
                        {
                            _otherTargetList.Remove(ally);
                        }
                        else
                        {
                            _otherTargetList[ally].PassNum = _passNum;
                        }
                        continue;
                    }

                    if (Duration == 0)
                    {
                        ally.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, ally), RegisterOtherBuff));
                    }

                    else if (RemainingTimeMs * 0.001f > 0)
                    {
                        BuffInfo bi = AbilityMgr.GetBuffInfo(_buffInfo.Entry, Caster, ally);
                        bi.Duration = Math.Max((ushort)1, (ushort)(RemainingTimeMs * 0.001f));

                        ally.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, bi, RegisterOtherBuff));
                    }
                }

                else
                {
                    if (!_otherTargetList.ContainsKey(ally))
                    {
                        continue;
                    }

                    // Group member out of range - finish the buff and remove them
                    if (!_otherTargetList[ally].Buff.BuffHasExpired)
                    {
                        _otherTargetList[ally].Buff.BuffHasExpired = true;
                    }

                    _otherTargetList.Remove(ally);
                }
            }

            List <Unit> oldUnits = _otherTargetList.Keys.ToList();

            // Remove any units not refreshed on this tick
            foreach (Unit oldAlly in oldUnits)
            {
                if (_otherTargetList[oldAlly].PassNum == _passNum)
                {
                    continue;
                }

                _otherTargetList[oldAlly].Buff.BuffHasExpired = true;
                _otherTargetList.Remove(oldAlly);
            }
        }
        public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;

            Player player = cclient.Plr;

            if (player == null || !player.IsInWorld())
            {
                return;
            }



            bool skipSend = false;

            long pos = packet.Position;

            //Comments below are for testing State2

            //byte[] data = packet.ToArray();
            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2, (int)packet.Size + 1);

            //Out.Write(data, (int)packet.Position, (int)packet.Size); // instead of the line below for testing
            Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
            Out.WriteByte(0);

/*
 #if DEBUG
 *          State2 stateTest = new State2();
 *          stateTest.Read(data, data.Length);
 *          Log.Info("state2.HasEnemyTarget", stateTest.HasEnemyTarget.ToString());
 *          Log.Info("state2.FreeFall", stateTest.FreeFall.ToString());
 *          Log.Info("state2.Falltime", stateTest.FallTime.ToString());
 #endif
 */
//End of the testing of state2

            packet.Position = pos;

            byte[] data = packet.ToArray();

            // Experimental throttling if too many players in range. This can be overridden later if the position update's forced
            if (player.PlayersInRange.Count > 150 && TCPManager.GetTimeStampMS() - player.LastStateRecvTime < 200)
            {
                skipSend = true;
            }

            ushort currentHeading = player.Heading;

            if (packet.Size > 9 && packet.Size < 18)
            {
                long state  = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 2));
                long state2 = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 10));

                ushort x = ((ushort)(((state2 >> 56 & 0x1) << 15) | ((state >> 0 & 0xFF) << 7) | ((state >> 9 & 0x7F))));
                ushort y = ((ushort)(((state2 >> 40 & 0x1) << 15) | ((state2 >> 48 & 0xFF) << 7) | ((state2 >> 57 & 0x7F))));
                ushort z = ((ushort)(((state2 >> 16 & 0x3) << 14) | ((state2 >> 24 & 0xFF) << 6) | ((state2 >> 34 & 0x3F))));

                ushort direction  = ((ushort)(((state >> 16 & 0x7F) << 5) | ((state >> 27 & 0x1F))));
                ushort zoneID     = ((byte)(((state2 >> 32 & 0x1) << 7) | ((state2 >> 41 & 0x7F))));
                bool   grounded   = ((((state >> 8 & 0x1))) == 1);
                byte   fallState  = ((byte)(((state >> 40 & 0x1F))));
                bool   walking    = ((((state >> 48 & 0x1))) == 1);
                bool   moving     = ((((state >> 49 & 0x1))) == 1);
                bool   notMoving  = ((((state >> 63 & 0x1))) == 1);
                byte   groundtype = ((byte)(((state2 >> 82 & 0x1F))));

                //Hack Zone ID should be ushort but we only read a byte
                if (cclient.Plr.ZoneId > 255)
                {
                    zoneID = (ushort)Utils.setBit(zoneID, 8, true);
                }

                //hardcode to not allow players into gunbad in case we miss to invalidate the zone on push
#if (!DEBUG)
                /*
                 * if (zoneID == 60 && player.Client.IsPlaying())
                 * {
                 *  if (player.Realm == Realms.REALMS_REALM_DESTRUCTION)
                 *      player.Teleport(161, 439815, 134493, 16865, 0);
                 *
                 *  else if (player.Realm == Realms.REALMS_REALM_ORDER)
                 *      player.Teleport(162, 124084, 130213, 12572, 0);
                 * }
                 */

                if (zoneID == 111 && player.Client.IsPlaying())
                {
                    if (player.Realm == Realms.REALMS_REALM_DESTRUCTION)
                    {
                        player.Teleport(202, 1411789, 1454421, 3516, 0);
                    }

                    else if (player.Realm == Realms.REALMS_REALM_ORDER)
                    {
                        player.Teleport(202, 1449783, 1459746, 3549, 0);
                    }
                }
#endif

                //stop players from getting stuck below the world like below IC
                if (player.Z < 150 && !player.IsDead && player.Client.IsPlaying())
                {
                    player.SendClientMessage("You have fallen through the floor, instead of falling and getting stuck somewhere you get terminated.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                    player.Terminate();
                }

                //lets move players instantly, if they are in a void (even staff)
                if ((zoneID == 0 && player.ZoneId.HasValue) && player.Client.IsPlaying())
                {
                    player.SendClientMessage("You managed to go outside of the worlds boundries, as such you have been forcefully moved to your capital", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                    if (player.Realm == Realms.REALMS_REALM_DESTRUCTION)
                    {
                        player.Teleport(161, 439815, 134493, 16865, 0);
                    }



                    else if (player.Realm == Realms.REALMS_REALM_ORDER)
                    {
                        player.Teleport(162, 124084, 130213, 12572, 0);
                    }
                }


                //player should not be able to cast while in the air.
                if (!grounded)
                {
                    if (player.AbtInterface.GetAbiityProcessor() != null && player.AbtInterface.GetAbiityProcessor().HasInfo() && player.AbtInterface.GetAbiityProcessor().AbInfo.Entry != 8090 && player.AbtInterface.GetAbiityProcessor().AbInfo.Entry != 9393)
                    {
                        player.AbtInterface.Cancel(true);
                    }
                }

                if (fallState != 31 || ((moving || walking || !notMoving || !grounded) && player.Speed > 0))
                {
                    player.IsMoving = true;
                }
                else
                {
                    player.IsMoving = false;
                }

                if (!player.WasGrounded)
                {
                    if (grounded)
                    {
                        player.CalculateFallDamage();
                        player.AirCount          = -1;
                        player.ForceSendPosition = true;
                    }
                }

                player.WasGrounded = grounded;

                if (!grounded)
                {
                    player.FallState = fallState;
                }

                // Throttle pure rotation updates.
                if (player.X == x && player.Y == y && player.Z == z && TCPManager.GetTimeStampMS() - player.LastStateRecvTime < 150)
                {
                    if (player.AirCount == -1)
                    {
                        player.AirCount = 0;
                    }
                    else
                    {
                        skipSend = true;
                    }
                }

                if (player.IsStaggered || player.IsDisabled)
                {
                    direction = currentHeading;
                }

                player.SetPosition(x, y, z, direction, zoneID);

                //solid, exclude any zones that has to use a hardcode lava to not disable the damage instantly
                if (groundtype == 0)
                {
                    //release lava damage
                    if (_lavaBuffs.ContainsKey(player) && (zoneID != 190 || zoneID != 197))
                    {
                        _lavaBuffs[player].BuffHasExpired = true;
                        _lavaBuffs.Remove(player);
                    }
                }
                //shallow water 1, have no use for it atm, shallow sludge 7

                /*
                 * if (groundtype == 1 || groundtype == 7)
                 * {
                 *
                 * }*/

                //deep water 17 in current implementation should be 2 by londos decode, deep sludge 23
                if (groundtype == 17 || groundtype == 23)
                {
                    player.Dismount();
                }

                //lava
                long Now = TCPManager.GetTimeStampMS();
                if (groundtype == 3 || groundtype == 19) //19 is deep lava
                {
                    player.Dismount();
                    if (!player.IsDead)
                    {
                        //do lava dmg
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                }

                //instadeath

                if (groundtype == 5 || groundtype == 21) //should be 4 according to londos notes 5=lotd shallow water 21=lotd deep water
                {
                    if (!player.IsDead)
                    {
                        Log.Texte("groundstate instadeath: ", player.Name + " managed to trigger groundtype instadeath in zone: " + player.ZoneId, ConsoleColor.Yellow);
                        player.SendClientMessage("You have managed to trigger the instadeath code from river mortis, please screenshot your death and send to the devs on the bugtracker", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                        player.Terminate();
                    }
                }

                //bright wizard colleage lava
                if (zoneID == 197)
                {
                    if (!player.IsDead && player.Z <= 23791)
                    {
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                    else
                    {
                        if (_lavaBuffs.ContainsKey(player))
                        {
                            _lavaBuffs[player].BuffHasExpired = true;
                            _lavaBuffs.Remove(player);
                        }
                    }
                }
                if (zoneID == 190)
                {
                    if (!player.IsDead && player.Z <= 7806)
                    {
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                    else
                    {
                        if (_lavaBuffs.ContainsKey(player))
                        {
                            _lavaBuffs[player].BuffHasExpired = true;
                            _lavaBuffs.Remove(player);
                        }
                    }
                }

                if (player.Zone.Info.Illegal && player.GmLevel < 1)
                {
                    if (!player.IsDead && player.BuffInterface.GetBuff(27960, player) == null)
                    {
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(27960)));
                    }
                }
                else if (!player.Zone.Info.Illegal)
                {
                    if (player.BuffInterface.GetBuff(27960, player) != null)
                    {
                        player.BuffInterface.RemoveBuffByEntry(27960);
                    }
                }

                if (player.ForceSendPosition)
                {
                    skipSend = false;
                    player.ForceSendPosition = false;
                }

                //gunbad has low points where we want to kill the player
                if (zoneID == 60 && player.Z < 17900)
                {
                    player.Terminate();
                }
            }

            #region Long seems to be when the player has a hostile target
            else if (packet.Size > 17)
            {
                long state  = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 2));
                long state2 = System.Net.IPAddress.NetworkToHostOrder(BitConverter.ToInt64(data, 10));

                ushort x          = ((ushort)(((state2 >> 56 & 0x3) << 14) | ((state >> 0 & 0xFF) << 6) | ((state >> 10 & 0x3F))));
                ushort y          = ((ushort)(((state2 >> 40 & 0x3) << 14) | ((state2 >> 48 & 0xFF) << 6) | ((state2 >> 58 & 0x3F))));
                ushort z          = ((ushort)(((state2 >> 16 & 0x7) << 12) | ((state2 >> 24 & 0xFF) << 4) | ((state2 >> 36 & 0x0F))));
                byte   zoneID     = ((byte)(((state2 >> 34 & 0x1) << 7) | ((state2 >> 32 & 0x3) << 5) | ((state2 >> 43 & 0x1F))));
                ushort direction  = ((ushort)(((state >> 16 & 0xFF) << 4) | ((state >> 28 & 0x0F))));
                bool   grounded   = ((((state >> 9 & 0x1))) == 1);
                bool   walking    = ((((state >> 48 & 0x1))) == 1);
                bool   moving     = ((((state >> 49 & 0x1))) == 1);
                bool   notMoving  = ((((state >> 63 & 0x1))) == 1);
                byte   fallState  = ((byte)(((state >> 40 & 0x1F))));
                byte   groundtype = ((byte)(((state2 >> 73 & 0x1F))));

                if (fallState != 31 || ((moving || walking || !notMoving || !grounded) && player.Speed > 0))
                {
                    player.IsMoving = true;
                }
                else
                {
                    player.IsMoving = false;
                }

                //stop players from getting stuck below the world like below IC
                if (player.Z < 150 && !player.IsDead && player.Client.IsPlaying())
                {
                    player.SendClientMessage("You have fallen through the floor, instead of falling and getting stuck somewhere you get terminated.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                    player.Terminate();
                }
                //hardcode to not allow players into gunbad in case we miss to invalidate the zone on push
#if (!DEBUG)
                /*
                 * if (zoneID == 60 && player.Client.IsPlaying())
                 * {
                 *  if (player.Realm == Realms.REALMS_REALM_DESTRUCTION)
                 *      player.Teleport(161, 439815, 134493, 16865, 0);
                 *
                 *  else if (player.Realm == Realms.REALMS_REALM_ORDER)
                 *      player.Teleport(162, 124084, 130213, 12572, 0);
                 * }
                 */
#endif

                //lets move players instantly, if they are in a void (even staff)
                if ((zoneID == 0 && player.ZoneId.HasValue) && player.Client.IsPlaying())
                {
                    player.SendClientMessage("You managed to go outside of the worlds boundries, as such you have been forcefully moved to your capital", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                    if (player.Realm == Realms.REALMS_REALM_DESTRUCTION)
                    {
                        player.Teleport(161, 439815, 134493, 16865, 0);
                    }

                    else if (player.Realm == Realms.REALMS_REALM_ORDER)
                    {
                        player.Teleport(162, 124084, 130213, 12572, 0);
                    }
                }

                //player should not be able to cast while in the air.
                if (!grounded)
                {
                    player.AbtInterface.Cancel(true);
                }

                if (!player.WasGrounded)
                {
                    if (grounded)
                    {
                        player.CalculateFallDamage();
                        player.AirCount          = -1;
                        player.ForceSendPosition = true;
                    }
                }

                player.WasGrounded = grounded;
                if (!grounded)
                {
                    player.FallState = fallState;
                }

                if (player.IsStaggered || player.IsDisabled)
                {
                    direction = currentHeading;
                }

                player.SetPosition(x, y, z, direction, zoneID);

                //solid, exclude any zones that has to use a hardcode lava to not disable the damage instantly
                if (groundtype == 0)
                {
                    //release lava damage
                    if (_lavaBuffs.ContainsKey(player) && (zoneID != 190 || zoneID != 197))
                    {
                        _lavaBuffs[player].BuffHasExpired = true;
                        _lavaBuffs.Remove(player);
                    }
                }
                //shallow water 1, have no use for it atm... shallow sludge 7

                /*
                 * if (groundtype == 1 || groundtype == 7)
                 * {
                 *
                 * }*/

                //deep water 17 in current implementation should be 2 by londos decode, deep sludge 23
                if (groundtype == 17 || groundtype == 23)
                {
                    player.Dismount();
                }

                //lava
                long Now = TCPManager.GetTimeStampMS();
                if (groundtype == 3 || groundtype == 19) //19 is deep lava
                {
                    player.Dismount();
                    if (!player.IsDead)
                    {
                        //do lava dmg
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                }

                //instadeath

                if (groundtype == 5 || groundtype == 21) //should be 4 according to londos notes 5=lotd shallow water 21=lotd deep water
                {
                    if (!player.IsDead)
                    {
                        Log.Texte("groundstate instadeath: ", player.Name + " managed to trigger groundtype instadeath in zone: " + player.ZoneId, ConsoleColor.Yellow);
                        player.SendClientMessage("You have managed to trigger the instadeath code from river mortis, please screenshot your death and send to the devs on the bugtracker", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);

                        player.Terminate();
                    }
                }

                //bright wizard colleage lava
                if (zoneID == 197)
                {
                    if (!player.IsDead && player.Z <= 23791)
                    {
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                    else
                    {
                        if (_lavaBuffs.ContainsKey(player))
                        {
                            _lavaBuffs[player].BuffHasExpired = true;
                            _lavaBuffs.Remove(player);
                        }
                    }
                }
                if (zoneID == 190)
                {
                    if (!player.IsDead && player.Z <= 7806)
                    {
                        if (_lavatimer < Now)
                        {
                            player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(14430), AddLavaBuff));
                            _lavatimer = Now + 1000;
                            player.ResetMorale();
                        }
                    }
                    else
                    {
                        if (_lavaBuffs.ContainsKey(player))
                        {
                            _lavaBuffs[player].BuffHasExpired = true;
                            _lavaBuffs.Remove(player);
                        }
                    }
                }

                if (player.Zone.Info.Illegal && player.GmLevel == 0)
                {
                    if (!player.IsDead && player.BuffInterface.GetBuff(27960, player) == null)
                    {
                        player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo(27960)));
                    }
                }
                else if (!player.Zone.Info.Illegal)
                {
                    if (player.BuffInterface.GetBuff(27960, player) != null)
                    {
                        player.BuffInterface.RemoveBuffByEntry(27960);
                    }
                }

                if (player.ForceSendPosition)
                {
                    skipSend = false;
                    player.ForceSendPosition = false;
                }

                //gunbad has low points where we want to kill the player
                if (zoneID == 60 && player.Z < 17900)
                {
                    player.Terminate();
                }
            }

            #endregion

            // Packets not conforming to the above are sent at 500ms intervals when the player is still.
            // I don't know their function, but it appears they're of no interest to the client.
            else
            {
                skipSend = true;
                player.ForceSendPosition = true;
            }

            // TODO: Conditional dispatch for Player State 2
            if (skipSend)
            {
                return;
            }
            player.SendCounter++;
            //player.DebugMessage("F_PLAYER_STATE2: "+ (TCPManager.GetTimeStampMS() - player.LastStateRecvTime));
            player.DispatchPacket(Out, false, true);
            player.LastStateRecvTime = TCPManager.GetTimeStampMS();
        }
        public bool CheckHP(Object Obj, object instigator)
        {
            Creature c = this.Obj as Creature; // We are casting the script initiator as a Creature

            if (Stage < 0 && !c.IsDead)
            {
                Stage = 0; // Setting control value to 0
            }
            else if (c.Health < c.TotalHealth * 0.2 && Stage < 3 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    c, (ushort)14897, "This battle may be yours but my will persists. If we meet again, it is you that will return to the soil and eternally serve the Mourkain!"
                };                                                                                                                                                                                              // Iron Body
                c.EvtInterface.AddEvent(DelayedBuff, 100, 1, prms);

                foreach (Object o in c.ObjectsInRange.ToList())
                {
                    GameObject go = o as GameObject;
                    if (go != null && go.Entry == 100524)
                    {
                        go.Say("*** Magical barrier collaps and the gem is in your reach... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);
                        go.Destroy();
                    }

                    if (go != null && go.Entry == 100523)
                    {
                        go.IsInvulnerable = false;
                        go.IsAttackable   = 1;
                        go.Health         = go.TotalHealth;

                        //go.Say("*** Cracks start to show upon surface of the gem... ***", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_EMOTE);

                        foreach (Player plr in go.PlayersInRange.ToList())
                        {
                            if (plr != null)
                            {
                                BuffInfo b = AbilityMgr.GetBuffInfo(13058, c, plr); // Killer dot
                                plr.BuffInterface.QueueBuff(new BuffQueueInfo(c, c.Level, b));
                                go.SendMeTo(plr);
                            }
                        }

                        break;
                    }
                }

                Stage = 3;

                //c.Say("Stage 3");
            }
            else if (c.Health < c.TotalHealth * 0.4 && Stage < 2 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    2000561, 1109983, 1119476, 19138, (int)Obj.Heading, (uint)0
                };                                                                                             // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1110752, 1119141, 19134, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1111016, 1119874, 19145, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                prms = new List <object>()
                {
                    2000561, 1110467, 1120222, 19146, (int)Obj.Heading, (uint)0
                };                                                                                         // Deathshadow Drudge
                c.EvtInterface.AddEvent(SpawnGO, 100, 1, prms);

                c.Say("Arise, my servants, for it is time the Mourkain retake this word!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                //c.IsInvulnerable = true;

                //c.EvtInterface.AddEvent(RemoveBuffs, 30000, 1);

                Stage = 2;

                //c.Say("Stage 2");
            }
            else if (c.Health < c.TotalHealth * 0.7 && Stage < 1 && !c.IsDead)
            {
                var prms = new List <object>()
                {
                    2000876, 1109983, 1119476, 19138, Obj.Heading
                };                                                                               // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1110752, 1119141, 19134, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1111016, 1119874, 19145, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                prms = new List <object>()
                {
                    2000876, 1110467, 1120222, 19146, Obj.Heading
                };                                                                           // Deathshadow Construct
                c.EvtInterface.AddEvent(SpawnAdds, 100, 1, prms);

                c.Say("Arise, my servants, for it is time the Mourkain retake this word!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);

                //c.IsInvulnerable = true;

                //c.EvtInterface.AddEvent(RemoveBuffs, 30000, 1);

                Stage = 1;

                //c.Say("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);
     }
 }
        public void ReloadTactics()
        {
            List <ushort> tacList          = new List <ushort>();
            bool          sendTacticUpdate = false;

            if (_myPlayer._Value.Tactic1 != 0 && !tacList.Contains(_myPlayer._Value.Tactic1))
            {
                tacList.Add(_myPlayer._Value.Tactic1);
            }
            if (_myPlayer._Value.Tactic2 != 0 && !tacList.Contains(_myPlayer._Value.Tactic2))
            {
                tacList.Add(_myPlayer._Value.Tactic2);
            }
            if (_myPlayer._Value.Tactic3 != 0 && !tacList.Contains(_myPlayer._Value.Tactic3))
            {
                tacList.Add(_myPlayer._Value.Tactic3);
            }
            if (_myPlayer._Value.Tactic4 != 0 && !tacList.Contains(_myPlayer._Value.Tactic4))
            {
                tacList.Add(_myPlayer._Value.Tactic4);
            }

            int maxAllowedTactics = _myPlayer.AdjustedLevel / 10;

            while (tacList.Count > maxAllowedTactics)
            {
                tacList.RemoveAt(tacList.Count - 1);
                sendTacticUpdate = true;
            }

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

                if (_modifyingTactics.Contains(buff.Entry))
                {
                    _modifyingTactics.Remove(buff.Entry);

                    List <ushort> toRemove = new List <ushort>();

                    if (AbilityMgr.HasPreCastModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetAbilityPreCastModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalPreCastModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclinePreCastModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _abilityPreCastModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }

                        toRemove.Clear();
                    }

                    if (AbilityMgr.HasModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetAbilityModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclineModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _abilityModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }

                        toRemove.Clear();
                    }

                    if (AbilityMgr.HasBuffModifiers(buff.Entry))
                    {
                        foreach (AbilityModifier mod in AbilityMgr.GetBuffModifiers(buff.Entry))
                        {
                            if (mod.Affecting == 0)
                            {
                                _generalBuffModifiers.RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else if (mod.Affecting <= 3)
                            {
                                _speclineBuffModifiers[(byte)(mod.Affecting - 1)].RemoveAll(fmod => fmod.Source == buff.Entry);
                            }
                            else
                            {
                                toRemove.Add(mod.Affecting);
                            }
                        }

                        foreach (ushort rem in toRemove)
                        {
                            _buffModifiers[rem].RemoveAll(fmod => fmod.Source == buff.Entry);
                        }
                    }
                }

                _activeTactics.Remove(buff.Entry);
            }

            _activeBuffs.Clear();

            foreach (ushort id in tacList)
            {
                if (id == 0 || _activeTactics.Contains(id))
                {
                    continue;
                }
                BuffInfo b = AbilityMgr.GetBuffInfo(id);

                if (b == null)
                {
                    _myPlayer.SendClientMessage("Nonexistent tactic: " + id + " " + AbilityMgr.GetAbilityNameFor(id));
                    continue;
                }

                if (!_myPlayer.AbtInterface.IsValidTactic(id))
                {
                    _myPlayer.SendClientMessage("Invalid tactic: " + id + " " + AbilityMgr.GetAbilityNameFor(id));
                    sendTacticUpdate = true;
                    continue;
                }

                if (!string.IsNullOrEmpty(b.AuraPropagation))
                {
                    _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(_myPlayer, _myPlayer.AbtInterface.GetMasteryLevelFor(AbilityMgr.GetMasteryTreeFor(b.Entry)), b, BuffEffectInvoker.CreateAura, RegisterTacticBuff));
                }
                else
                {
                    _myPlayer.BuffInterface.QueueBuff(new BuffQueueInfo(_myPlayer, _myPlayer.AbtInterface.GetMasteryLevelFor(AbilityMgr.GetMasteryTreeFor(b.Entry)), b, RegisterTacticBuff));
                }
                _activeTactics.Add(id);
            }

            // Update the saved list for the server
            for (int i = 0; i < 4; ++i)
            {
                _myPlayer._Value.SetTactic((byte)(i + 1), i < _activeTactics.Count ? _activeTactics[i] : (ushort)0);
            }

            if (sendTacticUpdate)
            {
                SendTactics();
            }
        }
Beispiel #25
0
 public override bool Load()
 {
     // Queues Grudge Master, used for giving grudge when damaged.
     myPlayer?.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.Level, AbilityMgr.GetBuffInfo(_masterID)));
     return(true);
 }
Beispiel #26
0
        // Used to set up pet buffs which should be reapplied if the lion's resummoned
        public override void SetResource(byte amount, bool blockEvent)
        {
            if (amount == 0 || amount == _careerResource)
            {
                return;
            }
            _careerResource = amount;

            if (myPet != null && !myPet.IsDead)
            {
                currentHealth = myPet.Health;
                myPet.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_petTrainBuffs[amount - 1], myPlayer, myPet)));
                myPet.EvtInterface.AddEvent(SetHealth, 100, 1);
            }
        }
Beispiel #27
0
 public override bool Load()
 {
     // Queues Hatred Master, used for giving hatred when hit and hitting foes.
     myPlayer?.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_masterID)));
     return(true);
 }
Beispiel #28
0
        public void SummonPet(ushort myID)
        {
            if (_summoning)
            {
                return;
            }
            try
            {
                _summoning = true; // Happens when pet is automatically reset after zone change
                if (myPet != null)
                {
                    myPet.Destroy();
                    myPet = null;
                }
                if (myPlayer.Zone == null)
                {
                    return;
                }

                ushort model1;
                byte   faction;
                string name;

                if (myPlayer.Realm == GameData.Realms.REALMS_REALM_ORDER)
                {
                    model1  = (ushort)(132 + ((myPlayer.Level - 1) * 0.1f));
                    faction = 65;
                    if (myPlayer.Level < 16)
                    {
                        name = "Lion Cub";
                    }
                    else
                    {
                        name = "War Lion";
                    }
                }
                else
                {
                    Random rand = new Random();
                    switch (rand.Next(1, 4))
                    {
                    case 1:
                        model1  = 1156;
                        faction = 129;
                        name    = "War Manticore";
                        break;

                    case 2:
                        model1  = 1142;
                        faction = 129;
                        name    = "War Scorpion";
                        break;

                    case 3:
                        model1  = 1086;
                        faction = 129;
                        name    = "Vicious Harpy";
                        break;

                    default:
                        model1  = 1272;
                        faction = 129;
                        name    = "Hydra Wyrmling";
                        break;
                    }
                }

                if (myPlayer.Info.PetModel != 0)
                {
                    model1 = myPlayer.Info.PetModel;
                }

                if (!String.IsNullOrEmpty(myPlayer.Info.PetName))
                {
                    myPetName = myPlayer.Info.PetName;
                }

                Creature_proto Proto = new Creature_proto
                {
                    Name    = string.IsNullOrEmpty(myPetName) ? name : myPetName,
                    Ranged  = 0,
                    Faction = faction,
                    Model1  = model1
                };

                Creature_spawn Spawn = new Creature_spawn();
                if (model1 == 1272)
                {
                    Proto.MinScale = 15;
                    Proto.MaxScale = 15;
                }
                else
                {
                    Proto.MinScale = 50;
                    Proto.MaxScale = 50;
                }
                Spawn.BuildFromProto(Proto);
                Spawn.WorldO         = myPlayer._Value.WorldO;
                Spawn.WorldY         = myPlayer._Value.WorldY;
                Spawn.WorldZ         = myPlayer._Value.WorldZ;
                Spawn.WorldX         = myPlayer._Value.WorldX;
                Spawn.ZoneId         = myPlayer.Zone.ZoneId;
                Spawn.Icone          = 18;
                Spawn.WaypointType   = 0;
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel = myPlayer.EffectiveLevel;

                if (Spawn.Proto.MinLevel > 40)
                {
                    Spawn.Proto.MinLevel = 40;
                    Spawn.Proto.MaxLevel = 40;
                }

                myPet = new Pet(myID, Spawn, myPlayer, AIMode, false, true);

                myPlayer.Region.AddObject(myPet, Spawn.ZoneId);

                if (_careerResource != 0)
                {
                    //currentHealth = myPet.Health;
                    myPet.BuffInterface.QueueBuff(new BuffQueueInfo(myPlayer, myPlayer.EffectiveLevel, AbilityMgr.GetBuffInfo(_petTrainBuffs[_careerResource - 1], myPlayer, myPet)));
                    //myPet.EvtInterface.AddEvent(SetHealth, 100, 1);
                }

                myPlayer.BuffInterface.NotifyPetEvent(myPet);
            }
            finally
            {
                _summoning = false;
            }
        }
Beispiel #29
0
        protected override void PropagateGroup()
        {
            if (_groupPendingTargetList.Count > 0)
            {
                List <NewBuff> locList = new List <NewBuff>();
                lock (_groupPendingTargetList)
                {
                    locList.AddRange(_groupPendingTargetList);
                    _groupPendingTargetList.Clear();
                }

                foreach (var buff in locList)
                {
                    _groupTargetList.Add(buff.Target, buff);
                }
            }

            Group myGroup = _myPlayer.PriorityGroup;

            if (myGroup != null)
            {
                foreach (var member in myGroup.GetUnitList(_myPlayer))
                {
                    if (member == Caster)
                    {
                        continue;
                    }

                    if (member.IsInCastRange(Caster, MAX_GROUP_RADIUS))
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            if (_groupTargetList[member].BuffHasExpired) // Group member already has this buff and it's still active, so sustain it
                            {
                                _groupTargetList.Remove(member);
                            }
                            continue;
                        }

                        if (Duration == 0)
                        {
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, AbilityMgr.GetBuffInfo(_buffInfo.Entry), BuffEffectInvoker.CreateOygBuff, RegisterOYG));
                        }
                        else
                        {
                            BuffInfo BI = AbilityMgr.GetBuffInfo(_buffInfo.Entry);
                            BI.Duration = (ushort)(RemainingTimeMs * 0.001f);
                            member.BuffInterface.QueueBuff(new BuffQueueInfo(Caster, BuffLevel, BI, RegisterGroupBuff));
                        }
                    }

                    else
                    {
                        if (_groupTargetList.ContainsKey(member))
                        {
                            // Group member out of range - finish the buff and remove them
                            if (!_groupTargetList[member].BuffHasExpired)
                            {
                                _groupTargetList[member].BuffHasExpired = true;
                            }
                            _groupTargetList.Remove(member);
                        }
                    }
                }
            }

            List <Unit> gtlKeys = _groupTargetList.Keys.ToList();

            foreach (var guy in gtlKeys)
            {
                if (myGroup == null || !myGroup.HasUnit(guy))
                {
                    _groupTargetList[guy].BuffHasExpired = true;
                    _groupTargetList.Remove(guy);
                }
            }
        }
Beispiel #30
0
        public override void BeginInteraction(Player player)
        {
            if (_buildProgress < 100)
            {
                if (_interactors.Contains(player))
                {
                    foreach (NewBuff buff in _interactionBuffs)
                    {
                        if (buff.Caster == player)
                        {
                            buff.BuffHasExpired = true;
                            return;
                        }
                    }
                }

                else
                {
                    player.BuffInterface.QueueBuff(new BuffQueueInfo(player, player.Level, AbilityMgr.GetBuffInfo((ushort)GameBuffs.Interaction), InteractionBuff.GetNew, LinkToCaptureBuff));
                }
            }
        }