--- /dev/null
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Questionable.Model.Questing;
+using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
+using static Questionable.QuestPathGenerator.RoslynShortcuts;
+
+namespace Questionable.QuestPathGenerator.RoslynElements;
+
+internal static class AlliedSocietyDailyIdExtensions
+{
+ public static ExpressionSyntax ToExpressionSyntax(this AlliedSocietyDailyId alliedSocietyDailyId)
+ {
+ return ObjectCreationExpression(
+ IdentifierName(nameof(AlliedSocietyDailyId)))
+ .WithArgumentList(
+ ArgumentList(
+ SeparatedList<ArgumentSyntax>(
+ new SyntaxNodeOrToken[]
+ {
+ Argument(LiteralValue(alliedSocietyDailyId.AlliedSociety)),
+ Token(SyntaxKind.CommaToken),
+ Argument(LiteralValue(alliedSocietyDailyId.Rank)),
+ })));
+ }
+}
QuestId questId => questId.ToExpressionSyntax(),
LeveId leveId => leveId.ToExpressionSyntax(),
SatisfactionSupplyNpcId satisfactionSupplyNpcId => satisfactionSupplyNpcId.ToExpressionSyntax(),
+ AlliedSocietyDailyId alliedSocietyDailyId => alliedSocietyDailyId.ToExpressionSyntax(),
Vector3 vector => vector.ToExpressionSyntax(),
AethernetShortcut aethernetShortcut => aethernetShortcut.ToExpressionSyntax(),
ChatMessage chatMessage => chatMessage.ToExpressionSyntax(),
public string Name { get; }
public uint CategoryId { get; }
public List<IQuestInfo> Quests { get; }
- public int QuestCount => Quests.Count;
}
internal sealed class Category(JournalCategory journalCategory, IReadOnlyList<Genre> genres)
public string Name { get; } = journalCategory.Name.ToString();
public uint SectionId { get; } = journalCategory.JournalSection.RowId;
public IReadOnlyList<Genre> Genres { get; } = genres;
- public int QuestCount => Genres.Sum(x => x.QuestCount);
}
internal sealed class Section(JournalSection journalSection, IReadOnlyList<Category> categories)
public uint Id { get; } = journalSection.RowId;
public string Name { get; } = journalSection.Name.ToString();
public IReadOnlyList<Category> Categories { get; } = categories;
- public int QuestCount => Categories.Sum(x => x.QuestCount);
}
}
.Where(x => x.RowId > 0)
.Where(x => x.IssuerLocation.RowId > 0)
.Select(x => new QuestInfo(x, questChapters.GetValueOrDefault(x.RowId),
- startingCities.GetValueOrDefault(x.RowId)))
- .Where(x => x.QuestId.Value != 1428),
+ startingCities.GetValueOrDefault(x.RowId))),
..dataManager.GetExcelSheet<SatisfactionNpc>()
.Where(x => x is { RowId: > 0, Npc.RowId: > 0 })
.Select(x => new SatisfactionSupplyInfo(x)),
// initial city quests are side quests
// unclear if 470 can be started as the required quest isn't available anymore
ushort[] limsaSideQuests =
- [107, 111, 112, 122, 663, 475, 472, 476, 470, 473, 474, 477, 486, 478, 479, 487, 59, 400, 401, 693, 405];
+ [107, 111, 112, 122, 663, 475, 472, 476, 470, 473, 474, 477, 486, 478, 479, 59, 400, 401, 693, 405];
foreach (var questId in limsaSideQuests)
((QuestInfo)_quests[new QuestId(questId)]).StartingCity = 1;
((QuestInfo)_quests[new QuestId(questId)]).StartingCity = 2;
ushort[] uldahSideQuests =
- [594, 389, 390, 321, 304, 322, 388, 308, 326, 1429, 58, 687, 341, 504, 531, 506, 530, 573, 342, 505];
+ [594, 389, 390, 321, 304, 322, 388, 308, 326, 58, 687, 341, 504, 531, 506, 530, 573, 342, 505];
foreach (var questId in uldahSideQuests)
((QuestInfo)_quests[new QuestId(questId)]).StartingCity = 3;
return true;
}
+ if (IsQuestRemoved(questId))
+ return true;
+
return false;
}
return false;
}
+ public bool IsQuestRemoved(ElementId elementId)
+ {
+ if (elementId is QuestId questId)
+ return IsQuestRemoved(questId);
+ else
+ return false;
+ }
+
+ [SuppressMessage("Performance", "CA1822")]
+ private bool IsQuestRemoved(QuestId questId)
+ {
+ return questId.Value is 487 or 1428 or 1429;
+ }
+
private bool HasCompletedPreviousQuests(IQuestInfo questInfo, ElementId? extraCompletedQuest)
{
if (questInfo.PreviousQuests.Count == 0)
private void DrawSection(FilteredSection filter)
{
- if (filter.Section.QuestCount == 0)
+ (int available, int total, int obtainable, int completed) =
+ _sectionCounts.GetValueOrDefault(filter.Section, new());
+ if (total == 0)
return;
- (int available, int obtainable, int completed) = _sectionCounts.GetValueOrDefault(filter.Section, new());
-
ImGui.TableNextRow();
ImGui.TableNextColumn();
bool open = ImGui.TreeNodeEx(filter.Section.Name, ImGuiTreeNodeFlags.SpanFullWidth);
ImGui.TableNextColumn();
- DrawCount(available, filter.Section.QuestCount);
+ DrawCount(available, total);
ImGui.TableNextColumn();
DrawCount(completed, obtainable);
private void DrawCategory(FilteredCategory filter)
{
- if (filter.Category.QuestCount == 0)
+ (int available, int total, int obtainable, int completed) =
+ _categoryCounts.GetValueOrDefault(filter.Category, new());
+ if (total == 0)
return;
- (int available, int obtainable, int completed) = _categoryCounts.GetValueOrDefault(filter.Category, new());
-
ImGui.TableNextRow();
ImGui.TableNextColumn();
bool open = ImGui.TreeNodeEx(filter.Category.Name, ImGuiTreeNodeFlags.SpanFullWidth);
ImGui.TableNextColumn();
- DrawCount(available, filter.Category.QuestCount);
+ DrawCount(available, total);
ImGui.TableNextColumn();
DrawCount(completed, obtainable);
private void DrawGenre(FilteredGenre filter)
{
- if (filter.Genre.QuestCount == 0)
+ (int supported, int total, int obtainable, int completed) = _genreCounts.GetValueOrDefault(filter.Genre, new());
+ if (total == 0)
return;
- (int supported, int obtainable, int completed) = _genreCounts.GetValueOrDefault(filter.Genre, new());
-
ImGui.TableNextRow();
ImGui.TableNextColumn();
bool open = ImGui.TreeNodeEx(filter.Genre.Name, ImGuiTreeNodeFlags.SpanFullWidth);
ImGui.TableNextColumn();
- DrawCount(supported, filter.Genre.QuestCount);
+ DrawCount(supported, total);
ImGui.TableNextColumn();
DrawCount(completed, obtainable);
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + spacing);
- if (quest is { Root.Disabled: false })
+ if (_questFunctions.IsQuestRemoved(questInfo.QuestId))
+ _uiUtils.ChecklistItem(string.Empty, ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
+ else if (quest is { Root.Disabled: false })
{
List<ValidationIssue> issues = _questValidator.GetIssues(quest.Id);
if (issues.Any(x => x.Severity == EIssueSeverity.Error))
foreach (var genre in _journalData.Genres)
{
int available = genre.Quests.Count(x =>
- _questRegistry.TryGetQuest(x.QuestId, out var quest) && !quest.Root.Disabled);
+ _questRegistry.TryGetQuest(x.QuestId, out var quest) &&
+ !quest.Root.Disabled &&
+ !_questFunctions.IsQuestRemoved(x.QuestId));
+ int total = genre.Quests.Count(x => !_questFunctions.IsQuestRemoved(x.QuestId));
int obtainable = genre.Quests.Count(x => !_questFunctions.IsQuestUnobtainable(x.QuestId));
int completed = genre.Quests.Count(x => _questFunctions.IsQuestComplete(x.QuestId));
- _genreCounts[genre] = new(available, obtainable, completed);
+ _genreCounts[genre] = new(available, total, obtainable, completed);
}
foreach (var category in _journalData.Categories)
.Select(x => x.Value)
.ToList();
int available = counts.Sum(x => x.Available);
+ int total = counts.Sum(x => x.Total);
int obtainable = counts.Sum(x => x.Obtainable);
int completed = counts.Sum(x => x.Completed);
- _categoryCounts[category] = new(available, obtainable, completed);
+ _categoryCounts[category] = new(available, total, obtainable, completed);
}
foreach (var section in _journalData.Sections)
.Select(x => x.Value)
.ToList();
int available = counts.Sum(x => x.Available);
+ int total = counts.Sum(x => x.Total);
int obtainable = counts.Sum(x => x.Obtainable);
int completed = counts.Sum(x => x.Completed);
- _sectionCounts[section] = new(available, obtainable, completed);
+ _sectionCounts[section] = new(available, total, obtainable, completed);
}
}
private sealed record FilteredGenre(JournalData.Genre Genre, List<IQuestInfo> Quests);
- private sealed record JournalCounts(int Available = 0, int Obtainable = 0, int Completed = 0);
+ private sealed record JournalCounts(int Available, int Total, int Obtainable, int Completed)
+ {
+ public JournalCounts()
+ : this(0, 0, 0, 0)
+ {
+ }
+ }
}