/// <summary>Get all player chests.</summary> /// <param name="range">Determines whether given locations are in range of the player for remote chest access.</param> /// <param name="excludeHidden">Whether to exclude chests marked as hidden.</param> /// <param name="alwaysIncludeContainer">A container to include even if it would normally be hidden.</param> public IEnumerable <ManagedChest> GetChests(RangeHandler range, bool excludeHidden = false, IContainer alwaysIncludeContainer = null) { IEnumerable <ManagedChest> Search() { // get location info var locations = ( from GameLocation location in this.GetAccessibleLocations() select new { Location = location, Category = this.GetCategory(location) } ) .ToArray(); IDictionary <string, int> defaultCategories = locations .GroupBy(p => p.Category) .Where(p => p.Count() > 1) .ToDictionary(p => p.Key, p => 0); // find chests foreach (var entry in locations) { // get info GameLocation location = entry.Location; string category = defaultCategories.ContainsKey(entry.Category) ? I18n.DefaultCategory_Duplicate(locationName: entry.Category, number: ++defaultCategories[entry.Category]) : entry.Category; // chests in location { int namelessChests = 0; int namelessGrabbers = 0; int namelessHoppers = 0; int namelessMiniShippingBins = 0; int junimoChestCount = 0; foreach (KeyValuePair <Vector2, SObject> pair in location.Objects.Pairs) { Vector2 tile = pair.Key; SObject obj = pair.Value; // chests if (obj is Chest chest && chest.playerChest.Value) { if (chest.SpecialChestType == Chest.SpecialChestTypes.JunimoChest && ++junimoChestCount > 1) { continue; // only list one Junimo Chest per location (since they share inventory) } yield return(new ManagedChest( container: new ChestContainer(chest, context: chest, showColorPicker: this.CanShowColorPicker(chest, location), this.Reflection), location: location, tile: tile, defaultDisplayName: chest.SpecialChestType switch { Chest.SpecialChestTypes.AutoLoader => I18n.DefaultName_Other(name: GameI18n.GetBigCraftableName(275), number: ++namelessHoppers), Chest.SpecialChestTypes.JunimoChest => GameI18n.GetBigCraftableName(256), Chest.SpecialChestTypes.MiniShippingBin => I18n.DefaultName_Other(name: GameI18n.GetBigCraftableName(248), number: ++namelessMiniShippingBins), _ => I18n.DefaultName_Other(name: GameI18n.GetBigCraftableName(130), number: ++namelessChests) },
/// <summary>Get all player chests.</summary> /// <param name="range">Determines whether given locations are in range of the player for remote chest access.</param> /// <param name="excludeHidden">Whether to exclude chests marked as hidden.</param> /// <param name="alwaysIncludeContainer">A container to include even if it would normally be hidden.</param> public IEnumerable <ManagedChest> GetChests(RangeHandler range, bool excludeHidden = false, IContainer alwaysIncludeContainer = null) { IEnumerable <ManagedChest> Search() { // get location info var locations = ( from GameLocation location in this.GetAccessibleLocations() select new { Location = location, Category = this.GetCategory(location) } ) .ToArray(); IDictionary <string, int> defaultCategories = locations .GroupBy(p => p.Category) .Where(p => p.Count() > 1) .ToDictionary(p => p.Key, p => 0); // find chests foreach (var entry in locations) { // get info GameLocation location = entry.Location; string category = defaultCategories.ContainsKey(entry.Category) ? I18n.DefaultCategory_Duplicate(locationName: entry.Category, number: ++defaultCategories[entry.Category]) : entry.Category; // chests in location { int namelessChests = 0; int namelessGrabbers = 0; foreach (KeyValuePair <Vector2, SObject> pair in location.Objects.Pairs) { Vector2 tile = pair.Key; SObject obj = pair.Value; // chests if (obj is Chest chest && chest.playerChest.Value) { yield return(new ManagedChest( container: new ChestContainer(chest, context: chest, showColorPicker: this.CanShowColorPicker(chest, location), this.Reflection), location: location, tile: tile, defaultDisplayName: I18n.DefaultName_Other(name: GameI18n.GetBigCraftableName(130), number: ++namelessChests), defaultCategory: category )); }
/********* ** Public methods *********/ /// <summary>Get the config UI fields to show in the cheats menu.</summary> /// <param name="context">The cheat context.</param> public override IEnumerable <OptionsElement> GetFields(CheatContext context) { return(this.SortFields( new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(10), value: context.Config.FastBeeHouse, setValue: value => context.Config.FastBeeHouse = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(90), value: context.Config.FastBoneMill, setValue: value => context.Config.FastBoneMill = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(163), value: context.Config.FastCask, setValue: value => context.Config.FastCask = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(114), value: context.Config.FastCharcoalKiln, setValue: value => context.Config.FastCharcoalKiln = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(16), value: context.Config.FastCheesePress, setValue: value => context.Config.FastCheesePress = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(246), value: context.Config.FastCoffeeMaker, setValue: value => context.Config.FastCoffeeMaker = value ), new CheatsOptionsCheckbox( label: GameI18n.GetObjectName(710), value: context.Config.FastCrabPot, setValue: value => context.Config.FastCrabPot = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(21), value: context.Config.FastCrystalarium, setValue: value => context.Config.FastCrystalarium = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(265), value: context.Config.FastDeconstructor, setValue: value => context.Config.FastDeconstructor = value ), new CheatsOptionsCheckbox( label: I18n.FastMachines_FruitTrees(), value: context.Config.FastFruitTree, setValue: value => context.Config.FastFruitTree = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(13), value: context.Config.FastFurnace, setValue: value => context.Config.FastFurnace = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(182), value: context.Config.FastGeodeCrusher, setValue: value => context.Config.FastGeodeCrusher = value ), new CheatsOptionsCheckbox( label: I18n.FastMachines_ReadyInTheMorning(machineName: GameI18n.GetBigCraftableName(101)), value: context.Config.FastIncubator, setValue: value => context.Config.FastIncubator = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(12), value: context.Config.FastKeg, setValue: value => context.Config.FastKeg = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(9), value: context.Config.FastLightningRod, setValue: value => context.Config.FastLightningRod = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(17), value: context.Config.FastLoom, setValue: value => context.Config.FastLoom = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(24), value: context.Config.FastMayonnaiseMachine, setValue: value => context.Config.FastMayonnaiseMachine = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(128), value: context.Config.FastMushroomBox, setValue: value => context.Config.FastMushroomBox = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(19), value: context.Config.FastOilMaker, setValue: value => context.Config.FastOilMaker = value ), new CheatsOptionsCheckbox( label: I18n.FastMachines_ReadyInTheMorning(GameI18n.GetBigCraftableName(254)), value: context.Config.FastOstrichIncubator, setValue: value => context.Config.FastOstrichIncubator = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(15), value: context.Config.FastPreservesJar, setValue: value => context.Config.FastPreservesJar = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(20), value: context.Config.FastRecyclingMachine, setValue: value => context.Config.FastRecyclingMachine = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(25), value: context.Config.FastSeedMaker, setValue: value => context.Config.FastSeedMaker = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(158), value: context.Config.FastSlimeEggPress, setValue: value => context.Config.FastSlimeEggPress = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(156), value: context.Config.FastSlimeIncubator, setValue: value => context.Config.FastSlimeIncubator = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(117), value: context.Config.FastSodaMachine, setValue: value => context.Config.FastSodaMachine = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(231), value: context.Config.FastSolarPanel, setValue: value => context.Config.FastSolarPanel = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(127), value: context.Config.FastStatueOfEndlessFortune, setValue: value => context.Config.FastStatueOfEndlessFortune = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(160), value: context.Config.FastStatueOfPerfection, setValue: value => context.Config.FastStatueOfPerfection = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(280), value: context.Config.FastStatueOfTruePerfection, setValue: value => context.Config.FastStatueOfTruePerfection = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(105), value: context.Config.FastTapper, setValue: value => context.Config.FastTapper = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(211), value: context.Config.FastWoodChipper, setValue: value => context.Config.FastWoodChipper = value ), new CheatsOptionsCheckbox( label: GameI18n.GetBigCraftableName(154), value: context.Config.FastWormBin, setValue: value => context.Config.FastWormBin = value ) )); }