private static bool _OnItemChange(Item i, int position, Item old, StorageContainer container, bool onRemoval) { if (!(container is ToolRackMenu curr)) { return(false); } if (onRemoval) { if (ToolRack.FitsBottomSlot(i)) { curr._toolRack.BottomSlot = null; return(true); } else if (i is Tool && !ToolRack.FitsBottomSlot(i)) { curr._toolRack.TopSlot = null; return(true); } } else { if (ToolRack.FitsBottomSlot(i)) { if (position == (int)ToolRack.ItemSlot.BottomSlot) { curr._toolRack.BottomSlot = i as Tool; return(true); } else if (curr._toolRack.BottomSlot == null) { curr._toolRack.BottomSlot = i as Tool; curr.ItemsToGrabMenu.actualInventory[position] = null; curr.ItemsToGrabMenu.actualInventory[(int)ToolRack.ItemSlot.BottomSlot] = i; return(true); } } else if (ToolRack.FitsTopSlot(i)) { if (position == (int)ToolRack.ItemSlot.TopSlot) { curr._toolRack.TopSlot = i as Tool; return(true); } else if (curr._toolRack.TopSlot == null) { curr._toolRack.TopSlot = i as Tool; curr.ItemsToGrabMenu.actualInventory[position] = null; curr.ItemsToGrabMenu.actualInventory[(int)ToolRack.ItemSlot.TopSlot] = i; return(true); } } } Game1.player.addItemToInventory(i); curr.ItemsToGrabMenu.actualInventory[position] = null; return(false); }
private static bool _OnItemHighlight(Item i) { return(ToolRack.FitsTopSlot(i) || ToolRack.FitsBottomSlot(i)); }