1
0
forked from liza/Questionable

Check for GC for quest lock; minor UI adjustments

This commit is contained in:
Liza 2024-07-22 15:27:06 +02:00
parent 325b529337
commit 4985c9d550
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 51 additions and 41 deletions

View File

@ -291,6 +291,9 @@ internal sealed unsafe class GameFunctions
return true; return true;
} }
if (questInfo.GrandCompany != GrandCompany.None && questInfo.GrandCompany != GetGrandCompany())
return true;
return !HasCompletedPreviousQuests(questInfo, extraCompletedQuest) || !HasCompletedPreviousInstances(questInfo); return !HasCompletedPreviousQuests(questInfo, extraCompletedQuest) || !HasCompletedPreviousInstances(questInfo);
} }
@ -728,4 +731,9 @@ internal sealed unsafe class GameFunctions
LAddon.IsAddonReady(fade) && LAddon.IsAddonReady(fade) &&
fade->IsVisible; fade->IsVisible;
} }
public GrandCompany GetGrandCompany()
{
return (GrandCompany)PlayerState.Instance()->GrandCompany;
}
} }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Linq; using System.Linq;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using JetBrains.Annotations; using JetBrains.Annotations;
using ExcelQuest = Lumina.Excel.GeneratedSheets.Quest; using ExcelQuest = Lumina.Excel.GeneratedSheets.Quest;
@ -25,6 +26,7 @@ internal sealed class QuestInfo
CompletesInstantly = quest.ToDoCompleteSeq[0] == 0; CompletesInstantly = quest.ToDoCompleteSeq[0] == 0;
PreviousInstanceContent = quest.InstanceContent.Select(x => (ushort)x.Row).Where(x => x != 0).ToList(); PreviousInstanceContent = quest.InstanceContent.Select(x => (ushort)x.Row).Where(x => x != 0).ToList();
PreviousInstanceContentJoin = (QuestJoin)quest.InstanceContentJoin; PreviousInstanceContentJoin = (QuestJoin)quest.InstanceContentJoin;
GrandCompany = (GrandCompany)quest.GrandCompany.Row;
} }
@ -35,12 +37,13 @@ internal sealed class QuestInfo
public bool IsRepeatable { get; } public bool IsRepeatable { get; }
public ImmutableList<ushort> PreviousQuests { get; } public ImmutableList<ushort> PreviousQuests { get; }
public QuestJoin PreviousQuestJoin { get; } public QuestJoin PreviousQuestJoin { get; }
public ImmutableList<ushort> QuestLocks { get; set; } public ImmutableList<ushort> QuestLocks { get; }
public QuestJoin QuestLockJoin { get; set; } public QuestJoin QuestLockJoin { get; }
public List<ushort> PreviousInstanceContent { get; set; } public List<ushort> PreviousInstanceContent { get; }
public QuestJoin PreviousInstanceContentJoin { get; set; } public QuestJoin PreviousInstanceContentJoin { get; }
public bool IsMainScenarioQuest { get; } public bool IsMainScenarioQuest { get; }
public bool CompletesInstantly { get; set; } public bool CompletesInstantly { get; }
public GrandCompany GrandCompany { get; }
public string SimplifiedName => Name public string SimplifiedName => Name
.TrimStart(SeIconChar.QuestSync.ToIconChar(), SeIconChar.QuestRepeatable.ToIconChar(), ' '); .TrimStart(SeIconChar.QuestSync.ToIconChar(), SeIconChar.QuestRepeatable.ToIconChar(), ' ');

View File

@ -116,7 +116,9 @@ internal sealed class ActiveQuestComponent
if (_configuration.Advanced.AdditionalStatusInformation && _questController.IsInterruptible()) if (_configuration.Advanced.AdditionalStatusInformation && _questController.IsInterruptible())
{ {
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudYellow, "Interruptible"); ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.CodeBranch.ToIconString());
ImGui.PopFont();
} }
} }

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
@ -11,6 +12,7 @@ using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET; using ImGuiNET;
using LLib.GameUI; using LLib.GameUI;
using LLib.ImGui; using LLib.ImGui;
@ -187,10 +189,7 @@ internal sealed class QuestSelectionWindow : LWindow
} }
if (quest.PreviousQuests.Count > 0) if (quest.PreviousQuests.Count > 0)
{
ImGui.Separator();
DrawQuestUnlocks(quest, 0); DrawQuestUnlocks(quest, 0);
}
} }
} }
} }
@ -266,6 +265,9 @@ internal sealed class QuestSelectionWindow : LWindow
if (quest.PreviousQuests.Count > 0) if (quest.PreviousQuests.Count > 0)
{ {
if (counter == 0)
ImGui.Separator();
if (quest.PreviousQuests.Count > 1) if (quest.PreviousQuests.Count > 1)
{ {
if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All) if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All)
@ -278,17 +280,10 @@ internal sealed class QuestSelectionWindow : LWindow
{ {
var qInfo = _questData.GetQuestInfo(q); var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q); var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q);
// ReSharper disable once UnusedVariable if (!_questRegistry.IsKnownQuest(qInfo.QuestId))
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push()) iconColor = ImGuiColors.DalamudGrey;
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))
ImGui.TextColored(iconColor, icon.ToIconString());
else
ImGui.TextColored(ImGuiColors.DalamudGrey, icon.ToIconString());
}
ImGui.SameLine(); _uiUtils.ChecklistItem(FormatQuestUnlockName(qInfo), iconColor, icon);
ImGui.TextUnformatted(FormatQuestUnlockName(qInfo));
DrawQuestUnlocks(qInfo, counter + 1); DrawQuestUnlocks(qInfo, counter + 1);
} }
@ -296,12 +291,13 @@ internal sealed class QuestSelectionWindow : LWindow
if (counter == 0 && quest.QuestLocks.Count > 0) if (counter == 0 && quest.QuestLocks.Count > 0)
{ {
ImGui.Separator();
if (quest.QuestLocks.Count > 1) if (quest.QuestLocks.Count > 1)
{ {
if (quest.QuestLockJoin == QuestInfo.QuestJoin.All) if (quest.QuestLockJoin == QuestInfo.QuestJoin.All)
ImGui.Text("Blocked if all completed:"); ImGui.Text("Blocked by (if all completed):");
else if (quest.QuestLockJoin == QuestInfo.QuestJoin.AtLeastOne) else if (quest.QuestLockJoin == QuestInfo.QuestJoin.AtLeastOne)
ImGui.Text("Blocked if at least completed:"); ImGui.Text("Blocked by (if at least completed):");
} }
else else
ImGui.Text("Blocked by (if completed):"); ImGui.Text("Blocked by (if completed):");
@ -310,22 +306,16 @@ internal sealed class QuestSelectionWindow : LWindow
{ {
var qInfo = _questData.GetQuestInfo(q); var qInfo = _questData.GetQuestInfo(q);
var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q); var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q);
// ReSharper disable once UnusedVariable if (!_questRegistry.IsKnownQuest(qInfo.QuestId))
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push()) iconColor = ImGuiColors.DalamudGrey;
{
if (_questRegistry.IsKnownQuest(qInfo.QuestId))
ImGui.TextColored(iconColor, icon.ToIconString());
else
ImGui.TextColored(ImGuiColors.DalamudGrey, icon.ToIconString());
}
ImGui.SameLine(); _uiUtils.ChecklistItem(FormatQuestUnlockName(qInfo), iconColor, icon);
ImGui.TextUnformatted(FormatQuestUnlockName(qInfo));
} }
} }
if (counter == 0 && quest.PreviousInstanceContent.Count > 0) if (counter == 0 && quest.PreviousInstanceContent.Count > 0)
{ {
ImGui.Separator();
if (quest.PreviousInstanceContent.Count > 1) if (quest.PreviousInstanceContent.Count > 1)
{ {
if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All) if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All)
@ -340,18 +330,25 @@ internal sealed class QuestSelectionWindow : LWindow
{ {
string instanceName = _territoryData.GetInstanceName(instanceId) ?? "?"; string instanceName = _territoryData.GetInstanceName(instanceId) ?? "?";
var (iconColor, icon) = UiUtils.GetInstanceStyle(instanceId); var (iconColor, icon) = UiUtils.GetInstanceStyle(instanceId);
_uiUtils.ChecklistItem(instanceName, iconColor, icon);
// ReSharper disable once UnusedVariable
using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
{
ImGui.TextColored(iconColor, icon.ToIconString());
}
ImGui.SameLine();
ImGui.TextUnformatted(instanceName);
} }
} }
if (counter == 0 && quest.GrandCompany != GrandCompany.None)
{
ImGui.Separator();
string gcName = quest.GrandCompany switch
{
GrandCompany.Maelstrom => "Maelstrom",
GrandCompany.TwinAdder => "Twin Adder",
GrandCompany.ImmortalFlames => "Immortal Flames",
_ => "None",
};
GrandCompany currentGrandCompany = _gameFunctions.GetGrandCompany();
_uiUtils.ChecklistItem($"Grand Company: {gcName}", quest.GrandCompany == currentGrandCompany);
}
if (counter > 0) if (counter > 0)
ImGui.Unindent(); ImGui.Unindent();
} }