Add leves to statistics window

This commit is contained in:
Liza 2024-08-11 19:13:21 +02:00
parent 69944db8d1
commit ffc24b246b
Signed by: liza
GPG Key ID: 7199F8D727D55F67
7 changed files with 22 additions and 14 deletions

View File

@ -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<QuestInfo> quests)
public Genre(JournalGenre journalGenre, List<IQuestInfo> 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<QuestInfo> quests)
public Genre(uint id, string name, uint categoryId, List<IQuestInfo> 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<QuestInfo> Quests { get; }
public List<IQuestInfo> Quests { get; }
public int QuestCount => Quests.Count;
}

View File

@ -82,11 +82,10 @@ internal sealed class QuestData
public bool IsIssuerOfAnyQuest(uint targetId) => _quests.Values.Any(x => x.IssuerDataId == targetId);
public List<QuestInfo> GetAllByJournalGenre(uint journalGenre)
public List<IQuestInfo> GetAllByJournalGenre(uint journalGenre)
{
return _quests.Values
.Where(x => x is QuestInfo { IsSeasonalEvent: false })
.Cast<QuestInfo>()
.Where(x => x is QuestInfo { IsSeasonalEvent: false } or not QuestInfo)
.Where(x => x.JournalGenre == journalGenre)
.OrderBy(x => x.SortKey)
.ThenBy(x => x.QuestId)

View File

@ -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<EClassJob> ClassJobs { get; }
public EExpansionVersion Expansion { get; }

View File

@ -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<EClassJob> ClassJobs { get; }
public EExpansionVersion Expansion { get; }

View File

@ -71,7 +71,7 @@ internal sealed class QuestInfo : IQuestInfo
public List<ushort> 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; }

View File

@ -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; }

View File

@ -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<QuestInfo> filteredQuests = genre.Quests
List<IQuestInfo> 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<FilteredGenre> Genres);
private sealed record FilteredGenre(JournalData.Genre Genre, List<QuestInfo> Quests);
private sealed record FilteredGenre(JournalData.Genre Genre, List<IQuestInfo> Quests);
}