788 lines
26 KiB
C#
788 lines
26 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using System.Runtime.InteropServices;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface;
|
|
using Dalamud.Interface.Colors;
|
|
using Dalamud.Interface.Components;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Dalamud.Plugin.Services;
|
|
using Microsoft.Extensions.Logging;
|
|
using Questionable.Controller;
|
|
using Questionable.Data;
|
|
using Questionable.Functions;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Common;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Windows.QuestComponents;
|
|
|
|
internal sealed class PresetBuilderComponent
|
|
{
|
|
private sealed class QuestPreset
|
|
{
|
|
public required string Name { get; init; }
|
|
|
|
public required string Description { get; init; }
|
|
|
|
public required int DisplayOrder { get; init; }
|
|
|
|
public required List<ElementId> QuestIds { get; init; }
|
|
|
|
public List<ElementId> GetQuestIds()
|
|
{
|
|
return QuestIds;
|
|
}
|
|
}
|
|
|
|
private readonly QuestController _questController;
|
|
|
|
private readonly QuestFunctions _questFunctions;
|
|
|
|
private readonly QuestData _questData;
|
|
|
|
private readonly AetheryteFunctions _aetheryteFunctions;
|
|
|
|
private readonly IClientState _clientState;
|
|
|
|
private readonly IChatGui _chatGui;
|
|
|
|
private readonly UiUtils _uiUtils;
|
|
|
|
private readonly QuestTooltipComponent _questTooltipComponent;
|
|
|
|
private readonly QuestRegistry _questRegistry;
|
|
|
|
private readonly ILogger<PresetBuilderComponent> _logger;
|
|
|
|
private readonly Dictionary<string, QuestPreset> _availablePresets;
|
|
|
|
public PresetBuilderComponent(QuestController questController, QuestFunctions questFunctions, QuestData questData, AetheryteFunctions aetheryteFunctions, IClientState clientState, IChatGui chatGui, UiUtils uiUtils, QuestTooltipComponent questTooltipComponent, QuestRegistry questRegistry, ILogger<PresetBuilderComponent> logger)
|
|
{
|
|
_questController = questController;
|
|
_questFunctions = questFunctions;
|
|
_questData = questData;
|
|
_aetheryteFunctions = aetheryteFunctions;
|
|
_clientState = clientState;
|
|
_chatGui = chatGui;
|
|
_uiUtils = uiUtils;
|
|
_questTooltipComponent = questTooltipComponent;
|
|
_questRegistry = questRegistry;
|
|
_logger = logger;
|
|
_availablePresets = BuildPresetList();
|
|
}
|
|
|
|
public void Draw()
|
|
{
|
|
ImGui.TextWrapped("Quest presets allow you to quickly add related quests to your priority list. These are useful for unlocking content that may be required later.");
|
|
ImGui.Spacing();
|
|
using (ImRaii.IEndObject endObject = ImRaii.Child("PresetList", new Vector2(-1f, -27f), border: true))
|
|
{
|
|
if (endObject)
|
|
{
|
|
DrawPresetGroups();
|
|
}
|
|
}
|
|
List<ElementId> list = (from questId in GetAllPresetQuests()
|
|
where _questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questId))
|
|
select questId).ToList();
|
|
using (ImRaii.Disabled(list.Count == 0))
|
|
{
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Trash, $"Clear All Preset Quests ({list.Count})"))
|
|
{
|
|
ClearAllPresetQuests(list);
|
|
}
|
|
}
|
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
|
{
|
|
if (list.Count == 0)
|
|
{
|
|
ImGui.SetTooltip("No preset quests are currently in the priority list.");
|
|
return;
|
|
}
|
|
ImU8String tooltip = new ImU8String(59, 1);
|
|
tooltip.AppendLiteral("Remove all ");
|
|
tooltip.AppendFormatted(list.Count);
|
|
tooltip.AppendLiteral(" preset-related quest(s) from the priority list.");
|
|
ImGui.SetTooltip(tooltip);
|
|
}
|
|
}
|
|
|
|
private void DrawPresetGroups()
|
|
{
|
|
IOrderedEnumerable<KeyValuePair<string, QuestPreset>> orderedEnumerable = from x in _availablePresets
|
|
where x.Key.StartsWith("aether_currents_", StringComparison.Ordinal)
|
|
orderby x.Value.DisplayOrder
|
|
select x;
|
|
IOrderedEnumerable<KeyValuePair<string, QuestPreset>> orderedEnumerable2 = from x in _availablePresets
|
|
where x.Key.StartsWith("aethernet_", StringComparison.Ordinal)
|
|
orderby x.Value.DisplayOrder
|
|
select x;
|
|
IOrderedEnumerable<KeyValuePair<string, QuestPreset>> orderedEnumerable3 = from x in _availablePresets
|
|
where !x.Key.StartsWith("aether_currents_", StringComparison.Ordinal) && !x.Key.StartsWith("aethernet_", StringComparison.Ordinal)
|
|
orderby x.Value.DisplayOrder
|
|
select x;
|
|
string key;
|
|
QuestPreset value;
|
|
if (DrawGroupHeader("Aether Currents", "Unlock aether currents in various expansion zones to enable flying.", orderedEnumerable))
|
|
{
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
foreach (KeyValuePair<string, QuestPreset> item in orderedEnumerable)
|
|
{
|
|
item.Deconstruct(out key, out value);
|
|
string key2 = key;
|
|
QuestPreset preset = value;
|
|
DrawPreset(key2, preset);
|
|
}
|
|
}
|
|
}
|
|
if (DrawGroupHeader("City Aethernet", "Unlock aethernet shards in major cities to enable city teleports.", orderedEnumerable2))
|
|
{
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
foreach (KeyValuePair<string, QuestPreset> item2 in orderedEnumerable2)
|
|
{
|
|
item2.Deconstruct(out key, out value);
|
|
string key3 = key;
|
|
QuestPreset preset2 = value;
|
|
DrawPreset(key3, preset2);
|
|
}
|
|
}
|
|
}
|
|
if (!orderedEnumerable3.Any() || !DrawGroupHeader("Content Unlocks", "Essential quest series and unlocks that may be required for progression.", orderedEnumerable3))
|
|
{
|
|
return;
|
|
}
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
foreach (KeyValuePair<string, QuestPreset> item3 in orderedEnumerable3)
|
|
{
|
|
item3.Deconstruct(out key, out value);
|
|
string key4 = key;
|
|
QuestPreset preset3 = value;
|
|
DrawPreset(key4, preset3);
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool DrawGroupHeader(string groupName, string groupDescription, IEnumerable<KeyValuePair<string, QuestPreset>> presets)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
int num3 = 0;
|
|
foreach (KeyValuePair<string, QuestPreset> preset2 in presets)
|
|
{
|
|
preset2.Deconstruct(out var _, out var value);
|
|
QuestPreset preset = value;
|
|
num += GetAvailableQuestsForPreset(preset).Count;
|
|
num2 += GetCompletedQuestsForPreset(preset).Count;
|
|
num3 += GetAlreadyPriorityQuestsForPreset(preset).Count;
|
|
}
|
|
string text = groupName;
|
|
if (num > 0 || num2 > 0 || num3 > 0)
|
|
{
|
|
List<string> list = new List<string>();
|
|
if (num > 0)
|
|
{
|
|
list.Add($"{num} available");
|
|
}
|
|
if (num3 > 0)
|
|
{
|
|
list.Add($"{num3} priority");
|
|
}
|
|
if (num2 > 0)
|
|
{
|
|
list.Add($"{num2} completed");
|
|
}
|
|
if (list.Count > 0)
|
|
{
|
|
text = text + " (" + string.Join(", ", list) + ")";
|
|
}
|
|
}
|
|
ImU8String label = new ImU8String(9, 2);
|
|
label.AppendFormatted(text);
|
|
label.AppendLiteral("###Group_");
|
|
label.AppendFormatted(groupName);
|
|
bool result = ImGui.CollapsingHeader(label);
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
ImGui.BeginTooltip();
|
|
ImGui.TextUnformatted(groupDescription);
|
|
ImGui.EndTooltip();
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private void DrawPreset(string key, QuestPreset preset)
|
|
{
|
|
using (ImRaii.PushId(key))
|
|
{
|
|
List<ElementId> availableQuestsForPreset = GetAvailableQuestsForPreset(preset);
|
|
List<ElementId> completedQuestsForPreset = GetCompletedQuestsForPreset(preset);
|
|
List<ElementId> alreadyPriorityQuestsForPreset = GetAlreadyPriorityQuestsForPreset(preset);
|
|
string text = preset.Name;
|
|
if (availableQuestsForPreset.Count > 0 || completedQuestsForPreset.Count > 0 || alreadyPriorityQuestsForPreset.Count > 0)
|
|
{
|
|
List<string> list = new List<string>();
|
|
if (availableQuestsForPreset.Count > 0)
|
|
{
|
|
list.Add($"{availableQuestsForPreset.Count} available");
|
|
}
|
|
if (alreadyPriorityQuestsForPreset.Count > 0)
|
|
{
|
|
list.Add($"{alreadyPriorityQuestsForPreset.Count} priority");
|
|
}
|
|
if (completedQuestsForPreset.Count > 0)
|
|
{
|
|
list.Add($"{completedQuestsForPreset.Count} completed");
|
|
}
|
|
if (list.Count > 0)
|
|
{
|
|
text = text + " (" + string.Join(", ", list) + ")";
|
|
}
|
|
}
|
|
ImU8String label = new ImU8String(3, 2);
|
|
label.AppendFormatted(text);
|
|
label.AppendLiteral("###");
|
|
label.AppendFormatted(key);
|
|
bool num = ImGui.CollapsingHeader(label);
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
ImGui.BeginTooltip();
|
|
ImGui.TextUnformatted(preset.Description);
|
|
ImGui.EndTooltip();
|
|
}
|
|
if (!num)
|
|
{
|
|
return;
|
|
}
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
ImGui.TextWrapped(preset.Description);
|
|
ImGui.Spacing();
|
|
bool flag = key.StartsWith("aethernet_", StringComparison.Ordinal);
|
|
if (flag && availableQuestsForPreset.Count == 0 && completedQuestsForPreset.Count == 0 && alreadyPriorityQuestsForPreset.Count == 0)
|
|
{
|
|
EAetheryteLocation? mainAetheryteForAethernetPreset = GetMainAetheryteForAethernetPreset(key);
|
|
if (mainAetheryteForAethernetPreset.HasValue && !_aetheryteFunctions.IsAetheryteUnlocked(mainAetheryteForAethernetPreset.Value))
|
|
{
|
|
_uiUtils.ChecklistItem("Main aetheryte must be attuned first", ImGuiColors.DalamudRed, FontAwesomeIcon.ExclamationTriangle);
|
|
ImGui.Spacing();
|
|
}
|
|
}
|
|
if (availableQuestsForPreset.Count > 0)
|
|
{
|
|
_uiUtils.ChecklistItem($"{availableQuestsForPreset.Count} {((availableQuestsForPreset.Count == 1) ? "quest" : "quests")} available", ImGuiColors.DalamudYellow, FontAwesomeIcon.Running);
|
|
}
|
|
if (alreadyPriorityQuestsForPreset.Count > 0)
|
|
{
|
|
_uiUtils.ChecklistItem($"{alreadyPriorityQuestsForPreset.Count} {((alreadyPriorityQuestsForPreset.Count == 1) ? "quest" : "quests")} already in priority list", ImGuiColors.DalamudOrange, FontAwesomeIcon.PersonWalkingArrowRight);
|
|
}
|
|
if (completedQuestsForPreset.Count > 0)
|
|
{
|
|
_uiUtils.ChecklistItem($"{completedQuestsForPreset.Count} {((completedQuestsForPreset.Count == 1) ? "quest" : "quests")} already completed", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check);
|
|
}
|
|
if (availableQuestsForPreset.Count == 0 && completedQuestsForPreset.Count == 0 && alreadyPriorityQuestsForPreset.Count == 0)
|
|
{
|
|
if (!flag)
|
|
{
|
|
goto IL_03b8;
|
|
}
|
|
if (flag)
|
|
{
|
|
EAetheryteLocation? mainAetheryteForAethernetPreset2 = GetMainAetheryteForAethernetPreset(key);
|
|
if (mainAetheryteForAethernetPreset2.HasValue && _aetheryteFunctions.IsAetheryteUnlocked(mainAetheryteForAethernetPreset2.Value))
|
|
{
|
|
goto IL_03b8;
|
|
}
|
|
}
|
|
}
|
|
goto IL_03d8;
|
|
IL_03d8:
|
|
if (availableQuestsForPreset.Count > 0)
|
|
{
|
|
ImGui.Spacing();
|
|
string text2 = ((availableQuestsForPreset.Count == 1) ? "Add Quest to Priority" : $"Add All {availableQuestsForPreset.Count} Quests to Priority");
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Plus, text2))
|
|
{
|
|
AddPresetToPriority(preset, availableQuestsForPreset);
|
|
}
|
|
}
|
|
if (availableQuestsForPreset.Count > 0 || completedQuestsForPreset.Count > 0 || alreadyPriorityQuestsForPreset.Count > 0)
|
|
{
|
|
ImGui.Spacing();
|
|
ImGui.Separator();
|
|
foreach (ElementId item in availableQuestsForPreset)
|
|
{
|
|
if (_questData.TryGetQuestInfo(item, out IQuestInfo questInfo))
|
|
{
|
|
if (_uiUtils.ChecklistItem($"{questInfo.Name} ({item})", ImGuiColors.DalamudYellow, FontAwesomeIcon.Running))
|
|
{
|
|
_questTooltipComponent.Draw(questInfo);
|
|
}
|
|
ImGui.SameLine(0f, 5f);
|
|
if (ImGuiComponents.IconButton($"##AddQuest{item}", FontAwesomeIcon.Plus))
|
|
{
|
|
AddIndividualQuestToPriority(questInfo, item);
|
|
}
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
label = new ImU8String(23, 1);
|
|
label.AppendLiteral("Add '");
|
|
label.AppendFormatted(questInfo.Name);
|
|
label.AppendLiteral("' to priority list");
|
|
ImGui.SetTooltip(label);
|
|
}
|
|
}
|
|
}
|
|
foreach (ElementId item2 in alreadyPriorityQuestsForPreset)
|
|
{
|
|
if (_questData.TryGetQuestInfo(item2, out IQuestInfo questInfo2) && _uiUtils.ChecklistItem($"{questInfo2.Name} ({item2})", ImGuiColors.DalamudOrange, FontAwesomeIcon.PersonWalkingArrowRight))
|
|
{
|
|
_questTooltipComponent.Draw(questInfo2);
|
|
}
|
|
}
|
|
foreach (ElementId item3 in completedQuestsForPreset)
|
|
{
|
|
if (_questData.TryGetQuestInfo(item3, out IQuestInfo questInfo3) && _uiUtils.ChecklistItem($"{questInfo3.Name} ({item3})", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check))
|
|
{
|
|
_questTooltipComponent.Draw(questInfo3);
|
|
}
|
|
}
|
|
}
|
|
ImGui.Spacing();
|
|
return;
|
|
IL_03b8:
|
|
_uiUtils.ChecklistItem("No applicable quests found", ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
|
|
goto IL_03d8;
|
|
}
|
|
}
|
|
}
|
|
|
|
private List<ElementId> GetAvailableQuestsForPreset(QuestPreset preset)
|
|
{
|
|
return (from questId in preset.GetQuestIds()
|
|
where _questFunctions.IsReadyToAcceptQuest(questId) || _questFunctions.IsQuestAccepted(questId)
|
|
where !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questId))
|
|
where _questRegistry.IsKnownQuest(questId)
|
|
select questId).ToList();
|
|
}
|
|
|
|
private List<ElementId> GetCompletedQuestsForPreset(QuestPreset preset)
|
|
{
|
|
return (from questId in preset.GetQuestIds()
|
|
where _questFunctions.IsQuestComplete(questId)
|
|
select questId).ToList();
|
|
}
|
|
|
|
private List<ElementId> GetAlreadyPriorityQuestsForPreset(QuestPreset preset)
|
|
{
|
|
return (from questId in preset.GetQuestIds()
|
|
where _questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questId))
|
|
where !_questFunctions.IsQuestComplete(questId)
|
|
select questId).ToList();
|
|
}
|
|
|
|
private List<ElementId> GetAllPresetQuests()
|
|
{
|
|
return _availablePresets.Values.SelectMany((QuestPreset preset) => preset.GetQuestIds()).Distinct().ToList();
|
|
}
|
|
|
|
private void ClearAllPresetQuests(List<ElementId> questsToRemove)
|
|
{
|
|
int num = 0;
|
|
foreach (ElementId questId in questsToRemove)
|
|
{
|
|
Quest quest = _questController.ManualPriorityQuests.FirstOrDefault((Quest q) => q.Id.Equals(questId));
|
|
if (quest != null)
|
|
{
|
|
_questController.ManualPriorityQuests.Remove(quest);
|
|
num++;
|
|
}
|
|
}
|
|
_logger.LogInformation("Removed {Count} preset quests from priority list", num);
|
|
}
|
|
|
|
private void AddPresetToPriority(QuestPreset preset, List<ElementId> questIds)
|
|
{
|
|
int num = 0;
|
|
foreach (ElementId questId in questIds)
|
|
{
|
|
if (_questController.AddQuestPriority(questId))
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
_logger.LogInformation("Added {Count} quests from preset '{PresetName}' to priority list", num, preset.Name);
|
|
}
|
|
|
|
private void AddIndividualQuestToPriority(IQuestInfo questInfo, ElementId questId)
|
|
{
|
|
if (_questController.AddQuestPriority(questId))
|
|
{
|
|
_logger.LogInformation("Added individual quest '{QuestName}' ({QuestId}) to priority list", questInfo.Name, questId);
|
|
}
|
|
}
|
|
|
|
private static Dictionary<string, QuestPreset> BuildPresetList()
|
|
{
|
|
return new Dictionary<string, QuestPreset>
|
|
{
|
|
["aether_currents_hw"] = new QuestPreset
|
|
{
|
|
Name = "Heavensward",
|
|
Description = "Unlock all missed aether currents in Heavensward zones to enable flying.",
|
|
DisplayOrder = 10,
|
|
QuestIds = GetAetherCurrentQuestsByExpansion(EExpansionVersion.Heavensward)
|
|
},
|
|
["aether_currents_sb"] = new QuestPreset
|
|
{
|
|
Name = "Stormblood",
|
|
Description = "Unlock all missed aether currents in Stormblood zones to enable flying.",
|
|
DisplayOrder = 11,
|
|
QuestIds = GetAetherCurrentQuestsByExpansion(EExpansionVersion.Stormblood)
|
|
},
|
|
["aether_currents_shb"] = new QuestPreset
|
|
{
|
|
Name = "Shadowbringers",
|
|
Description = "Unlock all missed aether currents in Shadowbringers zones to enable flying.",
|
|
DisplayOrder = 12,
|
|
QuestIds = GetAetherCurrentQuestsByExpansion(EExpansionVersion.Shadowbringers)
|
|
},
|
|
["aether_currents_ew"] = new QuestPreset
|
|
{
|
|
Name = "Endwalker",
|
|
Description = "Unlock all missed aether currents in Endwalker zones to enable flying.",
|
|
DisplayOrder = 13,
|
|
QuestIds = GetAetherCurrentQuestsByExpansion(EExpansionVersion.Endwalker)
|
|
},
|
|
["aether_currents_dt"] = new QuestPreset
|
|
{
|
|
Name = "Dawntrail",
|
|
Description = "Unlock all missed aether currents in Dawntrail zones to enable flying.",
|
|
DisplayOrder = 14,
|
|
QuestIds = GetAetherCurrentQuestsByExpansion(EExpansionVersion.Dawntrail)
|
|
},
|
|
["aethernet_limsa"] = new QuestPreset
|
|
{
|
|
Name = "Limsa Lominsa",
|
|
Description = "Unlock all aethernet shards in Limsa Lominsa for convenient city travel.",
|
|
DisplayOrder = 20,
|
|
QuestIds = GetAethernetQuestsByCity("Limsa")
|
|
},
|
|
["aethernet_gridania"] = new QuestPreset
|
|
{
|
|
Name = "Gridania",
|
|
Description = "Unlock all aethernet shards in Gridania for convenient city travel.",
|
|
DisplayOrder = 21,
|
|
QuestIds = GetAethernetQuestsByCity("Gridania")
|
|
},
|
|
["aethernet_uldah"] = new QuestPreset
|
|
{
|
|
Name = "Ul'dah",
|
|
Description = "Unlock all aethernet shards in Ul'dah for convenient city travel.",
|
|
DisplayOrder = 22,
|
|
QuestIds = GetAethernetQuestsByCity("Uldah")
|
|
},
|
|
["aethernet_goldsaucer"] = new QuestPreset
|
|
{
|
|
Name = "The Gold Saucer",
|
|
Description = "Unlock all aethernet shards in The Gold Saucer for convenient city travel.",
|
|
DisplayOrder = 23,
|
|
QuestIds = GetAethernetQuestsByCity("GoldSaucer")
|
|
},
|
|
["aethernet_ishgard"] = new QuestPreset
|
|
{
|
|
Name = "Ishgard",
|
|
Description = "Unlock all aethernet shards in Ishgard for convenient city travel.",
|
|
DisplayOrder = 24,
|
|
QuestIds = GetAethernetQuestsByCity("Ishgard")
|
|
},
|
|
["aethernet_idyllshire"] = new QuestPreset
|
|
{
|
|
Name = "Idyllshire",
|
|
Description = "Unlock all aethernet shards in Idyllshire for convenient city travel.",
|
|
DisplayOrder = 25,
|
|
QuestIds = GetAethernetQuestsByCity("Idyllshire")
|
|
},
|
|
["aethernet_rhalgrs_reach"] = new QuestPreset
|
|
{
|
|
Name = "Rhalgr's Reach",
|
|
Description = "Unlock all aethernet shards in Rhalgr's Reach for convenient city travel.",
|
|
DisplayOrder = 26,
|
|
QuestIds = GetAethernetQuestsByCity("Rhalgr's Reach")
|
|
},
|
|
["aethernet_kugane"] = new QuestPreset
|
|
{
|
|
Name = "Kugane",
|
|
Description = "Unlock all aethernet shards in Kugane for convenient city travel.",
|
|
DisplayOrder = 27,
|
|
QuestIds = GetAethernetQuestsByCity("Kugane")
|
|
},
|
|
["aethernet_doman_enclave"] = new QuestPreset
|
|
{
|
|
Name = "Doman Enclave",
|
|
Description = "Unlock all aethernet shards in Doman Enclave for convenient city travel.",
|
|
DisplayOrder = 28,
|
|
QuestIds = GetAethernetQuestsByCity("Doman Enclave")
|
|
},
|
|
["aethernet_the_crystarium"] = new QuestPreset
|
|
{
|
|
Name = "The Crystarium",
|
|
Description = "Unlock all aethernet shards in The Crystarium for convenient city travel.",
|
|
DisplayOrder = 29,
|
|
QuestIds = GetAethernetQuestsByCity("The Crystarium")
|
|
},
|
|
["aethernet_eulmore"] = new QuestPreset
|
|
{
|
|
Name = "Eulmore",
|
|
Description = "Unlock all aethernet shards in Eulmore for convenient city travel.",
|
|
DisplayOrder = 30,
|
|
QuestIds = GetAethernetQuestsByCity("Eulmore")
|
|
},
|
|
["aethernet_old_sharlayan"] = new QuestPreset
|
|
{
|
|
Name = "Old Sharlayan",
|
|
Description = "Unlock all aethernet shards in Old Sharlayan for convenient city travel.",
|
|
DisplayOrder = 31,
|
|
QuestIds = GetAethernetQuestsByCity("Old Sharlayan")
|
|
},
|
|
["aethernet_radz_at_han"] = new QuestPreset
|
|
{
|
|
Name = "Radz-at-Han",
|
|
Description = "Unlock all aethernet shards in Radz-at-Han for convenient city travel.",
|
|
DisplayOrder = 32,
|
|
QuestIds = GetAethernetQuestsByCity("Radz-at-Han")
|
|
},
|
|
["aethernet_tuliyollal"] = new QuestPreset
|
|
{
|
|
Name = "Tuliyollal",
|
|
Description = "Unlock all aethernet shards in Tuliyollal for convenient city travel.",
|
|
DisplayOrder = 33,
|
|
QuestIds = GetAethernetQuestsByCity("Tuliyollal")
|
|
},
|
|
["aethernet_solution_nine"] = new QuestPreset
|
|
{
|
|
Name = "Solution Nine",
|
|
Description = "Unlock all aethernet shards in Solution Nine for convenient city travel.",
|
|
DisplayOrder = 34,
|
|
QuestIds = GetAethernetQuestsByCity("Solution Nine")
|
|
},
|
|
["crystal_tower"] = new QuestPreset
|
|
{
|
|
Name = "Crystal Tower Raids",
|
|
Description = "Complete the Crystal Tower raid series (required for A Realm Reborn MSQ).",
|
|
DisplayOrder = 40,
|
|
QuestIds = QuestData.CrystalTowerQuests.Cast<ElementId>().ToList()
|
|
},
|
|
["hard_primals"] = new QuestPreset
|
|
{
|
|
Name = "A Realm Reborn Hard Mode Primals",
|
|
Description = "Unlock hard mode primal fights from A Realm Reborn.",
|
|
DisplayOrder = 41,
|
|
QuestIds = QuestData.HardModePrimals.Cast<ElementId>().ToList()
|
|
}
|
|
};
|
|
}
|
|
|
|
private static List<ElementId> GetAetherCurrentQuestsByExpansion(EExpansionVersion expansion)
|
|
{
|
|
uint[] territoryRanges = expansion switch
|
|
{
|
|
EExpansionVersion.Heavensward => new uint[5] { 397u, 398u, 399u, 400u, 401u },
|
|
EExpansionVersion.Stormblood => new uint[6] { 612u, 613u, 614u, 620u, 621u, 622u },
|
|
EExpansionVersion.Shadowbringers => new uint[6] { 813u, 814u, 815u, 816u, 817u, 818u },
|
|
EExpansionVersion.Endwalker => new uint[6] { 956u, 957u, 958u, 959u, 960u, 961u },
|
|
EExpansionVersion.Dawntrail => new uint[6] { 1187u, 1188u, 1189u, 1190u, 1191u, 1192u },
|
|
_ => Array.Empty<uint>(),
|
|
};
|
|
return QuestData.AetherCurrentQuestsByTerritory.Where<KeyValuePair<uint, ImmutableList<QuestId>>>((KeyValuePair<uint, ImmutableList<QuestId>> kvp) => territoryRanges.Contains(kvp.Key)).SelectMany((KeyValuePair<uint, ImmutableList<QuestId>> kvp) => kvp.Value).Cast<ElementId>()
|
|
.ToList();
|
|
}
|
|
|
|
private static List<ElementId> GetAethernetQuestsByCity(string cityName)
|
|
{
|
|
switch (cityName)
|
|
{
|
|
case "Limsa":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list15 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list15, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list15);
|
|
int index = 0;
|
|
span[index] = new AethernetId(1);
|
|
return list15;
|
|
}
|
|
case "Gridania":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list14 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list14, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list14);
|
|
int num = 0;
|
|
span[num] = new AethernetId(2);
|
|
return list14;
|
|
}
|
|
case "Uldah":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list13 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list13, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list13);
|
|
int index = 0;
|
|
span[index] = new AethernetId(3);
|
|
return list13;
|
|
}
|
|
case "GoldSaucer":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list12 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list12, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list12);
|
|
int num = 0;
|
|
span[num] = new AethernetId(4);
|
|
return list12;
|
|
}
|
|
case "Ishgard":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list11 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list11, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list11);
|
|
int index = 0;
|
|
span[index] = new AethernetId(5);
|
|
return list11;
|
|
}
|
|
case "Idyllshire":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list10 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list10, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list10);
|
|
int num = 0;
|
|
span[num] = new AethernetId(6);
|
|
return list10;
|
|
}
|
|
case "Rhalgr's Reach":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list9 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list9, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list9);
|
|
int index = 0;
|
|
span[index] = new AethernetId(7);
|
|
return list9;
|
|
}
|
|
case "Kugane":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list8 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list8, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list8);
|
|
int num = 0;
|
|
span[num] = new AethernetId(8);
|
|
return list8;
|
|
}
|
|
case "Doman Enclave":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list7 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list7, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list7);
|
|
int index = 0;
|
|
span[index] = new AethernetId(9);
|
|
return list7;
|
|
}
|
|
case "The Crystarium":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list6 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list6, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list6);
|
|
int num = 0;
|
|
span[num] = new AethernetId(10);
|
|
return list6;
|
|
}
|
|
case "Eulmore":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list5 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list5, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list5);
|
|
int index = 0;
|
|
span[index] = new AethernetId(11);
|
|
return list5;
|
|
}
|
|
case "Old Sharlayan":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list4 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list4, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list4);
|
|
int num = 0;
|
|
span[num] = new AethernetId(12);
|
|
return list4;
|
|
}
|
|
case "Radz-at-Han":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list3 = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list3, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list3);
|
|
int index = 0;
|
|
span[index] = new AethernetId(13);
|
|
return list3;
|
|
}
|
|
case "Tuliyollal":
|
|
{
|
|
int index = 1;
|
|
List<ElementId> list2 = new List<ElementId>(index);
|
|
CollectionsMarshal.SetCount(list2, index);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list2);
|
|
int num = 0;
|
|
span[num] = new AethernetId(14);
|
|
return list2;
|
|
}
|
|
case "Solution Nine":
|
|
{
|
|
int num = 1;
|
|
List<ElementId> list = new List<ElementId>(num);
|
|
CollectionsMarshal.SetCount(list, num);
|
|
Span<ElementId> span = CollectionsMarshal.AsSpan(list);
|
|
int index = 0;
|
|
span[index] = new AethernetId(15);
|
|
return list;
|
|
}
|
|
default:
|
|
return new List<ElementId>();
|
|
}
|
|
}
|
|
|
|
private static EAetheryteLocation? GetMainAetheryteForAethernetPreset(string presetKey)
|
|
{
|
|
return presetKey switch
|
|
{
|
|
"aethernet_limsa" => EAetheryteLocation.Limsa,
|
|
"aethernet_gridania" => EAetheryteLocation.Gridania,
|
|
"aethernet_uldah" => EAetheryteLocation.Uldah,
|
|
"aethernet_goldsaucer" => EAetheryteLocation.GoldSaucer,
|
|
"aethernet_ishgard" => EAetheryteLocation.Ishgard,
|
|
"aethernet_idyllshire" => EAetheryteLocation.Idyllshire,
|
|
"aethernet_rhalgrs_reach" => EAetheryteLocation.RhalgrsReach,
|
|
"aethernet_kugane" => EAetheryteLocation.Kugane,
|
|
"aethernet_doman_enclave" => EAetheryteLocation.DomanEnclave,
|
|
"aethernet_the_crystarium" => EAetheryteLocation.Crystarium,
|
|
"aethernet_eulmore" => EAetheryteLocation.Eulmore,
|
|
"aethernet_old_sharlayan" => EAetheryteLocation.OldSharlayan,
|
|
"aethernet_radz_at_han" => EAetheryteLocation.RadzAtHan,
|
|
"aethernet_tuliyollal" => EAetheryteLocation.Tuliyollal,
|
|
"aethernet_solution_nine" => EAetheryteLocation.SolutionNine,
|
|
_ => null,
|
|
};
|
|
}
|
|
}
|