static public void AutoEquipment(StardewValley.Menus.InventoryPage page) { var helditem = Game1.player.CursorSlotItem; foreach (StardewValley.Menus.ClickableComponent icon in page.equipmentIcons) { if (icon.item != null) { continue; } if (icon.name == "Hat") { continue; } if (icon.name == "Boots") { continue; } EquipmentClick(icon); break; } }
static public void AddEquipmentIcon(StardewValley.Menus.InventoryPage page, int x, int y, string name) { var rect = new Rectangle( page.xPositionOnScreen + 48 + x * 64, page.yPositionOnScreen + StardewValley.Menus.IClickableMenu.borderWidth + StardewValley.Menus.IClickableMenu.spaceToClearTopBorder + 256 - 12 + y * 64, 64, 64 ); // Get the item that should be in this slot. Item item = null; if (x == 0) { if (y == 0) { item = Game1.player.hat.Value; } if (y == 1) { item = Game1.player.leftRing.Value; } if (y == 2) { item = Game1.player.rightRing.Value; } if (y == 3) { item = Game1.player.boots.Value; } } else { ActualRings ar = actualdata.GetValue(Game1.player, FarmerNotFound); if (y == 0) { item = ar.ring1.Value; } if (y == 1) { item = ar.ring2.Value; } if (y == 2) { item = ar.ring3.Value; } if (y == 3) { item = ar.ring4.Value; } } // Create the GUI element. int id = 101 + 10 * x + y; var component = new StardewValley.Menus.ClickableComponent(rect, name) { myID = id, downNeighborID = y < 3 ? id + 1 : -1, upNeighborID = y == 0 ? Game1.player.MaxItems - 12 + x : id - 1, upNeighborImmutable = y == 0, rightNeighborID = x == 0 ? id + 10 : 105, leftNeighborID = x == 0 ? -1 : id - 10, item = item }; page.equipmentIcons.Add(component); }