/// <summary>Get the data to display for this subject.</summary> public override IEnumerable <ICustomField> GetData() { // mermaid puzzle { IslandSouthEast location = (IslandSouthEast)this.Location; bool complete = location.mermaidPuzzleFinished.Value; if (this.ProgressionMode && !complete) { yield return(new GenericField(I18n.Puzzle_Solution(), I18n.Puzzle_Solution_Hidden())); } else { int[] sequence = this.GameHelper.Metadata.PuzzleSolutions.IslandMermaidFluteBlockSequence; int songIndex = location.songIndex; var checkboxes = sequence .Select((pitch, i) => CheckboxListField.Checkbox(text: this.Stringify(pitch), value: complete || songIndex >= i)) .ToArray(); yield return(new CheckboxListField(I18n.Puzzle_Solution(), checkboxes) .AddIntro(complete ? I18n.Puzzle_Solution_Solved() : I18n.Puzzle_IslandMermaid_Solution_Intro())); } } // raw map data foreach (ICustomField field in base.GetData()) { yield return(field); } }
/// <summary>Get the upgrade levels for a building, for use with a checkbox field.</summary> /// <param name="building">The building to check.</param> /// <param name="upgradeLevel">The current upgrade level, if applicable.</param> private IEnumerable <KeyValuePair <IFormattedText[], bool> > GetUpgradeLevelSummary(Building building, int?upgradeLevel) { // barn if (building is Barn) { yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Barn_0(), value: true)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Barn_1(), value: upgradeLevel >= 1)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Barn_2(), value: upgradeLevel >= 2)); } // cabin else if (building.indoors.Value is Cabin) { yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Cabin_0(), value: true)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Cabin_1(), value: upgradeLevel >= 1)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Cabin_2(), value: upgradeLevel >= 2)); } // coop else if (building is Coop) { yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Coop_0(), value: true)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Coop_1(), value: upgradeLevel >= 1)); yield return(CheckboxListField.Checkbox(text: I18n.Building_Upgrades_Coop_2(), value: upgradeLevel >= 2)); } }
/// <summary>Get a fish pond's population gates for display.</summary> /// <param name="pond">The fish pond.</param> /// <param name="data">The fish pond data.</param> private IEnumerable <KeyValuePair <IFormattedText[], bool> > GetPopulationGates(FishPond pond, FishPondData data) { bool foundNextQuest = false; foreach (FishPondPopulationGateData gate in this.GameHelper.GetFishPondPopulationGates(data)) { int newPopulation = gate.NewPopulation; // done if (pond.lastUnlockedPopulationGate.Value >= gate.RequiredPopulation) { yield return(CheckboxListField.Checkbox(text: I18n.Building_FishPond_Quests_Done(count: newPopulation), value: true)); continue; } // get required items string[] requiredItems = gate.RequiredItems .Select(drop => { // build display string SObject obj = this.GameHelper.GetObjectBySpriteIndex(drop.ItemID); string summary = obj.DisplayName; if (drop.MinCount != drop.MaxCount) { summary += $" ({I18n.Generic_Range(min: drop.MinCount, max: drop.MaxCount)})"; } else if (drop.MinCount > 1) { summary += $" ({drop.MinCount})"; } // track requirement return(summary); }) .ToArray(); // display requirements string itemList = string.Join(", ", requiredItems); string result = requiredItems.Length > 1 ? I18n.Building_FishPond_Quests_IncompleteRandom(newPopulation, itemList) : I18n.Building_FishPond_Quests_IncompleteOne(newPopulation, requiredItems[0]); // show next quest if (!foundNextQuest) { foundNextQuest = true; int nextQuestDays = data.SpawnTime + (data.SpawnTime * (pond.maxOccupants.Value - pond.currentOccupants.Value)) - pond.daysSinceSpawn.Value; result += $"; {I18n.Building_FishPond_Quests_Available(relativeDate: this.GetRelativeDateStr(nextQuestDays))}"; } yield return(CheckboxListField.Checkbox(text: result, value: false)); } }
/// <summary>Get the data to display for this subject.</summary> public override IEnumerable <ICustomField> GetData() { // island crystal puzzle { var cave = (IslandWestCave1)this.Location; // crystal ID if (this.CrystalId.HasValue && !this.ProgressionMode) { yield return(new GenericField(I18n.Puzzle_IslandCrystalCave_CrystalId(), this.Stringify(this.CrystalId.Value))); } // sequence { string label = I18n.Puzzle_Solution(); if (cave.completed.Value) { yield return(new GenericField(label, I18n.Puzzle_Solution_Solved())); } else if (this.ProgressionMode) { yield return(new GenericField(label, new FormattedText(I18n.Puzzle_Solution_Hidden(), Color.Gray))); } else if (!cave.isActivated.Value) { yield return(new GenericField(label, I18n.Puzzle_IslandCrystalCave_Solution_NotActivated())); } else if (!cave.currentCrystalSequence.Any()) { yield return(new GenericField(label, I18n.Puzzle_IslandCrystalCave_Solution_Waiting())); } else { var checkboxes = cave .currentCrystalSequence .Select((id, index) => CheckboxListField.Checkbox( text: this.Stringify(id + 1), value: cave.currentCrystalSequenceIndex.Value > index ) ) .ToArray(); yield return(new CheckboxListField(label, checkboxes) .AddIntro(I18n.Puzzle_IslandCrystalCave_Solution_Activated())); } } } // raw map data foreach (ICustomField field in base.GetData()) { yield return(field); } }
/// <summary>Get the data to display for this subject.</summary> public override IEnumerable <ICustomField> GetData() { // island shrine puzzle { IslandShrine shrine = (IslandShrine)this.Location; bool complete = shrine.puzzleFinished.Value; if (this.ProgressionMode && !complete) { yield return(new GenericField(I18n.Puzzle_Solution(), new FormattedText(I18n.Puzzle_Solution_Hidden(), Color.Gray))); } else { var field = new CheckboxListField(I18n.Puzzle_Solution(), CheckboxListField.Checkbox( text: I18n.Puzzle_IslandShrine_Solution_North(shrine.northPedestal.requiredItem.Value.DisplayName), value: complete || shrine.northPedestal.match.Value ), CheckboxListField.Checkbox( text: I18n.Puzzle_IslandShrine_Solution_East(shrine.eastPedestal.requiredItem.Value.DisplayName), value: complete || shrine.eastPedestal.match.Value ), CheckboxListField.Checkbox( text: I18n.Puzzle_IslandShrine_Solution_South(shrine.southPedestal.requiredItem.Value.DisplayName), value: complete || shrine.southPedestal.match.Value ), CheckboxListField.Checkbox( text: I18n.Puzzle_IslandShrine_Solution_West(shrine.westPedestal.requiredItem.Value.DisplayName), value: complete || shrine.westPedestal.match.Value ) ); field.AddIntro(complete ? I18n.Puzzle_Solution_Solved() : I18n.Puzzle_IslandShrine_Solution() ); yield return(field); } } // raw map data foreach (ICustomField field in base.GetData()) { yield return(field); } }