643 lines
24 KiB
C#
643 lines
24 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using System.Text;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface;
|
|
using Dalamud.Interface.Colors;
|
|
using Dalamud.Interface.Components;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Dalamud.Plugin;
|
|
using Dalamud.Plugin.Services;
|
|
using Dalamud.Utility;
|
|
using Lumina.Excel.Sheets;
|
|
using Questionable.Controller;
|
|
using Questionable.Data;
|
|
using Questionable.External;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Windows.ConfigComponents;
|
|
|
|
internal sealed class DutyConfigComponent : ConfigComponent
|
|
{
|
|
private sealed record DutyInfo(uint CfcId, uint TerritoryId, string Name);
|
|
|
|
private const string DutyClipboardPrefix = "qst:duty:";
|
|
|
|
private const string ModePrefix = "M:";
|
|
|
|
private static readonly string[] DutyModeLabels = new string[3] { "Duty Support", "Unsync (Solo)", "Unsync (Party)" };
|
|
|
|
private readonly QuestRegistry _questRegistry;
|
|
|
|
private readonly AutoDutyIpc _autoDutyIpc;
|
|
|
|
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _contentFinderConditionNames;
|
|
|
|
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _allTrialNames;
|
|
|
|
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _allNormalRaidNames;
|
|
|
|
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _allAllianceRaidNames;
|
|
|
|
public DutyConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration, IDataManager dataManager, QuestRegistry questRegistry, AutoDutyIpc autoDutyIpc, TerritoryData territoryData)
|
|
: base(pluginInterface, configuration)
|
|
{
|
|
_questRegistry = questRegistry;
|
|
_autoDutyIpc = autoDutyIpc;
|
|
_contentFinderConditionNames = (from x in dataManager.GetExcelSheet<ContentFinderCondition>()
|
|
where x.RowId != 0 && x.Content.RowId != 0 && x.ContentType.RowId == 2
|
|
select new
|
|
{
|
|
Expansion = (EExpansionVersion)x.TerritoryType.Value.ExVersion.RowId,
|
|
CfcId = x.RowId,
|
|
Name = (territoryData.GetContentFinderCondition(x.RowId)?.Name ?? x.Name.ToDalamudString().ToString()),
|
|
TerritoryId = x.TerritoryType.RowId,
|
|
Level = x.ClassJobLevelRequired,
|
|
SortKey = x.SortKey
|
|
} into x
|
|
orderby x.SortKey
|
|
group x by x.Expansion).ToDictionary(x => x.Key, x => x.Select(y => new DutyInfo(y.CfcId, y.TerritoryId, ConfigComponent.FormatLevel(y.Level) + " " + y.Name)).ToList());
|
|
_allTrialNames = (from x in dataManager.GetExcelSheet<ContentFinderCondition>()
|
|
where x.RowId != 0 && x.Content.RowId != 0 && x.ContentType.RowId == 4
|
|
select new
|
|
{
|
|
Expansion = (EExpansionVersion)x.TerritoryType.Value.ExVersion.RowId,
|
|
CfcId = x.RowId,
|
|
Name = (territoryData.GetContentFinderCondition(x.RowId)?.Name ?? x.Name.ToDalamudString().ToString()),
|
|
TerritoryId = x.TerritoryType.RowId,
|
|
Level = x.ClassJobLevelRequired,
|
|
SortKey = x.SortKey
|
|
} into x
|
|
orderby x.SortKey
|
|
group x by x.Expansion).ToDictionary(x => x.Key, x => x.Select(y => new DutyInfo(y.CfcId, y.TerritoryId, ConfigComponent.FormatLevel(y.Level) + " " + y.Name)).ToList());
|
|
_allNormalRaidNames = (from x in dataManager.GetExcelSheet<ContentFinderCondition>()
|
|
where x.RowId != 0 && x.Content.RowId != 0 && x.ContentType.RowId == 5
|
|
where x.ContentMemberType.RowId == 3
|
|
select new
|
|
{
|
|
Expansion = (EExpansionVersion)x.TerritoryType.Value.ExVersion.RowId,
|
|
CfcId = x.RowId,
|
|
Name = (territoryData.GetContentFinderCondition(x.RowId)?.Name ?? x.Name.ToDalamudString().ToString()),
|
|
TerritoryId = x.TerritoryType.RowId,
|
|
Level = x.ClassJobLevelRequired,
|
|
SortKey = x.SortKey
|
|
} into x
|
|
orderby x.SortKey
|
|
group x by x.Expansion).ToDictionary(x => x.Key, x => x.Select(y => new DutyInfo(y.CfcId, y.TerritoryId, ConfigComponent.FormatLevel(y.Level) + " " + y.Name)).ToList());
|
|
_allAllianceRaidNames = (from x in dataManager.GetExcelSheet<ContentFinderCondition>()
|
|
where x.RowId != 0 && x.Content.RowId != 0 && x.ContentType.RowId == 5
|
|
where x.ContentMemberType.RowId == 4
|
|
select new
|
|
{
|
|
Expansion = (EExpansionVersion)x.TerritoryType.Value.ExVersion.RowId,
|
|
CfcId = x.RowId,
|
|
Name = (territoryData.GetContentFinderCondition(x.RowId)?.Name ?? x.Name.ToDalamudString().ToString()),
|
|
TerritoryId = x.TerritoryType.RowId,
|
|
Level = x.ClassJobLevelRequired,
|
|
SortKey = x.SortKey
|
|
} into x
|
|
orderby x.SortKey
|
|
group x by x.Expansion).ToDictionary(x => x.Key, x => x.Select(y => new DutyInfo(y.CfcId, y.TerritoryId, ConfigComponent.FormatLevel(y.Level) + " " + y.Name)).ToList());
|
|
}
|
|
|
|
public override void DrawTab()
|
|
{
|
|
//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_0260: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
|
|
TabItemDisposable val = ImRaii.TabItem((ImU8String)"Duties###Duties");
|
|
try
|
|
{
|
|
if (!val)
|
|
{
|
|
return;
|
|
}
|
|
bool v = base.Configuration.Duties.RunInstancedContentWithAutoDuty;
|
|
if (ImGui.Checkbox("Run instanced content with AutoDuty and BossMod", ref v))
|
|
{
|
|
base.Configuration.Duties.RunInstancedContentWithAutoDuty = v;
|
|
Save();
|
|
}
|
|
ImGui.SameLine();
|
|
ImGuiComponents.HelpMarker("The combat module used for this is configured by AutoDuty, ignoring whichever selection you've made in Questionable's \"General\" configuration.");
|
|
DisabledDisposable val2 = ImRaii.Disabled(!v);
|
|
try
|
|
{
|
|
IndentDisposable val3 = ImRaii.PushIndent(ImGui.GetFrameHeight() + ImGui.GetStyle().ItemInnerSpacing.X, true, true);
|
|
try
|
|
{
|
|
ColorDisposable val4 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
|
try
|
|
{
|
|
ImGui.TextUnformatted("Work in Progress:");
|
|
ImGui.BulletText("Duty Support mode is limited.");
|
|
ImGui.BulletText("Unsynced modes require being significantly overleveled or having a high-level party member.");
|
|
ImGui.BulletText("Most players will need to use Duty Support mode when progressing normally through the game.");
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val4)?.Dispose();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val3)?.Dispose();
|
|
}
|
|
ImGui.Spacing();
|
|
bool v2 = base.Configuration.Duties.RunLevelingModeWhenUnderleveled;
|
|
if (ImGui.Checkbox("Run AutoDuty Leveling mode when underleveled for MSQ", ref v2))
|
|
{
|
|
base.Configuration.Duties.RunLevelingModeWhenUnderleveled = v2;
|
|
Save();
|
|
}
|
|
ImGui.SameLine();
|
|
ImGuiComponents.HelpMarker("When enabled, Questionable will automatically run AutoDuty's Leveling mode when your character is underleveled for the next Main Scenario Quest.\n\nLeveling mode runs the highest available dungeon for your level to gain XP.\n\nThis is useful for characters without the Road to 90 XP buff who may not have enough XP to continue the MSQ.");
|
|
ImGui.Spacing();
|
|
ImGui.Text("Default duty mode:");
|
|
ImGui.SameLine();
|
|
int currentItem = (int)base.Configuration.Duties.DefaultDutyMode;
|
|
ImGui.SetNextItemWidth(200f);
|
|
if (ImGui.Combo((ImU8String)"##DefaultDutyMode", ref currentItem, (ReadOnlySpan<string>)DutyModeLabels, DutyModeLabels.Length))
|
|
{
|
|
base.Configuration.Duties.DefaultDutyMode = (EDutyMode)currentItem;
|
|
Save();
|
|
}
|
|
ImGui.SameLine();
|
|
ImGuiComponents.HelpMarker("\ufffd Duty Support: Run with NPC party members (level synced)\n\ufffd Unsync (Solo): Run alone at your current level (unsynced)\n\ufffd Unsync (Party): Run with your party at current level (unsynced)\n\nYou can override this setting for individual duties below.");
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val2)?.Dispose();
|
|
}
|
|
ImGui.Separator();
|
|
val2 = ImRaii.Disabled(!v);
|
|
try
|
|
{
|
|
ImGui.Text("Questionable includes a default list of duties that work if AutoDuty and BossMod are installed.");
|
|
ImGui.Text("The included list of duties can change with each update, and is based on the following spreadsheet:");
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Open AutoDuty spreadsheet"))
|
|
{
|
|
Util.OpenLink("https://docs.google.com/spreadsheets/d/151RlpqRcCpiD_VbQn6Duf-u-S71EP7d0mx3j1PDNoNA/edit?pli=1#gid=0");
|
|
}
|
|
ImGui.Separator();
|
|
ImGui.Text("You can override the settings for each individual duty:");
|
|
TabBarDisposable val5 = ImRaii.TabBar((ImU8String)"DutyTypeTabs");
|
|
try
|
|
{
|
|
if (TabBarDisposable.op_Implicit(val5))
|
|
{
|
|
TabItemDisposable val6 = ImRaii.TabItem((ImU8String)"Dungeons");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val6))
|
|
{
|
|
DrawConfigTable(v, _contentFinderConditionNames);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val6)).Dispose();
|
|
}
|
|
TabItemDisposable val7 = ImRaii.TabItem((ImU8String)"Trials");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val7))
|
|
{
|
|
DrawConfigTable(v, _allTrialNames);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val7)).Dispose();
|
|
}
|
|
TabItemDisposable val8 = ImRaii.TabItem((ImU8String)"Normal Raids");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val8))
|
|
{
|
|
DrawConfigTable(v, _allNormalRaidNames);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val8)).Dispose();
|
|
}
|
|
TabItemDisposable val9 = ImRaii.TabItem((ImU8String)"Alliance Raids");
|
|
try
|
|
{
|
|
if (TabItemDisposable.op_Implicit(val9))
|
|
{
|
|
DrawConfigTable(v, _allAllianceRaidNames);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val9)).Dispose();
|
|
}
|
|
}
|
|
DrawEnableAllButton();
|
|
ImGui.SameLine();
|
|
DrawClipboardButtons();
|
|
ImGui.SameLine();
|
|
DrawResetButton();
|
|
}
|
|
finally
|
|
{
|
|
((TabBarDisposable)(ref val5)).Dispose();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val2)?.Dispose();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TabItemDisposable)(ref val)).Dispose();
|
|
}
|
|
}
|
|
|
|
private void DrawConfigTable(bool runInstancedContentWithAutoDuty, Dictionary<EExpansionVersion, List<DutyInfo>> contentByExpansion)
|
|
{
|
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
|
|
ChildDisposable val = ImRaii.Child((ImU8String)"DutyConfiguration", new Vector2(725f, 400f), true);
|
|
try
|
|
{
|
|
if (!val)
|
|
{
|
|
return;
|
|
}
|
|
EExpansionVersion[] values = Enum.GetValues<EExpansionVersion>();
|
|
for (int i = 0; i < values.Length; i++)
|
|
{
|
|
EExpansionVersion eExpansionVersion = values[i];
|
|
(int enabledCount, int totalCount) dutyCountsForExpansion = GetDutyCountsForExpansion(eExpansionVersion, contentByExpansion);
|
|
int item = dutyCountsForExpansion.enabledCount;
|
|
int item2 = dutyCountsForExpansion.totalCount;
|
|
string obj = ((item2 > 0) ? $"{eExpansionVersion.ToFriendlyString()} ({item}/{item2})" : eExpansionVersion.ToFriendlyString());
|
|
string key = eExpansionVersion.ToString();
|
|
ImGui.SetNextItemOpen(base.Configuration.Duties.ExpansionHeaderStates.GetValueOrDefault(key, defaultValue: false), ImGuiCond.Always);
|
|
if (ImGui.CollapsingHeader(obj))
|
|
{
|
|
if (!base.Configuration.Duties.ExpansionHeaderStates.GetValueOrDefault(key, defaultValue: false))
|
|
{
|
|
base.Configuration.Duties.ExpansionHeaderStates[key] = true;
|
|
Save();
|
|
}
|
|
ImU8String imU8String = new ImU8String(6, 1);
|
|
imU8String.AppendLiteral("Duties");
|
|
imU8String.AppendFormatted(eExpansionVersion);
|
|
TableDisposable val2 = ImRaii.Table(imU8String, 3, ImGuiTableFlags.SizingFixedFit);
|
|
try
|
|
{
|
|
if (!TableDisposable.op_Implicit(val2))
|
|
{
|
|
continue;
|
|
}
|
|
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
|
|
ImGui.TableSetupColumn("Enabled", ImGuiTableColumnFlags.WidthFixed, 200f);
|
|
ImGui.TableSetupColumn("Mode", ImGuiTableColumnFlags.WidthFixed, 150f);
|
|
if (!contentByExpansion.TryGetValue(eExpansionVersion, out List<DutyInfo> value))
|
|
{
|
|
continue;
|
|
}
|
|
foreach (DutyInfo item3 in value)
|
|
{
|
|
item3.Deconstruct(out uint CfcId, out uint TerritoryId, out string Name);
|
|
uint num = CfcId;
|
|
uint value2 = TerritoryId;
|
|
string text = Name;
|
|
DutyOptions dutyOptions;
|
|
bool flag = _questRegistry.TryGetDutyByContentFinderConditionId(num, out dutyOptions);
|
|
ImGui.TableNextRow();
|
|
string[] array;
|
|
int currentItem;
|
|
if (flag)
|
|
{
|
|
array = (dutyOptions.Enabled ? SupportedCfcOptions : UnsupportedCfcOptions);
|
|
currentItem = 0;
|
|
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num))
|
|
{
|
|
currentItem = 1;
|
|
}
|
|
if (base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num))
|
|
{
|
|
currentItem = 2;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
array = new string[2] { "Disabled", "Enabled" };
|
|
currentItem = (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num) ? 1 : 0);
|
|
}
|
|
if (ImGui.TableNextColumn())
|
|
{
|
|
ImGui.AlignTextToFramePadding();
|
|
ImGui.TextUnformatted(text);
|
|
if (ImGui.IsItemHovered() && base.Configuration.Advanced.AdditionalStatusInformation)
|
|
{
|
|
TooltipDisposable val3 = ImRaii.Tooltip();
|
|
try
|
|
{
|
|
if (((TooltipDisposable)(ref val3)).Alive)
|
|
{
|
|
ImGui.TextUnformatted(text);
|
|
ImGui.Separator();
|
|
ImU8String text2 = new ImU8String(13, 1);
|
|
text2.AppendLiteral("TerritoryId: ");
|
|
text2.AppendFormatted(value2);
|
|
ImGui.BulletText(text2);
|
|
ImU8String text3 = new ImU8String(26, 1);
|
|
text3.AppendLiteral("ContentFinderConditionId: ");
|
|
text3.AppendFormatted(num);
|
|
ImGui.BulletText(text3);
|
|
if (flag)
|
|
{
|
|
ImGui.BulletText("Duty Support: Available");
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TooltipDisposable)(ref val3)).Dispose();
|
|
}
|
|
}
|
|
if (runInstancedContentWithAutoDuty && !_autoDutyIpc.HasPath(num))
|
|
{
|
|
ImGuiComponents.HelpMarker("This duty is not supported by AutoDuty", FontAwesomeIcon.Times, (Vector4?)ImGuiColors.DalamudRed);
|
|
}
|
|
else if (flag && dutyOptions.Notes.Count > 0)
|
|
{
|
|
ConfigComponent.DrawNotes(dutyOptions.Enabled, dutyOptions.Notes);
|
|
}
|
|
}
|
|
if (ImGui.TableNextColumn())
|
|
{
|
|
ImU8String imU8String2 = new ImU8String(16, 1);
|
|
imU8String2.AppendLiteral("##DungeonEnabled");
|
|
imU8String2.AppendFormatted(num);
|
|
IdDisposable val4 = ImRaii.PushId(imU8String2, true);
|
|
try
|
|
{
|
|
ImGui.SetNextItemWidth(200f);
|
|
if (ImGui.Combo((ImU8String)string.Empty, ref currentItem, (ReadOnlySpan<string>)array, array.Length))
|
|
{
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Remove(num);
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Remove(num);
|
|
if (flag)
|
|
{
|
|
switch (currentItem)
|
|
{
|
|
case 1:
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num);
|
|
break;
|
|
case 2:
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Add(num);
|
|
break;
|
|
}
|
|
}
|
|
else if (currentItem == 1)
|
|
{
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num);
|
|
}
|
|
Save();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val4)?.Dispose();
|
|
}
|
|
}
|
|
if (!ImGui.TableNextColumn())
|
|
{
|
|
continue;
|
|
}
|
|
ImU8String imU8String3 = new ImU8String(13, 1);
|
|
imU8String3.AppendLiteral("##DungeonMode");
|
|
imU8String3.AppendFormatted(num);
|
|
IdDisposable val5 = ImRaii.PushId(imU8String3, true);
|
|
try
|
|
{
|
|
EDutyMode value3;
|
|
bool flag2 = base.Configuration.Duties.DutyModeOverrides.TryGetValue(num, out value3);
|
|
EDutyMode num2 = (flag2 ? value3 : ((EDutyMode)(-1)));
|
|
Name = "Use Default";
|
|
string[] dutyModeLabels = DutyModeLabels;
|
|
int num3 = 0;
|
|
string[] array2 = new string[1 + dutyModeLabels.Length];
|
|
array2[num3] = Name;
|
|
num3++;
|
|
ReadOnlySpan<string> readOnlySpan = new ReadOnlySpan<string>(dutyModeLabels);
|
|
readOnlySpan.CopyTo(new Span<string>(array2).Slice(num3, readOnlySpan.Length));
|
|
num3 += readOnlySpan.Length;
|
|
string[] array3 = array2;
|
|
int currentItem2 = (int)(num2 + 1);
|
|
ImGui.SetNextItemWidth(150f);
|
|
if (ImGui.Combo((ImU8String)string.Empty, ref currentItem2, (ReadOnlySpan<string>)array3, array3.Length))
|
|
{
|
|
if (currentItem2 == 0)
|
|
{
|
|
base.Configuration.Duties.DutyModeOverrides.Remove(num);
|
|
}
|
|
else
|
|
{
|
|
base.Configuration.Duties.DutyModeOverrides[num] = (EDutyMode)(currentItem2 - 1);
|
|
}
|
|
Save();
|
|
}
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
EDutyMode eDutyMode = (flag2 ? value3 : base.Configuration.Duties.DefaultDutyMode);
|
|
ImGui.SetTooltip(flag2 ? ("Override: " + DutyModeLabels[(int)eDutyMode]) : ("Using default: " + DutyModeLabels[(int)eDutyMode]));
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val5)?.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((TableDisposable)(ref val2)).Dispose();
|
|
}
|
|
}
|
|
else if (base.Configuration.Duties.ExpansionHeaderStates.GetValueOrDefault(key, defaultValue: false))
|
|
{
|
|
base.Configuration.Duties.ExpansionHeaderStates[key] = false;
|
|
Save();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((ChildDisposable)(ref val)).Dispose();
|
|
}
|
|
}
|
|
|
|
private (int enabledCount, int totalCount) GetDutyCountsForExpansion(EExpansionVersion expansion, Dictionary<EExpansionVersion, List<DutyInfo>> contentByExpansion)
|
|
{
|
|
if (!contentByExpansion.TryGetValue(expansion, out List<DutyInfo> value))
|
|
{
|
|
return (enabledCount: 0, totalCount: 0);
|
|
}
|
|
int num = 0;
|
|
int num2 = 0;
|
|
foreach (var (num5, _, _) in value)
|
|
{
|
|
if (_questRegistry.TryGetDutyByContentFinderConditionId(num5, out DutyOptions dutyOptions))
|
|
{
|
|
num2++;
|
|
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num5) || (!base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num5) && dutyOptions.Enabled))
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num2++;
|
|
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num5))
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
}
|
|
return (enabledCount: num, totalCount: num2);
|
|
}
|
|
|
|
private void DrawEnableAllButton()
|
|
{
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.CheckCircle, "Enable All"))
|
|
{
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Clear();
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Clear();
|
|
foreach (List<DutyInfo> item2 in _contentFinderConditionNames.Values.Concat<List<DutyInfo>>(_allTrialNames.Values).Concat<List<DutyInfo>>(_allNormalRaidNames.Values).Concat<List<DutyInfo>>(_allAllianceRaidNames.Values))
|
|
{
|
|
foreach (var (item, _, _) in item2)
|
|
{
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(item);
|
|
}
|
|
}
|
|
Save();
|
|
}
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
ImGui.SetTooltip("Enable all of the duties, use at your own risk.");
|
|
}
|
|
}
|
|
|
|
private void DrawClipboardButtons()
|
|
{
|
|
DisabledDisposable val = ImRaii.Disabled(base.Configuration.Duties.WhitelistedDutyCfcIds.Count + base.Configuration.Duties.BlacklistedDutyCfcIds.Count + base.Configuration.Duties.DutyModeOverrides.Count == 0);
|
|
try
|
|
{
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Copy, "Export to clipboard"))
|
|
{
|
|
IEnumerable<string> first = base.Configuration.Duties.WhitelistedDutyCfcIds.Select((uint x) => $"{"+"}{x}");
|
|
IEnumerable<string> second = base.Configuration.Duties.BlacklistedDutyCfcIds.Select((uint x) => $"{"-"}{x}");
|
|
IEnumerable<string> second2 = base.Configuration.Duties.DutyModeOverrides.Select((KeyValuePair<uint, EDutyMode> x) => $"{"M:"}{x.Key}:{x.Value}");
|
|
ImGui.SetClipboardText("qst:duty:" + Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Join(";", first.Concat(second).Concat(second2)))));
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val)?.Dispose();
|
|
}
|
|
ImGui.SameLine();
|
|
string text = ImGui.GetClipboardText().Trim();
|
|
val = ImRaii.Disabled(string.IsNullOrEmpty(text) || !text.StartsWith("qst:duty:", StringComparison.InvariantCulture));
|
|
try
|
|
{
|
|
if (!ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Paste, "Import from Clipboard"))
|
|
{
|
|
return;
|
|
}
|
|
text = text.Substring("qst:duty:".Length);
|
|
string text2 = Encoding.UTF8.GetString(Convert.FromBase64String(text));
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Clear();
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Clear();
|
|
base.Configuration.Duties.DutyModeOverrides.Clear();
|
|
string[] array = text2.Split(";");
|
|
foreach (string text3 in array)
|
|
{
|
|
if (text3.StartsWith("+", StringComparison.InvariantCulture) && uint.TryParse(text3.AsSpan("+".Length), CultureInfo.InvariantCulture, out var result))
|
|
{
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(result);
|
|
}
|
|
if (text3.StartsWith("-", StringComparison.InvariantCulture) && uint.TryParse(text3.AsSpan("-".Length), CultureInfo.InvariantCulture, out var result2))
|
|
{
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Add(result2);
|
|
}
|
|
if (!text3.StartsWith("M:", StringComparison.InvariantCulture))
|
|
{
|
|
continue;
|
|
}
|
|
ReadOnlySpan<char> span = text3.AsSpan("M:".Length);
|
|
int num2 = span.IndexOf(':');
|
|
if (num2 > 0 && uint.TryParse(span.Slice(0, num2), CultureInfo.InvariantCulture, out var result3))
|
|
{
|
|
int num3 = num2 + 1;
|
|
if (int.TryParse(span.Slice(num3, span.Length - num3), CultureInfo.InvariantCulture, out var result4) && Enum.IsDefined(typeof(EDutyMode), result4))
|
|
{
|
|
base.Configuration.Duties.DutyModeOverrides[result3] = (EDutyMode)result4;
|
|
}
|
|
}
|
|
}
|
|
Save();
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val)?.Dispose();
|
|
}
|
|
}
|
|
|
|
private void DrawResetButton()
|
|
{
|
|
DisabledDisposable val = ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl));
|
|
try
|
|
{
|
|
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Undo, "Reset to default"))
|
|
{
|
|
base.Configuration.Duties.WhitelistedDutyCfcIds.Clear();
|
|
base.Configuration.Duties.BlacklistedDutyCfcIds.Clear();
|
|
base.Configuration.Duties.DutyModeOverrides.Clear();
|
|
base.Configuration.Duties.DefaultDutyMode = EDutyMode.Support;
|
|
Save();
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
((IDisposable)val)?.Dispose();
|
|
}
|
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
|
{
|
|
ImGui.SetTooltip("Hold CTRL to enable this button.");
|
|
}
|
|
}
|
|
}
|