public void AutoUse() { ArrayList autoUse = World.CharData.AutoUse; if (autoUse.Count <= 0) { Engine.AddTextMessage("There are no items in your use-once list."); } else { Mobile player = World.Player; if (player != null) { Item backpack = player.Backpack; if (backpack != null) { for (int i = 0; i < autoUse.Count; i++) { Engine.m_AutoUseIndex++; Engine.m_AutoUseIndex = Engine.m_AutoUseIndex % autoUse.Count; Item check = (Item)autoUse[Engine.m_AutoUseIndex]; if (backpack.ContainsItem(check) || (check.IsEquip && (check.EquipParent == player))) { check.Use(); return; } } Engine.AddTextMessage("No use-once items were found on your person."); } } } }
public static void Transfer(Item stock, Item pouch, int amount) { if (stock.Items.Count == 0) { Engine.AddTextMessage("Content of reagent stock unknown. Opening..."); stock.Use(); m_QueueStock = stock; m_QueuePouch = pouch; m_QueueAmount = amount; m_QueueTime = DateTime.Now; } else if (pouch.Items.Count == 0) { Engine.AddTextMessage("Content of reagent pouch unknown. Opening..."); pouch.Use(); m_QueueStock = stock; m_QueuePouch = pouch; m_QueueAmount = amount; m_QueueTime = DateTime.Now; } else { m_QueueStock = null; m_QueuePouch = null; m_QueueAmount = 0; m_QueueTime = DateTime.MinValue; int[] list = ReagentValidator.Validator.List; for (int i = 0; i < list.Length; i++) { Transfer(stock, pouch, amount, list[i]); } Engine.PrintQAM(); } }
public void UseItemByType(int[] itemIDs) { Mobile player = World.Player; if (player != null) { Item backpack = player.Backpack; if (backpack != null) { Item item2 = backpack.FindItem(new ItemIDValidator(itemIDs)); if (item2 != null) { item2.Use(); } } } }