internal static StardewValley.Objects.Chest GetCommunityCentreFridge(StardewValley.Locations.CommunityCenter cc) { StardewValley.Objects.Chest chest = null; Type kitchen = Type.GetType("CommunityKitchen.Kitchen, CommunityKitchen"); if (kitchen != null) { chest = Helper.Reflection .GetMethod(type: kitchen, name: "GetKitchenFridge") .Invoke <StardewValley.Objects.Chest>(cc); } return(chest); }
private void PopulateHoverTextBoxAndDraw(Item item, bool isItFromToolbar) { StardewValley.Locations.CommunityCenter communityCenter = Game1.getLocationFromName("CommunityCenter") as StardewValley.Locations.CommunityCenter; List <int[]> itemInfo = new List <int[]>(); Dictionary <string, List <string> > descriptions = new Dictionary <string, List <string> >(); foreach (int itemInBundles in itemsInBundles) { if (item.ParentSheetIndex == itemInBundles) { foreach (KeyValuePair <int, int[][]> bundle in bundles) { for (int i = 0; i < bundle.Value.Length; i++) { //Getting the item name because the bundle itself doesn't actually make sure that the correct item is being placed //(parentSheetIndex of object can overlap with another item from another sheet) string itemName = ""; if (Game1.objectInformation.ContainsKey(bundle.Value[i][0])) { if (language == "") { itemName = Game1.objectInformation[bundle.Value[i][0]].Split('/')[0]; } else { itemName = Game1.objectInformation[bundle.Value[i][0]].Split('/')[4]; } } var isItemInBundleSlot = communityCenter.bundles[bundle.Key][bundle.Value[i][3]]; if ((item is StardewValley.Object) && item.Stack != 0 && bundle.Value[i] != null && bundle.Value[i][0] == item.ParentSheetIndex && itemName == item.DisplayName && bundle.Value[i][2] <= ((StardewValley.Object)item).Quality) { if (!isItemInBundleSlot) { //Saving i to check if the items are the same or not later on itemInfo.Add(new int[] { bundle.Key, bundle.Value[i][1], i }); descriptions[bundleNamesAndSubNames[bundle.Key][0]] = new List <string>(); } } } } } } foreach (int[] info in itemInfo) { string bundleName = bundleNamesAndSubNames[info[0]][0]; string bundleSubName = bundleNamesAndSubNames[info[0]][1]; int quantity = info[1]; descriptions[bundleName].Add(bundleSubName + " | Qty: " + quantity); } if (descriptions.Count > 0) { string tooltipText = ""; int count = 0; foreach (KeyValuePair <string, List <string> > keyValuePair in descriptions) { if (count > 0) { tooltipText += "\n"; } tooltipText += keyValuePair.Key; foreach (string value in keyValuePair.Value) { tooltipText += "\n " + value; } count++; } this.DrawHoverTextBox(Game1.smallFont, tooltipText, isItFromToolbar, item.Stack); } }