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; }
public TargetAwaiter(Mobile m, int range, bool allowGround, TargetFlags flags) { m_Mobile = m; m_Range = range; m_AllowGround = allowGround; m_Flags = flags; }
public SpellTargetPoint3D( ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool checkLOS = true ) : base(range, true, flags) { m_Spell = spell; m_CheckLOS = checkLOS; }
public SpellTargetPoint3D( ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool retryOnLOS = false ) : base(range, true, flags) { _spell = spell; _retryOnLos = retryOnLOS; }
protected MultiTarget(int multiID, Point3D offset, int range = 10, bool allowGround = true, TargetFlags flags = TargetFlags.None) : base(range, allowGround, flags) { MultiID = multiID; Offset = offset; }
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); }
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); }
// 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; }
/// <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) { }
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; }
public Target(int range, bool allowGround, TargetFlags flags) { m_TargetID = ++m_NextTargetID; m_Range = range; m_AllowGround = allowGround; m_Flags = flags; m_CheckLOS = true; }
public TestMultiTarget( int multiID, Point3D offset, int range = 10, bool allowGround = true, TargetFlags flags = TargetFlags.None ) : base(multiID, offset, range, allowGround, flags) { }
protected Target( int range, bool allowGround, TargetFlags flags ) { m_TargetID = ++m_NextTargetID; m_Range = range; m_AllowGround = allowGround; m_Flags = flags; m_CheckLOS = true; }
protected Target(int range, bool allowGround, TargetFlags flags) { TargetID = ++m_NextTargetID; Range = range; AllowGround = allowGround; Flags = flags; CheckLOS = true; }
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; }
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); } } } }
/// <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); } }
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); })); } }
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); }
/// <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); }
public TargetedMagerySpell(Mobile caster, Item scroll, SpellInfo info, TargetFlags flags) : base(caster, scroll, info) { target_flags = flags; }
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; }
public InternalTarget(SleepSpell owner, TargetFlags flags) : this(owner, false, flags) { }
public SimpleTarget( int range, TargetFlags flags, bool allowGround, TargetCallback callback ) : base(range, allowGround, flags) { m_Callback = callback; }
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; }
public MysticSpellTarget(MysticSpell owner, TargetFlags flags) : this(owner, false, flags) { }
public MysticSpellTarget( MysticSpell owner, bool allowland, TargetFlags flags ) : base( 12, allowland, flags ) { m_Owner = owner; }
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; }
public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags = TargetFlags.None, int range = 12) : base(range, false, flags) => _spell = spell;
public SimpleStateTarget( int range, TargetFlags flags, bool allowGround, TargetStateCallback callback, object state ) : base(range, allowGround, flags) { m_Callback = callback; m_State = state; }
public BlueSpellTarget( BlueSpell owner, TargetFlags flags, bool allowobjects ) : base( 12, allowobjects, flags ) { m_Owner = owner; m_AllowObjects = allowobjects; }
public MysticSpellTarget(MysticSpell owner, bool allowland, TargetFlags flags) : base(12, allowland, flags) { m_Owner = owner; }
public BlueSpellTarget( BlueSpell owner, TargetFlags flags ) : this( owner, flags, false ) { m_Owner = owner; }
public InternalTarget(SleepSpell owner, bool allowland, TargetFlags flags) : base(12, allowland, flags) { Owner = owner; }
public MultiTarget( int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags ) : base(range, allowGround, flags) { m_MultiID = multiID; m_Offset = offset; }
public MobileTarget(IMobileTargeted receiver, int range, TargetFlags flags) : base(range, false, flags) { m_Receiver = receiver; }
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; }
public Target BeginTarget( int range, bool allowGround, TargetFlags flags, TargetCallback callback ) { Target t = new SimpleTarget( range, flags, allowGround, callback ); this.Target = t; return t; }