예제 #1
0
        protected virtual bool OnTarget(object targeted)
        {
            Mobile mob = targeted as Mobile;

            if (mob != null)
            {
                return(this.OnTarget(mob));
            }
            Item obj = targeted as Item;

            if (obj != null)
            {
                return(this.OnTarget(obj));
            }
            GroundTarget groundTarget = targeted as GroundTarget;

            if (groundTarget != null)
            {
                return(this.OnTarget(groundTarget));
            }
            StaticTarget staticTarget = targeted as StaticTarget;

            if (staticTarget != null)
            {
                return(this.OnTarget(staticTarget));
            }
            return(false);
        }
예제 #2
0
        public override void OnDispatch()
        {
            base.OnDispatch();
            if (!this.Spoof)
            {
                return;
            }
            PTarget_Spoof ptargetSpoof = (PTarget_Spoof)null;

            if (this.toTarget == null)
            {
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, 0, -1, -1, 0, 0);
            }
            else if (this.toTarget is Mobile)
            {
                Mobile mobile = this.toTarget as Mobile;
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, mobile.Serial, mobile.X, mobile.Y, mobile.Z, (int)mobile.Body);
            }
            else if (this.toTarget is Item)
            {
                Item obj = this.toTarget as Item;
                ptargetSpoof = new PTarget_Spoof(0, 12648430, this.SpoofFlags, obj.Serial, obj.X, obj.Y, obj.Z, obj.ID);
            }
            else if (this.toTarget is GroundTarget)
            {
                GroundTarget groundTarget = this.toTarget as GroundTarget;
                ptargetSpoof = new PTarget_Spoof(1, 12648430, this.SpoofFlags, 0, groundTarget.X, groundTarget.Y, groundTarget.Z, 0);
            }
            else if (this.toTarget is StaticTarget)
            {
                StaticTarget staticTarget = this.toTarget as StaticTarget;
                ptargetSpoof = new PTarget_Spoof(1, 12648430, this.SpoofFlags, 0, staticTarget.X, staticTarget.Y, staticTarget.Z, staticTarget.RealID);
            }
            Network.Send((Packet)ptargetSpoof);
        }
        private void ExplodeFlags()
        {
            GroundTarget gt1 = new GroundTarget(Flags[0].WorldPosition, GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt1, 230);

            GroundTarget gt2 = new GroundTarget(Flags[1].WorldPosition, GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt2, 230);

            GroundTarget gt3 = new GroundTarget(new Point3D(364572, 365590, 12036), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt3, 230);


            EvtInterface.AddEvent(() =>
            {
                Explosion(gt1);
                Explosion(gt2);
                Explosion(gt3);
            }, 1000, 1);

            //remove ground targets after explosions
            EvtInterface.AddEvent(() =>
            {
                gt1.RemoveFromWorld();
                gt2.RemoveFromWorld();
                gt3.RemoveFromWorld();
            }, 10000, 1);

            EvtInterface.AddEvent(Unlock, 5000, 1);
        }
예제 #4
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);
        }
예제 #5
0
 protected override bool OnTarget(GroundTarget groundTarget)
 {
     Engine.AddTextMessage("Last target set.", Engine.DefaultFont, Hues.Load(89));
     return(true);
 }
예제 #6
0
        public bool StartAbilityAtPos(AbilityInfo abInfo, byte castSequence, Point3D worldPos, ushort zoneID)
        {
            _pendingInfo = abInfo;
            _pendingInfo.TargetPosition = worldPos;
            _pendingItemCooldownGroup   = 0;
            _pendingCastSequence        = castSequence;

            byte result = ModifyInitials();

            if (result == 1 || !AllowStartCastAtPos() || !_caster.PointWithinRadiusFeet(_pendingInfo.TargetPosition, (int)(_caster.BaseRadius + _pendingInfo.Range)))
            {
                CancelPendingCast();
                return(false);
            }

            if (result == 2)
            {
                _abInterface.SetGlobalCooldown();
                CancelPendingCast();
                return(false);
            }

            if (result == 3)
            {
                _abInterface.SetCooldown(_pendingInfo.ConstantInfo.CooldownEntry != 0 ? _pendingInfo.ConstantInfo.CooldownEntry : _pendingInfo.Entry, _pendingInfo.Cooldown * 1000);
                CancelPendingCast();
                return(false);
            }

            // Cast success. Cancel existing ability if any

            if (AbInfo != null)
            {
                CancelCast(0);
            }

            AbInfo             = _pendingInfo;
            _pendingInfo       = null;
            _itemCooldownGroup = 0;
            _castSequence      = castSequence;

            _castStartTime = TCPManager.GetTimeStampMS();

            if (AbInfo.Level == 0)
            {
                AbInfo.Level = _abInterface.GetMasteryLevelFor(AbInfo.ConstantInfo.MasteryTree);
            }

            if (AbInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM)
            {
                _caster.BuffInterface.NotifyAbilityStarted(AbInfo);
            }

            SendStart();

            if (!AbInfo.ConstantInfo.IgnoreGlobalCooldown)
            {
                _abInterface.SetGlobalCooldown();
            }

            if (AbInfo.ConstantInfo.ChannelID != 0)
            {
                // Channeled Morale 4s grant immunity and cannot be interrupted
                if (AbInfo.SpecialCost == -4)
                {
                    _caster.AddCrowdControlImmunity((int)CrowdControlTypes.Unstoppable);
                    _caster.IsImmovable = true;
                }

                GroundTarget gt = new GroundTarget(_caster, AbInfo.TargetPosition, GameObjectService.GetGameObjectProto(23));
                _caster.Region.AddObject(gt, _caster.Zone.ZoneId);

                gt.SetExpiry(TCPManager.GetTimeStampMS() + 20000);

                AbInfo.Target = gt;

                _channelHandler.Initialize(AbInfo, castSequence);
            }
            else
            {
                CastAtPosition();
            }

            return(false);
        }
예제 #7
0
 protected virtual bool OnTarget(GroundTarget groundTarget)
 {
     return(false);
 }
        private void Explosion(GroundTarget gt)
        {
            //play explosion effect
            PacketOut Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT, 30);

            Out.WriteUInt16(gt.Oid);
            Out.WriteUInt16(gt.Oid);
            Out.WriteUInt16(14054);
            Out.WriteByte((byte)1);
            Out.WriteByte((byte)0);
            Out.WriteByte((byte)5);
            Out.WriteByte((byte)0);
            Region.DispatchPacket(Out, gt.WorldPosition, 1200);

            //since game objets are sent to players within 400feet, send explosion effect to  players further away (Explosion wont play to dead players)
            for (int i = 0; i < 2; i++)
            {
                foreach (Player plr in Players[i])
                {
                    if (plr == null || plr.IsDisposed || !plr.IsInWorld())
                    {
                        continue;
                    }

                    if (plr.GetDistanceTo(gt.WorldPosition) > 500)
                    {
                        plr.PlayEffect(1272, gt.WorldPosition);
                    }
                }
            }

            var startTime = DateTime.Now;

            AbilityDamageInfo damageThisPass = new AbilityDamageInfo
            {
                Entry           = 14050,
                DisplayEntry    = 0,
                DamageType      = DamageTypes.RawDamage,
                MinDamage       = (ushort)(30000),
                MaxDamage       = (ushort)(30000),
                CastPlayerSubID = 0
            };

            double explosionTime = 5000;
            double explosionSize = 190;

            EvtInterface.AddEvent(() =>
            {
                var elapsed = DateTime.Now.Subtract(startTime).TotalMilliseconds;
                var expSize = explosionSize * elapsed / explosionTime;

                if (elapsed < explosionTime)
                {
                    foreach (var plr in Region.WorldQuery <Player>(gt.WorldPosition, (int)expSize))
                    {
                        if (plr == null || plr.IsDisposed || !plr.IsInWorld() || plr.IsDead)
                        {
                            continue;
                        }

                        CombatManager.InflictDamage(damageThisPass, 20, plr, plr);
                    }
                }
            }, (int)(explosionTime / 20), (int)(20));
        }