Esempio n. 1
0
        private static void OnTarget(PacketReader reader)
        {
            byte        type  = reader.ReadByte();
            int         tid   = reader.ReadInt32();
            TargetFlags flags = (TargetFlags)reader.ReadByte();

            Engine.TargetType   = (TargetType)type;
            Engine.TargetSerial = tid;
            Engine.TargetFlags  = flags;
            Engine.TargetExists = flags != TargetFlags.Cancel;

            if (Engine.TargetExists)
            {
                Engine.WaitingForTarget = false;
            }

            if (!Options.CurrentOptions.QueueLastTarget || (TargetType)type != TargetType.Object ||
                Engine.LastTargetQueue.Count == 0)
            {
                return;
            }

            object obj = Engine.LastTargetQueue.Dequeue();

            if (obj == null)
            {
                return;
            }

            TargetCommands.Target(obj, Options.CurrentOptions.RangeCheckLastTarget);

            Engine.TargetExists = false;
        }
Esempio n. 2
0
 public TargetAwaiter(Mobile m, int range, bool allowGround, TargetFlags flags)
 {
     m_Mobile      = m;
     m_Range       = range;
     m_AllowGround = allowGround;
     m_Flags       = flags;
 }
Esempio n. 3
0
 public SpellTargetPoint3D(
     ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool checkLOS = true
     ) : base(range, true, flags)
 {
     m_Spell    = spell;
     m_CheckLOS = checkLOS;
 }
Esempio n. 4
0
 public SpellTargetPoint3D(
     ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool retryOnLOS = false
     ) : base(range, true, flags)
 {
     _spell      = spell;
     _retryOnLos = retryOnLOS;
 }
Esempio n. 5
0
 protected MultiTarget(int multiID, Point3D offset, int range = 10, bool allowGround = true,
                       TargetFlags flags = TargetFlags.None)
     : base(range, allowGround, flags)
 {
     MultiID = multiID;
     Offset  = offset;
 }
Esempio n. 6
0
 public TestTarget(
     int range,
     bool allowGround,
     TargetFlags flags
     ) : base(range, allowGround, flags)
 {
 }
 public override float ProcessTargetValue(float baseValue, TargetFlags flags)
 {
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.NotAThreat))
     {
         return(-1000f);
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.None))
     {
         baseValue *= 1.5f;
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.IsSiegeEngine))
     {
         baseValue *= 2f;
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.IsStructure))
     {
         baseValue *= 1.5f;
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.IsSmall))
     {
         baseValue *= 0.5f;
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.IsMoving))
     {
         baseValue *= 0.8f;
     }
     if (flags.HasAnyFlag <TargetFlags>(TargetFlags.DebugThreat))
     {
         baseValue *= 10000f;
     }
     return(baseValue);
 }
Esempio n. 8
0
        public static Target BeginTarget(this Mobile m, int range, bool allowGround, TargetFlags flags, TargetStateCallback callback, object state)
        {
            Target t = new SimpleStateTarget(range, flags, allowGround, callback, state);

            m.Target = t;

            return(t);
        }
Esempio n. 9
0
 // Methods
 public Target(int range, bool allowGround, TargetFlags flags)
 {
     this.m_TargetID    = (++Target.m_NextTargetID);
     this.m_Range       = range;
     this.m_AllowGround = allowGround;
     this.m_Flags       = flags;
     this.m_CheckLOS    = true;
 }
Esempio n. 10
0
 /// <summary>
 ///     Create an instance of MobileSelectTarget with handlers and additional options
 /// </summary>
 public MobileSelectTarget(
     Action <Mobile, TMobile> success,
     Action <Mobile> fail,
     int range,
     bool allowGround,
     TargetFlags flags)
     : base(success, fail, range, allowGround, flags)
 {
 }
Esempio n. 11
0
        protected Target(int range, bool allowGround, TargetFlags flags)
        {
            this.m_TargetID    = ++m_NextTargetID;
            this.m_Range       = range;
            this.m_AllowGround = allowGround;
            this.m_Flags       = flags;

            this.m_CheckLOS = true;
        }
Esempio n. 12
0
        public Target(int range, bool allowGround, TargetFlags flags)
        {
            m_TargetID    = ++m_NextTargetID;
            m_Range       = range;
            m_AllowGround = allowGround;
            m_Flags       = flags;

            m_CheckLOS = true;
        }
Esempio n. 13
0
 public TestMultiTarget(
     int multiID,
     Point3D offset,
     int range         = 10,
     bool allowGround  = true,
     TargetFlags flags = TargetFlags.None
     ) : base(multiID, offset, range, allowGround, flags)
 {
 }
Esempio n. 14
0
        protected Target( int range, bool allowGround, TargetFlags flags )
        {
            m_TargetID = ++m_NextTargetID;
            m_Range = range;
            m_AllowGround = allowGround;
            m_Flags = flags;

            m_CheckLOS = true;
        }
Esempio n. 15
0
        protected Target(int range, bool allowGround, TargetFlags flags)
        {
            TargetID    = ++m_NextTargetID;
            Range       = range;
            AllowGround = allowGround;
            Flags       = flags;

            CheckLOS = true;
        }
Esempio n. 16
0
        protected Target(int range, bool allowGround, TargetFlags flags, bool checkLos = true)
        {
            m_TargetID    = ++m_NextTargetID;
            m_Range       = range;
            m_AllowGround = allowGround;
            m_Flags       = flags;

            m_CheckLOS = checkLos;
        }
Esempio n. 17
0
 public GenericSelectTarget(
     Action <Mobile, TObj> success,
     Action <Mobile> fail,
     int range,
     bool allowGround,
     TargetFlags flags)
     : base(range, allowGround, flags)
 {
     MultiID        = -1;
     SuccessHandler = success;
     FailHandler    = fail;
 }
        private void UpdateFilter()
        {
            TargetFlags filter   = 0;
            TargetFlags excluded = 0;

            Filters.Where(s => s.IsSelected.Value).ToList().ForEach(s => filter    |= s.Flags);
            Filters.Where(s => !s.IsSelected.Value).ToList().ForEach(s => excluded |= s.Flags);

            if (CoreData.Settings.TargetFilter != (int)excluded)
            {
                CoreData.Settings.TargetFilter = (int)excluded;
            }

            int index = 1; // custom is always on top

            foreach (var source in _initialTargets)
            {
                bool add = (source.Flags & filter) > 0;
                if (AppData.HideTargetFilter)
                {
                    add = _resources.TargetFilter(source);
                }
                var exists = Targets.FirstOrDefault(s => s.Source == source);
                if (add)
                {
                    if (exists == null)
                    {
                        var n = new TargetModel {
                            Source = source
                        };
                        if ((source.Flags & TargetFlags.Adult) > 0)
                        {
                            n.Tooltip = source.Hint + " All performers must be over 18 years old.";
                        }
                        else
                        {
                            n.Tooltip = source.Hint;
                        }
                        _            = GetImageAsync(n.Logo, source.Id);
                        n.OnSelected = () => DoSelected(n);
                        Targets.Insert(index, n);
                    }
                    index++;
                }
                else
                {
                    if (exists != null)
                    {
                        Targets.Remove(exists);
                    }
                }
            }
        }
Esempio n. 19
0
 /// <summary>
 ///     Begin targeting for the specified Mobile with definded handlers
 /// </summary>
 /// <param name="m">Mobile owner of the new GenericSelectTarget instance</param>
 /// <param name="success">Success callback</param>
 /// <param name="fail">Failure callback</param>
 /// <param name="range">Maximum distance allowed</param>
 /// <param name="allowGround">Allow ground as valid target</param>
 /// <param name="flags">Target flags determine the target action</param>
 public static void Begin(
     Mobile m,
     Action <Mobile, TObj> success,
     Action <Mobile> fail,
     int range         = -1,
     bool allowGround  = false,
     TargetFlags flags = TargetFlags.None)
 {
     if (m != null)
     {
         m.Target = new GenericSelectTarget <TObj>(success, fail, range, allowGround, flags);
     }
 }
Esempio n. 20
0
        public Target(TargetType targetType, int senderSerial, TargetFlags flags, int targetSerial, int x, int y,
                      int z, int id, bool cancelClientCursor)
        {
            if (senderSerial == -1)
            {
                senderSerial = Engine.TargetSerial;
            }

            if (targetSerial > 0)
            {
                Engine.Player.LastTargetSerial = targetSerial;
                Engine.Player.LastTargetType   = targetType;
            }

            if (Engine.TargetFlags == TargetFlags.Harmful &&
                Options.CurrentOptions.PreventTargetingFriendsWithHarmful &&
                MobileCommands.InFriendList(targetSerial))
            {
                Commands.SystemMessage(Strings.Target_blocked____try_again___);
                Commands.ResendTargetToClient();

                return;
            }

            _writer = new PacketWriter(19);
            _writer.Write((byte)0x6C);
            _writer.Write((byte)targetType);
            _writer.Write(senderSerial);
            _writer.Write((byte)flags);
            _writer.Write(targetSerial);
            _writer.Write((short)x);
            _writer.Write((short)y);
            _writer.Write((short)z);
            _writer.Write((short)id);

            Engine.TargetExists = false;

            if (cancelClientCursor)
            {
                Engine.SendPacketToClient(new Target(targetType, senderSerial, TargetFlags.Cancel, targetSerial, x, y,
                                                     z, id, false));
                Engine.AddSendPreFilter(new PacketFilterInfo(0x6C,
                                                             new[] { PacketFilterConditions.IntAtPositionCondition(senderSerial, 2) },
                                                             (p, pfi) => { Engine.RemoveSendPreFilter(pfi); }));
            }
        }
Esempio n. 21
0
        public override TargetFlags GetTargetFlags()
        {
            TargetFlags targetFlags = (TargetFlags)(0 | 2 | 8 | 16 | 32);

            if (this.IsDestroyed || this.IsDeactivated)
            {
                targetFlags |= TargetFlags.NotAThreat;
            }
            if (this.Side == BattleSideEnum.Attacker && DebugSiegeBehaviour.DebugDefendState == DebugSiegeBehaviour.DebugStateDefender.DebugDefendersToBallistae)
            {
                targetFlags |= TargetFlags.DebugThreat;
            }
            if (this.Side == BattleSideEnum.Defender && DebugSiegeBehaviour.DebugAttackState == DebugSiegeBehaviour.DebugStateAttacker.DebugAttackersToBallistae)
            {
                targetFlags |= TargetFlags.DebugThreat;
            }
            return(targetFlags);
        }
Esempio n. 22
0
        /// <summary>
        ///     Begin targeting for the specified Mobile with definded handlers
        /// </summary>
        /// <param name="m">Mobile owner of the new GenericSelectTarget instance</param>
        /// <param name="success">Success callback</param>
        /// <param name="fail">Failure callback</param>
        /// <param name="range">Maximum distance allowed</param>
        /// <param name="allowGround">Allow ground as valid target</param>
        /// <param name="flags">Target flags determine the target action</param>
        public static GenericSelectTarget <TObj> BeginTarget <TObj>(
            this Mobile m,
            Action <Mobile, TObj> success,
            Action <Mobile> fail,
            int range         = -1,
            bool allowGround  = false,
            TargetFlags flags = TargetFlags.None)
        {
            if (m == null || m.Deleted)
            {
                return(null);
            }

            var t = new GenericSelectTarget <TObj>(success, fail, range, allowGround, flags);

            m.Target = t;

            return(t);
        }
Esempio n. 23
0
 public TargetedMagerySpell(Mobile caster, Item scroll, SpellInfo info, TargetFlags flags)
     : base(caster, scroll, info)
 {
     target_flags = flags;
 }
Esempio n. 24
0
 public MasteryTarget(SkillMasterySpell spell, int range = 10, bool allowGround = false, TargetFlags flags = TargetFlags.None, bool autoEnd = true)
     : base(range, allowGround, flags)
 {
     Owner = spell;
     AutoFinishSequence = autoEnd;
 }
Esempio n. 25
0
 public InternalTarget(SleepSpell owner, TargetFlags flags)
     : this(owner, false, flags)
 {
 }
Esempio n. 26
0
 public SimpleTarget( int range, TargetFlags flags, bool allowGround, TargetCallback callback )
     : base(range, allowGround, flags)
 {
     m_Callback = callback;
 }
Esempio n. 27
0
 public static TargetAwaitable PickTarget(this Mobile m, int range, bool allowGround, TargetFlags flags)
 {
     return(new TargetAwaitable(m, range, allowGround, flags));
 }
		protected MultiTarget(int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags)
			: base(range, allowGround, flags)
		{
			MultiID = multiID;
			Offset = offset;
		}
Esempio n. 29
0
 public MysticSpellTarget(MysticSpell owner, TargetFlags flags)
     : this(owner, false, flags)
 {
 }
Esempio n. 30
0
			public MysticSpellTarget( MysticSpell owner, bool allowland, TargetFlags flags ) : base( 12, allowland, flags )
			{
				m_Owner = owner;
			}
Esempio n. 31
0
			public MysticSpellTarget( MysticSpell owner, TargetFlags flags ) : this( owner, false, flags )
			{
			}
 public MultiTarget(int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags) : base(range, allowGround, flags)
 {
     m_MultiID = multiID;
     m_Offset  = offset;
 }
Esempio n. 33
0
 public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags = TargetFlags.None, int range = 12)
     : base(range, false, flags) => _spell = spell;
Esempio n. 34
0
 public SimpleStateTarget( int range, TargetFlags flags, bool allowGround, TargetStateCallback callback, object state )
     : base(range, allowGround, flags)
 {
     m_Callback = callback;
     m_State = state;
 }
Esempio n. 35
0
			public BlueSpellTarget( BlueSpell owner, TargetFlags flags, bool allowobjects ) : base( 12, allowobjects, flags )
			{
				m_Owner = owner;
				m_AllowObjects = allowobjects;
			}
Esempio n. 36
0
 public MysticSpellTarget(MysticSpell owner, bool allowland, TargetFlags flags)
     : base(12, allowland, flags)
 {
     m_Owner = owner;
 }
Esempio n. 37
0
			public BlueSpellTarget( BlueSpell owner, TargetFlags flags ) : this( owner, flags, false )
			{
				m_Owner = owner;
			}
Esempio n. 38
0
 public InternalTarget(SleepSpell owner, bool allowland, TargetFlags flags)
     : base(12, allowland, flags)
 {
     Owner = owner;
 }
Esempio n. 39
0
 public MultiTarget( int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags )
     : base(range, allowGround, flags)
 {
     m_MultiID = multiID;
     m_Offset = offset;
 }
Esempio n. 40
0
 public MobileTarget(IMobileTargeted receiver, int range, TargetFlags flags) : base(range, false, flags)
 {
     m_Receiver = receiver;
 }
Esempio n. 41
0
        public Target BeginTarget( int range, bool allowGround, TargetFlags flags, TargetStateCallback callback, object state )
        {
            Target t = new SimpleStateTarget( range, flags, allowGround, callback, state );

            this.Target = t;

            return t;
        }
Esempio n. 42
0
        public Target BeginTarget( int range, bool allowGround, TargetFlags flags, TargetCallback callback )
        {
            Target t = new SimpleTarget( range, flags, allowGround, callback );

            this.Target = t;

            return t;
        }