public void Undress() { if (World.Player == null) { return; } int count = 0; Item undressBag = World.Player.Backpack; if (undressBag == null) { World.Player.SendMessage(LocString.NoBackpack); return; } if (Macros.MacroManager.AcceptActions) { Macros.MacroManager.Action(new Macros.UnDressAction(m_Name)); } if (m_UndressBag.IsValid) { Item bag = World.FindItem(m_UndressBag); if (bag != null && (bag.RootContainer == World.Player || (bag.RootContainer == null && Utility.InRange(bag.GetWorldPosition(), World.Player.Position, 2)))) { undressBag = bag; } else { World.Player.SendMessage(LocString.UndressBagRange); } } for (int i = 0; i < m_Items.Count; i++) { Item item = null; if (m_Items[i] is Serial) { item = World.FindItem((Serial)m_Items[i]); } else if (m_Items[i] is ItemID) { item = World.Player.FindItemByID((ItemID)m_Items[i]); } if (item == null || DragDropManager.CancelDragFor(item.Serial) || item.Container != World.Player) { continue; } else { DragDropManager.DragDrop(item, undressBag); count++; } } World.Player.SendMessage(LocString.UndressQueued, count); }
public static bool Equip(Item item, Layer layer) { if (layer == Layer.Invalid || layer > Layer.LastUserValid || item == null || item.Layer == Layer.Invalid || item.Layer > Layer.LastUserValid) { return(false); } if (item != null && World.Player != null && item.IsChildOf(World.Player.Backpack)) { DragDropManager.DragDrop(item, World.Player, layer); return(true); } return(false); }
public void AutoStackResource() { if (!IsResource || !Config.GetBool("AutoStack") || m_AutoStackCache.Contains(Serial)) { return; } foreach (Item check in World.Items.Values) { if (check.Container == null && check.ItemID == ItemID && check.Hue == Hue && Utility.InRange(World.Player.Position, check.Position, 2)) { DragDropManager.DragDrop(this, check); m_AutoStackCache.Add(Serial); return; } } DragDropManager.DragDrop(this, World.Player.Position); m_AutoStackCache.Add(Serial); }
internal void AutoStackResource() { if (!IsResource || !RazorEnhanced.Settings.General.ReadBool("AutoStack") || m_AutoStackCache.Contains(Serial)) { return; } foreach (Item check in World.Items.Values) { if (check.Container == null && check.ItemID == ItemID && check.Hue == Hue && Utility.InRange(World.Player.Position, check.Position, 2)) { DragDropManager.DragDrop(this, check); m_AutoStackCache.Add(Serial); return; } } DragDropManager.DragDrop(this, World.Player.Position); m_AutoStackCache.Add(Serial); }
public static bool Unequip(Layer layer) { if (layer == Layer.Invalid || layer > Layer.LastUserValid) { return(false); } Item item = World.Player.GetItemOnLayer(layer); if (item != null) { Item pack = DressList.FindUndressBag(item); if (pack != null) { DragDropManager.DragDrop(item, pack); return(true); } } return(false); }
public void Dress() { if (World.Player == null) { return; } int skipped = 0, gone = 0, done = 0; List <Item> list = new List <Item>(); bool remConflicts = Config.GetBool("UndressConflicts"); if (World.Player.Backpack == null) { World.Player.SendMessage(LocString.NoBackpack); return; } if (Macros.MacroManager.AcceptActions) { Macros.MacroManager.Action(new Macros.DressAction(Name)); } for (int i = 0; i < Items.Count; i++) { Item item; if (Items[i] is Serial) { item = World.FindItem((Serial)Items[i]); if (item == null) { gone++; } else { list.Add(item); } } else if (Items[i] is ItemID) { ItemID id = (ItemID)Items[i]; // search to make sure they are not already wearing this... item = World.Player.FindItemByID(id); if (item != null) { skipped++; } else { item = World.Player.Backpack.FindItemByID(id); if (item == null) { gone++; } else { list.Add(item); } } } } foreach (Item item in list) { if (item.Container == World.Player) { skipped++; } else if (item.IsChildOf(World.Player.Backpack) || item.RootContainer == null) { Layer layer = GetLayerFor(item); if (layer == Layer.Invalid || layer > Layer.LastUserValid) { continue; } if (remConflicts) { Item conflict = World.Player.GetItemOnLayer(layer); if (conflict != null) { DragDropManager.DragDrop(conflict, FindUndressBag(conflict)); } // try to also undress conflicting hand(s) if (layer == Layer.RightHand) { conflict = World.Player.GetItemOnLayer(Layer.LeftHand); } else if (layer == Layer.LeftHand) { conflict = World.Player.GetItemOnLayer(Layer.RightHand); } else { conflict = null; } if (conflict != null && (conflict.IsTwoHanded || item.IsTwoHanded)) { DragDropManager.DragDrop(conflict, FindUndressBag(conflict)); } } DragDropManager.DragDrop(item, World.Player, layer); done++; } } if (done > 0) { World.Player.SendMessage(LocString.DressQueued, done); } if (skipped > 0) { World.Player.SendMessage(LocString.AlreadyDressed, skipped); } if (gone > 0) { World.Player.SendMessage(LocString.ItemsNotFound, gone); } }
public static bool DoubleClick(object clicked, bool silent) { Serial s; if (clicked is Mobile) { s = ((Mobile)clicked).Serial.Value; } else if (clicked is Item) { s = ((Item)clicked).Serial.Value; } else if (clicked is Serial) { s = ((Serial)clicked).Value; } else { s = Serial.Zero; } if (s != Serial.Zero) { Item free = null, pack = World.Player.Backpack; if (s.IsItem && pack != null && Config.GetBool("PotionEquip") && Client.Instance.AllowBit(FeatureBit.AutoPotionEquip)) { Item i = World.FindItem(s); if (i != null && i.IsPotion && i.ItemID != 3853) // dont unequip for exploison potions { // dont worry about uneqipping RuneBooks or SpellBooks Item left = World.Player.GetItemOnLayer(Layer.LeftHand); Item right = World.Player.GetItemOnLayer(Layer.RightHand); if (left != null && (right != null || left.IsTwoHanded)) { free = left; } else if (right != null && right.IsTwoHanded) { free = right; } if (free != null) { if (DragDropManager.HasDragFor(free.Serial)) { free = null; } else { DragDropManager.DragDrop(free, pack); } } } } ActionQueue.DoubleClick(silent, s); if (free != null) { DragDropManager.DragDrop(free, World.Player, free.Layer, true); } if (s.IsItem) { World.Player.m_LastObj = s; } } return(false); }
internal static bool DoubleClick(object clicked, bool silent) { Serial s; if (clicked is Mobile) { s = ((Mobile)clicked).Serial.Value; } else if (clicked is Item) { s = ((Item)clicked).Serial.Value; } else if (clicked is Serial) { s = ((Serial)clicked).Value; } else { s = Serial.Zero; } if (s == Serial.Zero) { return(false); } Item free = null, pack = World.Player.Backpack; if (s.IsItem && pack != null && RazorEnhanced.Settings.General.ReadBool("PotionEquip")) { Item i = World.FindItem(s); if (i != null && i.IsPotion && i.ItemID != 3853) // dont unequip for exploison potions { // dont worry about uneqipping RuneBooks or SpellBooks Item left = World.Player.GetItemOnLayer(Layer.LeftHand); Item right = World.Player.GetItemOnLayer(Layer.RightHand); if (left != null && (right != null || left.IsTwoHanded)) { free = left; } else if (right != null && right.IsTwoHanded) { free = right; } if (free != null) { DragDropManager.DragDrop(free, pack); } } } DragDropManager.DoubleClick(s); if (free != null) { DragDropManager.DragDrop(free, World.Player, free.Layer, true); } if (s.IsItem) { World.Player.m_LastObj = s; } return(false); }