static Inventory() { MaterialCraftable[] requiredMaterials = new MaterialCraftable[] { new MaterialCraftable(rawMeat, 1) }; cookedMeat = new InventoryCraftableFoodItem("Cooked Meat", "Meat that has been cooked", 0, 10, FoodType.Food, 0.25f, requiredMaterials); }
public void AddItemsSubMenu(UIMenu menu) { itemsSubMenu = Main.MasterMenuPool.AddSubMenu(menu, "Items", "See what useful items you are carrying"); UIResRectangle rectangle1 = new UIResRectangle(); rectangle1.Color = Color.FromArgb(0xff, Color.DarkGreen); UIResRectangle rectangle = rectangle1; itemsSubMenu.SetBannerType(rectangle); int num = 0; while (true) { if (num >= playerItemInventory.Count) { itemsSubMenu.OnItemSelect += delegate(UIMenu sender, UIMenuItem item, int index) { if (playerItemInventory[index].Amount <= 0) { UI.Notify("Cannot use ~b~" + item.Text + "~w~ as you are not carrying any."); } else if (playerItemInventory[index].GetType() == typeof(InventoryFoodItem)) { InventoryFoodItem item2 = (InventoryFoodItem)playerItemInventory[index]; if (item2.FoodType == FoodType.Food) { if (Character.currentHungerLevel >= 1f) { UI.Notify("Cannot use ~b~" + item.Text + "~w~ as your Hunger levels are full."); } else { Character.currentHungerLevel += item2.Restore; if (Character.currentHungerLevel > 1f) { Character.currentHungerLevel = 1f; } InventoryItem local1 = playerItemInventory[index]; local1.Amount--; object[] objArray1 = new object[] { "(", playerItemInventory[index].Amount, "/", playerItemInventory[index].MaxAmount, ")" }; item.SetRightLabel(string.Concat(objArray1)); UI.Notify("Used ~b~" + item.Text + "~w~ to replenish Hunger levels."); } } else if (item2.FoodType == FoodType.Drink) { if (Character.currentThirstLevel >= 1f) { UI.Notify("Cannot use ~b~" + item.Text + "~w~ as your Thirst levels are full."); } else { Character.currentThirstLevel += item2.Restore; if (Character.currentThirstLevel > 1f) { Character.currentThirstLevel = 1f; } InventoryItem local2 = playerItemInventory[index]; local2.Amount--; object[] objArray2 = new object[] { "(", playerItemInventory[index].Amount, "/", playerItemInventory[index].MaxAmount, ")" }; item.SetRightLabel(string.Concat(objArray2)); UI.Notify("Used ~b~" + item.Text + "~w~ to replenish Thirst levels."); } } } else if (playerItemInventory[index].GetType() == typeof(InventoryCraftableFoodItem)) { InventoryCraftableFoodItem item3 = (InventoryCraftableFoodItem)playerItemInventory[index]; if (item3.FoodType == FoodType.Food) { if (Character.currentHungerLevel >= 1f) { UI.Notify("Cannot use ~b~" + item.Text + "~w~ as your Hunger levels are full."); } else { Character.currentHungerLevel += item3.Restore; if (Character.currentHungerLevel > 1f) { Character.currentHungerLevel = 1f; } InventoryItem local3 = playerItemInventory[index]; local3.Amount--; object[] objArray3 = new object[] { "(", playerItemInventory[index].Amount, "/", playerItemInventory[index].MaxAmount, ")" }; item.SetRightLabel(string.Concat(objArray3)); UI.Notify("Used ~b~" + item.Text + "~w~ to replenish Hunger levels."); } } else if (item3.FoodType == FoodType.Drink) { if (Character.currentThirstLevel >= 1f) { UI.Notify("Cannot use ~b~" + item.Text + "~w~ as your Thirst levels are full."); } else { Character.currentThirstLevel += item3.Restore; if (Character.currentThirstLevel > 1f) { Character.currentThirstLevel = 1f; } InventoryItem local4 = playerItemInventory[index]; local4.Amount--; object[] objArray4 = new object[] { "(", playerItemInventory[index].Amount, "/", playerItemInventory[index].MaxAmount, ")" }; item.SetRightLabel(string.Concat(objArray4)); UI.Notify("Used ~b~" + item.Text + "~w~ to replenish Thirst levels."); } } } }; return; } itemsSubMenu.AddItem(new UIMenuItem(playerItemInventory[num].Name, playerItemInventory[num].Description)); object[] objArray1 = new object[] { "(", playerItemInventory[num].Amount, "/", playerItemInventory[num].MaxAmount, ")" }; itemsSubMenu.MenuItems[itemsSubMenu.MenuItems.Count - 1].SetRightLabel(string.Concat(objArray1)); num++; } }