public static bool MoveItemToChaosRecipeTab(ItemTab source, ItemTab target, Item item, MoveOrganizer organizer, SortConfig config) { Item itemCopy = new Item(); itemCopy.inventoryId = item.inventoryId; itemCopy.x = item.x; itemCopy.y = item.y; if (!ControlChaosRecipeReqs(target, item, config)) { return(false); } bool removed = source.RemoveItem(item); bool added = target.AddItem(item); if (added == false) { //Failed add, insert item in List<Item> for source again source.items.Add(item); } else { organizer.MoveItem(source, target, itemCopy); } return(removed && added); }
public static bool MoveItem(ItemTab source, ItemTab target, Item item, MoveOrganizer organizer) { Item itemCopy = new Item(); itemCopy.inventoryId = item.inventoryId; itemCopy.x = item.x; itemCopy.y = item.y; bool removed = source.RemoveItem(item); bool added = target.AddItem(item); if (added == false) { //Failed add, insert item in List<Item> for source again source.items.Add(item); } else { organizer.MoveItem(source, target, itemCopy); } return(removed && added); }