/// <summary>Gathers all the information needed to display a search result item.</summary> /// <param name="item">The item to gather information for.</param> /// <param name="searchResultInfo">Output of the geodes to crack and how many of them it will take</param> /// <param name="showStar">Whether or not to show a new star with the item</param> /// <returns>Whether this item can be dropped from geodes</returns> public bool GetInfoToBuildSearchResult(GeodeDrop item, out Tuple <int, int>[] searchResultInfo, out bool showStar) { bool[] geodesToCrack = this.GetCrackedGeodeFromWantedItem(item); if (geodesToCrack == null) { searchResultInfo = null; showStar = false; return(false); } searchResultInfo = new Tuple <int, int> [geodesToCrack.Count(elem => elem)]; int currIndex = 0; GeodeType[] types = this.GetGeodeTypes(); for (int i = 0; i < types.Length; i++) { if (geodesToCrack[i]) { int geodeParentSheetIndex = this.geodes[types[i]]; int amnt = this.GeodesUntilTreasure(geodeParentSheetIndex, item.ParentSheetIndex); searchResultInfo[currIndex++] = new Tuple <int, int>(geodeParentSheetIndex, amnt); } } showStar = this.HasNotDonatedItemToMuseum(item.ParentSheetIndex); return(true); }
/*** * Private Methods ***/ /// <summary> /// Gets the geodes that can be cracked to get a given item. /// </summary> /// <param name="item">The drop to look for.</param> /// <returns>A bool array in order of the GeodeType enum indicating whether that geode can be used.</returns> private bool[] GetCrackedGeodeFromWantedItem(GeodeDrop item) { if (item.IsHardCodedDrop) { switch (item.HardCodedDrop) { case HardCodedGeodeDrop.EarthCrystal: return(new bool[] { true, false, false, false }); case HardCodedGeodeDrop.FrozenTear: return(new bool[] { false, true, false, false }); case HardCodedGeodeDrop.FireQuartz: return(new bool[] { false, false, true, true }); case HardCodedGeodeDrop.Stone: case HardCodedGeodeDrop.Clay: case HardCodedGeodeDrop.CopperOre: case HardCodedGeodeDrop.Coal: return(new bool[] { true, true, true, true }); case HardCodedGeodeDrop.IronOre: return(new bool[] { Game1.player.deepestMineLevel > 25, true, true, true }); case HardCodedGeodeDrop.GoldOre: return(new bool[] { false, Game1.player.deepestMineLevel > 75, true, true }); case HardCodedGeodeDrop.IridiumOre: return(new bool[] { false, false, true, true }); case HardCodedGeodeDrop.PrismaticShard: return(new bool[] { false, false, false, true }); default: return(null); } } else { bool[] acceptable = new bool[] { false, false, false, false }; GeodeType[] types = this.GetGeodeTypes(); for (int i = 0; i < types.Length; i++) { foreach (int drop in this.GetDropsFromGeode(types[i])) { if (drop == item.ParentSheetIndex) { acceptable[i] = true; break; } } } return(acceptable); } }
/// <summary> /// Gets all possible drops that can be gotten from geodes. /// </summary> /// <returns>A mapping of the item name to a corresponding GeodeDrop</returns> private IDictionary <string, GeodeDrop> GetAllPossibleDropMappings() { IDictionary <string, GeodeDrop> mapping = new Dictionary <string, GeodeDrop>(); foreach (HardCodedGeodeDrop item in ((HardCodedGeodeDrop[])Enum.GetValues(typeof(HardCodedGeodeDrop)))) { GeodeDrop geodeDrop = new GeodeDrop(item); mapping.Add(Game1.objectInformation[geodeDrop.ParentSheetIndex].Split('/')[0].ToLower(), geodeDrop); } foreach (GeodeType type in this.GetGeodeTypes()) { foreach (string drop in Game1.objectInformation[this.Geodes[type]].Split('/')[6].Split(' ')) { string name = Game1.objectInformation[Convert.ToInt32(drop)].Split('/')[0].ToLower(); if (!mapping.ContainsKey(name)) { mapping.Add(name, new GeodeDrop(Convert.ToInt32(drop))); } } } return(mapping); }