muffin v6.21
This commit is contained in:
parent
e192d07a7b
commit
b7a9243899
4 changed files with 3461 additions and 2783 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
AssemblyInfo.cs
|
AssemblyInfo.cs
|
||||||
|
Solution.sln
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Questionable.Model;
|
namespace Questionable.Model;
|
||||||
|
|
||||||
|
@ -40,4 +41,32 @@ public static class ExpansionData
|
||||||
}
|
}
|
||||||
return expansionVersion.ToString();
|
return expansionVersion.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToAbbreviation(this EExpansionVersion expansionVersion)
|
||||||
|
{
|
||||||
|
return expansionVersion switch
|
||||||
|
{
|
||||||
|
EExpansionVersion.ARealmReborn => "ARR",
|
||||||
|
EExpansionVersion.Heavensward => "HW",
|
||||||
|
EExpansionVersion.Stormblood => "SB",
|
||||||
|
EExpansionVersion.Shadowbringers => "ShB",
|
||||||
|
EExpansionVersion.Endwalker => "EW",
|
||||||
|
EExpansionVersion.Dawntrail => "DT",
|
||||||
|
_ => "?",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector4 GetExpansionColor(this EExpansionVersion expansionVersion)
|
||||||
|
{
|
||||||
|
return expansionVersion switch
|
||||||
|
{
|
||||||
|
EExpansionVersion.ARealmReborn => new Vector4(0.7f, 0.7f, 0.7f, 1f),
|
||||||
|
EExpansionVersion.Heavensward => new Vector4(0.4f, 0.6f, 0.9f, 1f),
|
||||||
|
EExpansionVersion.Stormblood => new Vector4(0.9f, 0.3f, 0.3f, 1f),
|
||||||
|
EExpansionVersion.Shadowbringers => new Vector4(0.5f, 0.4f, 0.7f, 1f),
|
||||||
|
EExpansionVersion.Endwalker => new Vector4(0.8f, 0.8f, 0.4f, 1f),
|
||||||
|
EExpansionVersion.Dawntrail => new Vector4(0.3f, 0.8f, 0.5f, 1f),
|
||||||
|
_ => new Vector4(0.5f, 0.5f, 0.5f, 1f),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,18 +261,59 @@ internal sealed class QuestJournalComponent
|
||||||
_questRegistry.TryGetQuest(questInfo.QuestId, out Quest quest);
|
_questRegistry.TryGetQuest(questInfo.QuestId, out Quest quest);
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
DrawQuestName(questInfo, out var expansionHovered);
|
||||||
|
DrawQuestTooltipAndContextMenu(questInfo, quest, expansionHovered);
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
DrawQuestSupportStatus(questInfo, quest);
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
DrawQuestCompletionStatus(questInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void DrawQuestName(IQuestInfo questInfo, out bool expansionHovered)
|
||||||
|
{
|
||||||
|
expansionHovered = false;
|
||||||
|
if (questInfo.Expansion != (EExpansionVersion)255)
|
||||||
|
{
|
||||||
|
ImGui.PushFont(UiBuilder.MonoFont);
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Text, questInfo.Expansion.GetExpansionColor());
|
||||||
|
ImGui.TextUnformatted(questInfo.Expansion.ToAbbreviation().PadRight(3));
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
ImGui.PopFont();
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
|
{
|
||||||
|
expansionHovered = true;
|
||||||
|
}
|
||||||
|
ImGui.SameLine();
|
||||||
|
}
|
||||||
ImU8String id = new ImU8String(3, 2);
|
ImU8String id = new ImU8String(3, 2);
|
||||||
id.AppendFormatted(questInfo.Name);
|
id.AppendFormatted(questInfo.Name);
|
||||||
id.AppendLiteral(" (");
|
id.AppendLiteral(" (");
|
||||||
id.AppendFormatted(questInfo.QuestId);
|
id.AppendFormatted(questInfo.QuestId);
|
||||||
id.AppendLiteral(")");
|
id.AppendLiteral(")");
|
||||||
ImGui.TreeNodeEx(id, ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.SpanFullWidth);
|
ImGui.TreeNodeEx(id, ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.SpanFullWidth);
|
||||||
if (ImGui.IsItemHovered())
|
}
|
||||||
|
|
||||||
|
private void DrawQuestTooltipAndContextMenu(IQuestInfo questInfo, Quest? quest, bool expansionHovered)
|
||||||
|
{
|
||||||
|
if ((ImGui.IsItemHovered() || expansionHovered) && questInfo.Expansion != (EExpansionVersion)255)
|
||||||
|
{
|
||||||
|
ImGui.BeginTooltip();
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Text, questInfo.Expansion.GetExpansionColor());
|
||||||
|
ImGui.TextUnformatted(questInfo.Expansion.ToFriendlyString());
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
ImGui.Separator();
|
||||||
|
_questTooltipComponent.Draw(questInfo);
|
||||||
|
ImGui.EndTooltip();
|
||||||
|
}
|
||||||
|
else if (ImGui.IsItemHovered() && questInfo.Expansion == (EExpansionVersion)255)
|
||||||
{
|
{
|
||||||
_questTooltipComponent.Draw(questInfo);
|
_questTooltipComponent.Draw(questInfo);
|
||||||
}
|
}
|
||||||
_questJournalUtils.ShowContextMenu(questInfo, quest, "QuestJournalComponent");
|
_questJournalUtils.ShowContextMenu(questInfo, quest, "QuestJournalComponent");
|
||||||
ImGui.TableNextColumn();
|
}
|
||||||
|
|
||||||
|
private void DrawQuestSupportStatus(IQuestInfo questInfo, Quest? quest)
|
||||||
|
{
|
||||||
float num;
|
float num;
|
||||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||||
{
|
{
|
||||||
|
@ -282,80 +323,78 @@ internal sealed class QuestJournalComponent
|
||||||
if (_questFunctions.IsQuestRemoved(questInfo.QuestId))
|
if (_questFunctions.IsQuestRemoved(questInfo.QuestId))
|
||||||
{
|
{
|
||||||
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
|
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (quest != null)
|
|
||||||
{
|
|
||||||
QuestRoot root = quest.Root;
|
|
||||||
if (root != null && !root.Disabled)
|
|
||||||
{
|
|
||||||
List<ValidationIssue> issues = _questValidator.GetIssues(quest.Id);
|
|
||||||
if (issues.Any((ValidationIssue x) => x.Severity == EIssueSeverity.Error))
|
|
||||||
{
|
|
||||||
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.DalamudRed, FontAwesomeIcon.ExclamationTriangle);
|
|
||||||
}
|
|
||||||
else if (issues.Count > 0)
|
|
||||||
{
|
|
||||||
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.ParsedBlue, FontAwesomeIcon.InfoCircle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_uiUtils.ChecklistItem(string.Empty, complete: true);
|
|
||||||
}
|
|
||||||
goto IL_0210;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_uiUtils.ChecklistItem(string.Empty, complete: false);
|
|
||||||
}
|
|
||||||
goto IL_0210;
|
|
||||||
IL_0210:
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
if (_questFunctions.IsQuestAccepted(questInfo.QuestId))
|
|
||||||
{
|
|
||||||
_uiUtils.ChecklistItem("Active", ImGuiColors.DalamudYellow, FontAwesomeIcon.PersonWalkingArrowRight);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_questFunctions.IsQuestComplete(questInfo.QuestId))
|
if (quest != null)
|
||||||
{
|
{
|
||||||
if (questInfo.IsRepeatable)
|
QuestRoot root = quest.Root;
|
||||||
|
if (root != null && !root.Disabled)
|
||||||
{
|
{
|
||||||
bool num2 = _questFunctions.IsQuestLocked(questInfo.QuestId);
|
List<ValidationIssue> issues = _questValidator.GetIssues(quest.Id);
|
||||||
bool flag = _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId);
|
if (issues.Any((ValidationIssue x) => x.Severity == EIssueSeverity.Error))
|
||||||
if (!num2 && flag)
|
|
||||||
{
|
{
|
||||||
_uiUtils.ChecklistItem("Available", ImGuiColors.ParsedBlue, FontAwesomeIcon.Running);
|
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.DalamudRed, FontAwesomeIcon.ExclamationTriangle);
|
||||||
|
}
|
||||||
|
else if (issues.Count > 0)
|
||||||
|
{
|
||||||
|
_uiUtils.ChecklistItem(string.Empty, ImGuiColors.ParsedBlue, FontAwesomeIcon.InfoCircle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_uiUtils.ChecklistItem("Complete", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check);
|
_uiUtils.ChecklistItem(string.Empty, complete: true);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
_uiUtils.ChecklistItem(string.Empty, complete: false);
|
||||||
_uiUtils.ChecklistItem("Complete", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check);
|
}
|
||||||
}
|
|
||||||
|
private void DrawQuestCompletionStatus(IQuestInfo questInfo)
|
||||||
|
{
|
||||||
|
if (_questFunctions.IsQuestAccepted(questInfo.QuestId))
|
||||||
|
{
|
||||||
|
_uiUtils.ChecklistItem("Active", ImGuiColors.DalamudYellow, FontAwesomeIcon.PersonWalkingArrowRight);
|
||||||
|
}
|
||||||
|
else if (_questFunctions.IsQuestComplete(questInfo.QuestId))
|
||||||
|
{
|
||||||
|
DrawCompletedQuestStatus(questInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawIncompleteQuestStatus(questInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawCompletedQuestStatus(IQuestInfo questInfo)
|
||||||
|
{
|
||||||
|
if (!questInfo.IsRepeatable)
|
||||||
|
{
|
||||||
|
_uiUtils.ChecklistItem("Complete", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool flag2 = false;
|
bool num = _questFunctions.IsQuestLocked(questInfo.QuestId);
|
||||||
bool flag3 = _questFunctions.IsQuestUnobtainable(questInfo.QuestId);
|
bool flag = _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId);
|
||||||
bool flag4 = _questFunctions.IsQuestLocked(questInfo.QuestId);
|
if (!num && flag)
|
||||||
bool flag5 = _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId);
|
|
||||||
DateTime? seasonalQuestExpiry = questInfo.SeasonalQuestExpiry;
|
|
||||||
if (seasonalQuestExpiry.HasValue)
|
|
||||||
{
|
{
|
||||||
DateTime valueOrDefault = seasonalQuestExpiry.GetValueOrDefault();
|
_uiUtils.ChecklistItem("Available", ImGuiColors.ParsedBlue, FontAwesomeIcon.Running);
|
||||||
DateTime dateTime = ((valueOrDefault.Kind == DateTimeKind.Utc) ? valueOrDefault : valueOrDefault.ToUniversalTime());
|
|
||||||
if (DateTime.UtcNow > dateTime)
|
|
||||||
{
|
|
||||||
flag2 = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (flag2 || flag3)
|
else
|
||||||
|
{
|
||||||
|
_uiUtils.ChecklistItem("Complete", ImGuiColors.ParsedGreen, FontAwesomeIcon.Check);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawIncompleteQuestStatus(IQuestInfo questInfo)
|
||||||
|
{
|
||||||
|
bool num = IsQuestExpired(questInfo);
|
||||||
|
bool flag = _questFunctions.IsQuestUnobtainable(questInfo.QuestId);
|
||||||
|
bool flag2 = _questFunctions.IsQuestLocked(questInfo.QuestId);
|
||||||
|
bool flag3 = _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId);
|
||||||
|
if (num || flag)
|
||||||
{
|
{
|
||||||
_uiUtils.ChecklistItem("Unobtainable", ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
|
_uiUtils.ChecklistItem("Unobtainable", ImGuiColors.DalamudGrey, FontAwesomeIcon.Minus);
|
||||||
}
|
}
|
||||||
else if (flag4 || !flag5 || !_questRegistry.IsKnownQuest(questInfo.QuestId))
|
else if (flag2 || !flag3 || !_questRegistry.IsKnownQuest(questInfo.QuestId))
|
||||||
{
|
{
|
||||||
_uiUtils.ChecklistItem("Locked", ImGuiColors.DalamudRed, FontAwesomeIcon.Times);
|
_uiUtils.ChecklistItem("Locked", ImGuiColors.DalamudRed, FontAwesomeIcon.Times);
|
||||||
}
|
}
|
||||||
|
@ -365,6 +404,18 @@ internal sealed class QuestJournalComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsQuestExpired(IQuestInfo questInfo)
|
||||||
|
{
|
||||||
|
DateTime? seasonalQuestExpiry = questInfo.SeasonalQuestExpiry;
|
||||||
|
if (seasonalQuestExpiry.HasValue)
|
||||||
|
{
|
||||||
|
DateTime valueOrDefault = seasonalQuestExpiry.GetValueOrDefault();
|
||||||
|
DateTime dateTime = ((valueOrDefault.Kind == DateTimeKind.Utc) ? valueOrDefault : valueOrDefault.ToUniversalTime());
|
||||||
|
return DateTime.UtcNow > dateTime;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static void DrawCount(int count, int total)
|
private static void DrawCount(int count, int total)
|
||||||
{
|
{
|
||||||
string text = 9999.ToString(CultureInfo.CurrentCulture);
|
string text = 9999.ToString(CultureInfo.CurrentCulture);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue