protected void remove_item_to_stack( item.Item item, List <items_properties> stacks, int amount) { foreach (items_properties stack in stacks) { amount = stack.remove_amount(amount); } stacks.RemoveAll((stack) => stack.amount < 1); }
public void add(item.Item item, int amount) { List <items_properties> stacks = new List <items_properties>(); if (!items.TryGetValue(item, out stacks)) { stacks = new List <items_properties>(); items.Add(item, stacks); } add_item_to_stack(item, stacks, amount); }
protected void remove_item_to_stack( item.Item item, List <items_properties> stacks, int amount) { foreach (items_properties stack in stacks) { amount = stack.remove_amount(amount); } stacks.RemoveAll((stack) => stack.amount < 1); if (amount > 0) { debug.error("se elimno items del stack y sobro {0}", amount); } }
public void remove(item.Item item, int amount) { List <items_properties> stacks = new List <items_properties>(); if (items.TryGetValue(item, out stacks)) { debug.info("eliminando el item: {0} con cantidad {1}", item.name, amount); remove_item_to_stack(item, stacks, amount); redraw_slots(); } else { debug.warning("el inventario no tiene los stacks para {0}", item.name); } }
public void add(item.Item item, int amount) { debug.info("agregando el item: {0} con cantidad {1}", item.name, amount); List <items_properties> stacks = new List <items_properties>(); if (!items.TryGetValue(item, out stacks)) { debug.info("agregando nuevo stack a {0}", item.name); stacks = new List <items_properties>(); items.Add(item, stacks); } add_item_to_stack(item, stacks, amount); debug.info("stacks count {0}", stacks.Count); redraw_slots(); }
public void add(item.Item item) { add(item, 1); }