diff --git a/Questionable/Data/JournalData.cs b/Questionable/Data/JournalData.cs index ae6c6ac2a..fca04e823 100644 --- a/Questionable/Data/JournalData.cs +++ b/Questionable/Data/JournalData.cs @@ -22,17 +22,17 @@ internal sealed class JournalData var genreLimsa = new Genre(uint.MaxValue - 3, "Starting in Limsa Lominsa", 1, new uint[] { 108, 109 }.Concat(limsaStart.Quest.Select(x => x.Row)) .Where(x => x != 0) - .Select(x => (QuestInfo)questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) + .Select(x => questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) .ToList()); var genreGridania = new Genre(uint.MaxValue - 2, "Starting in Gridania", 1, new uint[] { 85, 123, 124 }.Concat(gridaniaStart.Quest.Select(x => x.Row)) .Where(x => x != 0) - .Select(x => (QuestInfo)questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) + .Select(x => questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) .ToList()); var genreUldah = new Genre(uint.MaxValue - 1, "Starting in Ul'dah", 1, new uint[] { 568, 569, 570 }.Concat(uldahStart.Quest.Select(x => x.Row)) .Where(x => x != 0) - .Select(x => (QuestInfo)questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) + .Select(x => questData.GetQuestInfo(new QuestId((ushort)(x & 0xFFFF)))) .ToList()); genres.InsertRange(0, [genreLimsa, genreGridania, genreUldah]); genres.Single(x => x.Id == 1) @@ -57,7 +57,7 @@ internal sealed class JournalData internal sealed class Genre { - public Genre(JournalGenre journalGenre, List quests) + public Genre(JournalGenre journalGenre, List quests) { Id = journalGenre.RowId; Name = journalGenre.Name.ToString(); @@ -65,7 +65,7 @@ internal sealed class JournalData Quests = quests; } - public Genre(uint id, string name, uint categoryId, List quests) + public Genre(uint id, string name, uint categoryId, List quests) { Id = id; Name = name; @@ -76,7 +76,7 @@ internal sealed class JournalData public uint Id { get; } public string Name { get; } public uint CategoryId { get; } - public List Quests { get; } + public List Quests { get; } public int QuestCount => Quests.Count; } diff --git a/Questionable/Data/QuestData.cs b/Questionable/Data/QuestData.cs index 89b389123..4c01199d4 100644 --- a/Questionable/Data/QuestData.cs +++ b/Questionable/Data/QuestData.cs @@ -82,11 +82,10 @@ internal sealed class QuestData public bool IsIssuerOfAnyQuest(uint targetId) => _quests.Values.Any(x => x.IssuerDataId == targetId); - public List GetAllByJournalGenre(uint journalGenre) + public List GetAllByJournalGenre(uint journalGenre) { return _quests.Values - .Where(x => x is QuestInfo { IsSeasonalEvent: false }) - .Cast() + .Where(x => x is QuestInfo { IsSeasonalEvent: false } or not QuestInfo) .Where(x => x.JournalGenre == journalGenre) .OrderBy(x => x.SortKey) .ThenBy(x => x.QuestId) diff --git a/Questionable/Model/IQuestInfo.cs b/Questionable/Model/IQuestInfo.cs index b4b362e8e..1a2f557a0 100644 --- a/Questionable/Model/IQuestInfo.cs +++ b/Questionable/Model/IQuestInfo.cs @@ -14,6 +14,8 @@ public interface IQuestInfo public bool IsRepeatable { get; } public ushort Level { get; } public EBeastTribe BeastTribe { get; } + public uint? JournalGenre { get; } + public ushort SortKey { get; } public bool IsMainScenarioQuest { get; } public IReadOnlyList ClassJobs { get; } public EExpansionVersion Expansion { get; } diff --git a/Questionable/Model/LeveInfo.cs b/Questionable/Model/LeveInfo.cs index 499402168..8d454e5b1 100644 --- a/Questionable/Model/LeveInfo.cs +++ b/Questionable/Model/LeveInfo.cs @@ -12,6 +12,8 @@ internal sealed class LeveInfo : IQuestInfo QuestId = new LeveId((ushort)leve.RowId); Name = leve.Name; Level = leve.ClassJobLevel; + JournalGenre = leve.JournalGenre.Row; + SortKey = QuestId.Value; IssuerDataId = leve.LevelLevemete.Value!.Object; ClassJobs = QuestInfoUtils.AsList(leve.ClassJobCategory.Value!); Expansion = (EExpansionVersion)leve.LevelLevemete.Value.Territory.Value!.ExVersion.Row; @@ -23,6 +25,8 @@ internal sealed class LeveInfo : IQuestInfo public bool IsRepeatable => true; public ushort Level { get; } public EBeastTribe BeastTribe => EBeastTribe.None; + public uint? JournalGenre { get; } + public ushort SortKey { get; } public bool IsMainScenarioQuest => false; public IReadOnlyList ClassJobs { get; } public EExpansionVersion Expansion { get; } diff --git a/Questionable/Model/QuestInfo.cs b/Questionable/Model/QuestInfo.cs index 6dba304f1..e9a70ea3a 100644 --- a/Questionable/Model/QuestInfo.cs +++ b/Questionable/Model/QuestInfo.cs @@ -71,7 +71,7 @@ internal sealed class QuestInfo : IQuestInfo public List PreviousInstanceContent { get; } public QuestJoin PreviousInstanceContentJoin { get; } public uint? JournalGenre { get; } - public ushort SortKey { get; set; } + public ushort SortKey { get; } public bool IsMainScenarioQuest { get; } public bool CompletesInstantly { get; } public GrandCompany GrandCompany { get; } diff --git a/Questionable/Model/SatisfactionSupplyInfo.cs b/Questionable/Model/SatisfactionSupplyInfo.cs index b46061ad0..17c56772f 100644 --- a/Questionable/Model/SatisfactionSupplyInfo.cs +++ b/Questionable/Model/SatisfactionSupplyInfo.cs @@ -13,6 +13,7 @@ internal sealed class SatisfactionSupplyInfo : IQuestInfo Name = npc.Npc.Value!.Singular; IssuerDataId = npc.Npc.Row; Level = npc.LevelUnlock; + SortKey = QuestId.Value; Expansion = (EExpansionVersion)npc.QuestRequired.Value!.Expansion.Row; } @@ -22,6 +23,8 @@ internal sealed class SatisfactionSupplyInfo : IQuestInfo public bool IsRepeatable => true; public ushort Level { get; } public EBeastTribe BeastTribe => EBeastTribe.None; + public uint? JournalGenre => null; + public ushort SortKey { get; } public bool IsMainScenarioQuest => false; public EExpansionVersion Expansion { get; } diff --git a/Questionable/Windows/JournalProgressWindow.cs b/Questionable/Windows/JournalProgressWindow.cs index 2d19c1be2..bf00be397 100644 --- a/Questionable/Windows/JournalProgressWindow.cs +++ b/Questionable/Windows/JournalProgressWindow.cs @@ -190,7 +190,7 @@ internal sealed class JournalProgressWindow : LWindow, IDisposable } } - private void DrawQuest(QuestInfo questInfo) + private void DrawQuest(IQuestInfo questInfo) { _questRegistry.TryGetQuest(questInfo.QuestId, out var quest); @@ -200,7 +200,7 @@ internal sealed class JournalProgressWindow : LWindow, IDisposable ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.SpanFullWidth); - if (ImGui.IsItemClicked() && _commandManager.Commands.TryGetValue("/questinfo", out var commandInfo)) + if (questInfo is QuestInfo && ImGui.IsItemClicked() && _commandManager.Commands.TryGetValue("/questinfo", out var commandInfo)) { _commandManager.DispatchCommand("/questinfo", questInfo.QuestId.ToString() ?? string.Empty, commandInfo); } @@ -308,7 +308,7 @@ internal sealed class JournalProgressWindow : LWindow, IDisposable return new FilteredGenre(genre, genre.Quests); else { - List filteredQuests = genre.Quests + List filteredQuests = genre.Quests .Where(x => match(x.Name)) .ToList(); if (filteredQuests.Count > 0) @@ -378,5 +378,5 @@ internal sealed class JournalProgressWindow : LWindow, IDisposable private sealed record FilteredCategory(JournalData.Category Category, List Genres); - private sealed record FilteredGenre(JournalData.Genre Genre, List Quests); + private sealed record FilteredGenre(JournalData.Genre Genre, List Quests); }