private static void WorldItem(PacketReader p, PacketHandlerEventArgs args) { Item item = World.FindItem(p.ReadUInt32() & 0x7FFFFFFF); if (item == null || item.ItemID != 0x2006 || item.DistanceTo(World.Player) > 2 || items.Find(c => c.ItemID == item.Amount) == null) { return; } Item carver = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver")); carved.RemoveAll(i => !World.Items.ContainsKey(i)); if (carver != null && !carved.Contains(item.Serial)) { Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(item); carved.Add(item.Serial); return(true); }; WorldEx.SendToServer(new DoubleClick(carver.Serial)); } }
private static void WorldEx_MobileUpdated(Serial serial) { if (serial != World.Player.Serial && serial != healSerial) { return; } if (IsHealing || World.Player.IsGhost || !World.Player.Visible) { return; } Mobile target; if (enabled && (World.Player.Hits < World.Player.HitsMax * 0.90 || World.Player.Poisoned)) { IsHealing = !Bandages.Valid || Bandages.Enchanced ? ebs.Perform() : BandageSelf(); } else if (healSerial.IsValid && (target = World.FindMobile(healSerial)) != null && target.Hits < target.HitsMax * 0.90 && Utility.Distance(target.Position, World.Player.Position) < 3 && Bandages.Valid) { prevQueue = Targeting.QueuedTarget; Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(healSerial); return(true); }; Bandages.Use(); IsHealing = true; } }
private static void OnTargetTimer() { targetTimer.Stop(); targetTimer = null; Targeting.CancelTarget(); IsHealing = BandageSelf(); }
private static void HonorAttack() { TargetingEx.ClosestTarget(3, 4, 5, 6); Targeting.CancelTarget(); Targeting.LastTarget(true); Honor(); BloodOath.AttackLast(); }
private static bool ClearAll(string command, Variable[] vars, bool quiet, bool force) { DragDropManager.GracefulStop(); // clear drag/drop queue Targeting.CancelTarget(); // clear target queue & cancel current target DragDropManager.DropCurrent(); // drop what you are currently holding return(true); }
protected virtual void Target() { if (Targeting.DoLastTarget()) { return; } Targeting.CancelTarget(); Parent.Stop(); }
public override bool Perform() { Item item = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver")); if (item != null) { Targeting.CancelTarget(); WorldEx.SendToServer(new DoubleClick(item.Serial)); } return(true); }
protected override void OnMouseClick(MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { Targeting.CancelTarget(); OnUse(); Targeting.LastTarget(true); } else { base.OnMouseClick(e); } }
private static void FireBlast(string[] args) { Item spellBook = World.Player.Backpack.FindItem(0x2253, 0x0872); if (spellBook != null) { Targeting.CancelTarget(); new ContextMenuAction(spellBook, 0, 0).Perform(); } else { WorldEx.SendMessage("Arcanum Ignis not found."); } }
public override bool Perform() { Targeting.CancelTarget(); Item item = World.Player.GetItemOnLayer(Layer.RightHand); if (item == null || item.ItemID != 0x0DC0) { item = World.Player.Backpack.FindItem(0x0DC0); } if (item != null) { WorldEx.SendToServer(new DoubleClick(item.Serial)); } wait.Recieved = false; return(true); }
private static void Carve(Item item) { Item carver = World.FindItem(ConfigEx.GetElement <uint>(0, "BoneCarver")); carved.RemoveAll(i => !World.Items.ContainsKey(i)); if (carver != null && !carved.Contains(item.Serial)) { Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(item); carved.Add(item.Serial); return(true); }; WorldEx.SendToServer(new DoubleClick(carver.Serial)); } }
private static bool?Event_LocalizedMessage(Serial serial, ItemID graphic, byte type, ushort hue, ushort font, int num, string name, string args) { if (num != 500617) { return(null); } Item item = World.Player.Backpack.FindItem(0x2AFA) ?? World.Player.Backpack.FindItem(IsInstrument); if (item != null) { Targeting.QueueTarget queue = Targeting.QueuedTarget; Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(item); Timer.DelayedCallback(TimeSpan.FromMilliseconds(10), () => Targeting.QueuedTarget = queue).Start(); return(true); }; } return(null); }
private static void DoIt(Item item) { Item tool = null; if (item.IsElementalBody()) { tool = World.FindItem(ConfigEx.GetElement <uint>(0, "LegendaryPickaxe")); } else if (item.IsSomeTreeishBody()) { tool = World.FindItem(ConfigEx.GetElement <uint>(0, "LegendaryHatchet")); } if (tool != null) { Targeting.CancelTarget(); Targeting.QueuedTarget = () => { Targeting.Target(item); return(true); }; WorldEx.SendToServer(new DoubleClick(tool.Serial)); } }
private static bool BandageSelf() { if (targetTimer != null && targetTimer.Running) { return(false); } if (Targeting.HasTarget) { targetTimer = Timer.DelayedCallback(TimeSpan.FromSeconds(5), OnTargetTimer); targetTimer.Start(); return(false); } if (!Bandages.Valid) { return(false); } prevQueue = Targeting.QueuedTarget; Targeting.CancelTarget(); Targeting.QueuedTarget = Targeting.DoTargetSelf; Bandages.Use(); return(true); }
private static bool Target(string command, Variable[] vars, bool quiet, bool force) { if (vars.Length < 1) { throw new RunTimeError("Usage: target (serial) OR target (closest/random/next/prev [noto] [type]"); } switch (vars[0].AsString()) { case "close": case "closest": CommandHelper.FindTarget(vars, true); break; case "rand": case "random": CommandHelper.FindTarget(vars, false, true); break; case "next": CommandHelper.FindTarget(vars, false, false, true); break; case "prev": case "previous": CommandHelper.FindTarget(vars, false, false, false, true); break; case "cancel": Targeting.CancelTarget(); break; case "clear": Targeting.OnClearQueue(); break; default: Serial serial = vars[0].AsSerial(); if (serial != Serial.Zero) // Target a specific item or mobile { Item item = World.FindItem(serial); if (item != null) { Targeting.Target(item); return(true); } Mobile mobile = World.FindMobile(serial); if (mobile != null) { Targeting.Target(mobile); } } break; } return(true); }
private static void Cast(ushort num) { Targeting.CancelTarget(); Spell.Get(num).OnCast(new CastSpellFromMacro(num)); }
private static void HealOrCureSelf() { Targeting.CancelTarget(); Targeting.TargetSelf(true); new MacroCastSpellAction(World.Player.Poisoned ? 25 : 29).Perform(); }
private static void Cast(Macro macro) { Targeting.CancelTarget(); MacroManager.Play(macro); Engine.MainWindow.PlayMacro(macro); }