147 lines
4.7 KiB
C#
147 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Numerics;
|
|
using System.Text;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Dalamud.Interface.Windowing;
|
|
using Dalamud.Plugin;
|
|
using Dalamud.Plugin.Services;
|
|
using LLib.ImGui;
|
|
using Questionable.Controller;
|
|
using Questionable.Functions;
|
|
using Questionable.Model.Questing;
|
|
using Questionable.Windows.QuestComponents;
|
|
using Questionable.Windows.Utils;
|
|
|
|
namespace Questionable.Windows;
|
|
|
|
internal sealed class PriorityWindow : LWindow
|
|
{
|
|
public const string ClipboardPrefix = "qst:priority:";
|
|
|
|
public const string LegacyClipboardPrefix = "qst:v1:";
|
|
|
|
public const char ClipboardSeparator = ';';
|
|
|
|
private readonly ManualPriorityComponent _manualPriorityComponent;
|
|
|
|
private readonly PresetBuilderComponent _presetBuilderComponent;
|
|
|
|
private readonly SavedPresetsComponent _savedPresetsComponent;
|
|
|
|
public PriorityWindow(QuestController questController, QuestFunctions questFunctions, QuestSelector questSelector, QuestTooltipComponent questTooltipComponent, PresetBuilderComponent presetBuilderComponent, SavedPresetsComponent savedPresetsComponent, UiUtils uiUtils, IChatGui chatGui, IDalamudPluginInterface pluginInterface)
|
|
: base("Quest Priority###QuestionableQuestPriority")
|
|
{
|
|
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
|
|
_manualPriorityComponent = new ManualPriorityComponent(questController, questFunctions, questSelector, questTooltipComponent, uiUtils, chatGui, pluginInterface);
|
|
_presetBuilderComponent = presetBuilderComponent;
|
|
_savedPresetsComponent = savedPresetsComponent;
|
|
base.Size = new Vector2(500f, 500f);
|
|
base.SizeCondition = ImGuiCond.Once;
|
|
WindowSizeConstraints value = default(WindowSizeConstraints);
|
|
((WindowSizeConstraints)(ref value))._002Ector();
|
|
((WindowSizeConstraints)(ref value)).MinimumSize = new Vector2(615f, 500f);
|
|
((WindowSizeConstraints)(ref value)).MaximumSize = new Vector2(800f, 1000f);
|
|
((Window)this).SizeConstraints = value;
|
|
}
|
|
|
|
public override void DrawContent()
|
|
{
|
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
|
|
TabBarDisposable val = ImRaii.TabBar((ImU8String)"PriorityTabs");
|
|
try
|
|
{
|
|
if (!val)
|
|
{
|
|
return;
|
|
}
|
|
TabItemDisposable val2 = ImRaii.TabItem((ImU8String)"Manual Priority");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val2))
|
|
{
|
|
_manualPriorityComponent.Draw();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val2)).Dispose();
|
|
}
|
|
TabItemDisposable val3 = ImRaii.TabItem((ImU8String)"Quest Presets");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val3))
|
|
{
|
|
_presetBuilderComponent.Draw();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val3)).Dispose();
|
|
}
|
|
TabItemDisposable val4 = ImRaii.TabItem((ImU8String)"Saved Presets");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val4))
|
|
{
|
|
_savedPresetsComponent.Draw();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val4)).Dispose();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabBarDisposable)(ref val)).Dispose();
|
|
}
|
|
}
|
|
|
|
public static List<ElementId> DecodeQuestPriority(string clipboardText)
|
|
{
|
|
List<ElementId> list = new List<ElementId>();
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(clipboardText))
|
|
{
|
|
string text = null;
|
|
if (clipboardText.StartsWith("qst:priority:", StringComparison.InvariantCulture))
|
|
{
|
|
text = "qst:priority:";
|
|
}
|
|
else if (clipboardText.StartsWith("qst:v1:", StringComparison.InvariantCulture))
|
|
{
|
|
text = "qst:v1:";
|
|
}
|
|
if (text != null)
|
|
{
|
|
clipboardText = clipboardText.Substring(text.Length);
|
|
string[] array = Encoding.UTF8.GetString(Convert.FromBase64String(clipboardText)).Split(';');
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
ElementId item = ElementId.FromString(array[i]);
|
|
list.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
list.Clear();
|
|
}
|
|
return list;
|
|
}
|
|
}
|