punish v6.8.18.0
This commit is contained in:
commit
060278c1b7
317 changed files with 554155 additions and 0 deletions
|
@ -0,0 +1,174 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Questionable.Controller;
|
||||
|
||||
namespace Questionable.Windows.QuestComponents;
|
||||
|
||||
internal sealed class QuickAccessButtonsComponent
|
||||
{
|
||||
private readonly QuestRegistry _questRegistry;
|
||||
|
||||
private readonly QuestValidationWindow _questValidationWindow;
|
||||
|
||||
private readonly JournalProgressWindow _journalProgressWindow;
|
||||
|
||||
private readonly PriorityWindow _priorityWindow;
|
||||
|
||||
private readonly ICommandManager _commandManager;
|
||||
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
public event EventHandler? Reload;
|
||||
|
||||
public QuickAccessButtonsComponent(QuestRegistry questRegistry, QuestValidationWindow questValidationWindow, JournalProgressWindow journalProgressWindow, PriorityWindow priorityWindow, ICommandManager commandManager, IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
_questRegistry = questRegistry;
|
||||
_questValidationWindow = questValidationWindow;
|
||||
_journalProgressWindow = journalProgressWindow;
|
||||
_priorityWindow = priorityWindow;
|
||||
_commandManager = commandManager;
|
||||
_pluginInterface = pluginInterface;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
DrawQuestPriorityButton();
|
||||
ImGui.SameLine();
|
||||
DrawRebuildNavmeshButton();
|
||||
DrawReloadDataButton();
|
||||
ImGui.SameLine();
|
||||
DrawJournalProgressButton();
|
||||
if (_questRegistry.ValidationIssueCount > 0)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
DrawValidationIssuesButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawQuestPriorityButton()
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Exclamation, "Priority Quests"))
|
||||
{
|
||||
_priorityWindow.ToggleOrUncollapse();
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip("Configure priority quests which will be done as soon as possible.");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawRebuildNavmeshButton()
|
||||
{
|
||||
bool flag = _commandManager.Commands.ContainsKey("/vnav");
|
||||
using (ImRaii.Disabled(!flag || !ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
|
||||
{
|
||||
_commandManager.ProcessCommand("/vnav rebuild");
|
||||
}
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
ImGui.SetTooltip("vnavmesh is not available.\nPlease install it first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.SetTooltip("Hold CTRL to enable this button.\nRebuilding the navmesh will take some time.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawReloadDataButton()
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.RedoAlt, "Reload Data"))
|
||||
{
|
||||
this.Reload?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawJournalProgressButton()
|
||||
{
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.BookBookmark))
|
||||
{
|
||||
_journalProgressWindow.IsOpenAndUncollapsed = true;
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip("Journal Progress");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawValidationIssuesButton()
|
||||
{
|
||||
int validationErrorCount = _questRegistry.ValidationErrorCount;
|
||||
int num = _questRegistry.ValidationIssueCount - _questRegistry.ValidationErrorCount;
|
||||
if (validationErrorCount == 0 && num == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num2 = ((validationErrorCount == 0 || num == 0) ? 1 : 2);
|
||||
using (ImRaii.PushId("validationissues"))
|
||||
{
|
||||
FontAwesomeIcon icon = FontAwesomeIcon.ExclamationTriangle;
|
||||
FontAwesomeIcon icon2 = FontAwesomeIcon.InfoCircle;
|
||||
Vector2 vector;
|
||||
Vector2 vector2;
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
vector = ((validationErrorCount > 0) ? ImGui.CalcTextSize(icon.ToIconString()) : Vector2.Zero);
|
||||
vector2 = ((num > 0) ? ImGui.CalcTextSize(icon2.ToIconString()) : Vector2.Zero);
|
||||
}
|
||||
string text = ((validationErrorCount > 0) ? validationErrorCount.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
string text2 = ((num > 0) ? num.ToString(CultureInfo.InvariantCulture) : string.Empty);
|
||||
Vector2 vector3 = ((validationErrorCount > 0) ? ImGui.CalcTextSize(text) : Vector2.Zero);
|
||||
Vector2 vector4 = ((num > 0) ? ImGui.CalcTextSize(text2) : Vector2.Zero);
|
||||
ImDrawListPtr windowDrawList = ImGui.GetWindowDrawList();
|
||||
Vector2 cursorScreenPos = ImGui.GetCursorScreenPos();
|
||||
float num3 = 3f * ImGuiHelpers.GlobalScale;
|
||||
float x = vector.X + vector2.X + vector3.X + vector4.X + ImGui.GetStyle().FramePadding.X * 2f + num3 * 2f * (float)num2;
|
||||
float frameHeight = ImGui.GetFrameHeight();
|
||||
bool flag = ImGui.Button(string.Empty, new Vector2(x, frameHeight));
|
||||
Vector2 vector5 = new Vector2(cursorScreenPos.X + ImGui.GetStyle().FramePadding.X, cursorScreenPos.Y + ImGui.GetStyle().FramePadding.Y);
|
||||
if (validationErrorCount > 0)
|
||||
{
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
windowDrawList.AddText(vector5, ImGui.GetColorU32(ImGuiColors.DalamudRed), icon.ToIconString());
|
||||
}
|
||||
Vector2 vector6 = vector5;
|
||||
vector6.X = vector5.X + vector.X + num3;
|
||||
vector5 = vector6;
|
||||
windowDrawList.AddText(vector5, ImGui.GetColorU32(ImGuiCol.Text), text);
|
||||
vector6 = vector5;
|
||||
vector6.X = vector5.X + vector3.X + 2f * num3;
|
||||
vector5 = vector6;
|
||||
}
|
||||
if (num > 0)
|
||||
{
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
windowDrawList.AddText(vector5, ImGui.GetColorU32(ImGuiColors.ParsedBlue), icon2.ToIconString());
|
||||
}
|
||||
Vector2 vector6 = vector5;
|
||||
vector6.X = vector5.X + vector2.X + num3;
|
||||
vector5 = vector6;
|
||||
windowDrawList.AddText(vector5, ImGui.GetColorU32(ImGuiCol.Text), text2);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
_questValidationWindow.IsOpenAndUncollapsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue