punish v6.8.18.0
This commit is contained in:
commit
e786325cda
322 changed files with 554232 additions and 0 deletions
94
Questionable/Questionable.Windows/UiUtils.cs
Normal file
94
Questionable/Questionable.Windows/UiUtils.cs
Normal file
|
@ -0,0 +1,94 @@
|
|||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Plugin;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Windows;
|
||||
|
||||
internal sealed class UiUtils
|
||||
{
|
||||
private readonly QuestFunctions _questFunctions;
|
||||
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
public UiUtils(QuestFunctions questFunctions, IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
_questFunctions = questFunctions;
|
||||
_pluginInterface = pluginInterface;
|
||||
}
|
||||
|
||||
public (Vector4 Color, FontAwesomeIcon Icon, string Status) GetQuestStyle(ElementId elementId)
|
||||
{
|
||||
if (_questFunctions.IsQuestAccepted(elementId))
|
||||
{
|
||||
return (Color: ImGuiColors.DalamudYellow, Icon: FontAwesomeIcon.PersonWalkingArrowRight, Status: "Active");
|
||||
}
|
||||
if (elementId is QuestId questId && _questFunctions.IsDailyAlliedSocietyQuestAndAvailableToday(questId))
|
||||
{
|
||||
if (!_questFunctions.IsReadyToAcceptQuest(questId))
|
||||
{
|
||||
return (Color: ImGuiColors.ParsedGreen, Icon: FontAwesomeIcon.Check, Status: "Complete");
|
||||
}
|
||||
if (_questFunctions.IsQuestComplete(questId))
|
||||
{
|
||||
return (Color: ImGuiColors.ParsedBlue, Icon: FontAwesomeIcon.Running, Status: "Available (Complete)");
|
||||
}
|
||||
return (Color: ImGuiColors.DalamudYellow, Icon: FontAwesomeIcon.Running, Status: "Available");
|
||||
}
|
||||
if (_questFunctions.IsQuestAcceptedOrComplete(elementId))
|
||||
{
|
||||
return (Color: ImGuiColors.ParsedGreen, Icon: FontAwesomeIcon.Check, Status: "Complete");
|
||||
}
|
||||
if (_questFunctions.IsQuestUnobtainable(elementId))
|
||||
{
|
||||
return (Color: ImGuiColors.DalamudGrey, Icon: FontAwesomeIcon.Minus, Status: "Unobtainable");
|
||||
}
|
||||
if (_questFunctions.IsQuestLocked(elementId))
|
||||
{
|
||||
return (Color: ImGuiColors.DalamudRed, Icon: FontAwesomeIcon.Times, Status: "Locked");
|
||||
}
|
||||
return (Color: ImGuiColors.DalamudYellow, Icon: FontAwesomeIcon.Running, Status: "Available");
|
||||
}
|
||||
|
||||
public static (Vector4 color, FontAwesomeIcon icon) GetInstanceStyle(ushort instanceId)
|
||||
{
|
||||
if (UIState.IsInstanceContentCompleted(instanceId))
|
||||
{
|
||||
return (color: ImGuiColors.ParsedGreen, icon: FontAwesomeIcon.Check);
|
||||
}
|
||||
if (UIState.IsInstanceContentUnlocked(instanceId))
|
||||
{
|
||||
return (color: ImGuiColors.DalamudYellow, icon: FontAwesomeIcon.Running);
|
||||
}
|
||||
return (color: ImGuiColors.DalamudRed, icon: FontAwesomeIcon.Times);
|
||||
}
|
||||
|
||||
public bool ChecklistItem(string text, Vector4 color, FontAwesomeIcon icon, float extraPadding = 0f)
|
||||
{
|
||||
if (extraPadding > 0f)
|
||||
{
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + extraPadding);
|
||||
}
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
ImGui.TextColored(in color, icon.ToIconString());
|
||||
}
|
||||
bool num = ImGui.IsItemHovered();
|
||||
ImGui.SameLine();
|
||||
if (extraPadding > 0f)
|
||||
{
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + extraPadding);
|
||||
}
|
||||
ImGui.TextUnformatted(text);
|
||||
return num | ImGui.IsItemHovered();
|
||||
}
|
||||
|
||||
public bool ChecklistItem(string text, bool complete, Vector4? colorOverride = null)
|
||||
{
|
||||
return ChecklistItem(text, colorOverride ?? (complete ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed), complete ? FontAwesomeIcon.Check : FontAwesomeIcon.Times);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue