515 lines
20 KiB
C#
515 lines
20 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()
|
|
{
|
|
using ImRaii.IEndObject endObject = ImRaii.TabItem("Duties###Duties");
|
|
if (!endObject)
|
|
{
|
|
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.");
|
|
using (ImRaii.Disabled(!v))
|
|
{
|
|
using (ImRaii.PushIndent(ImGui.GetFrameHeight() + ImGui.GetStyle().ItemInnerSpacing.X))
|
|
{
|
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
|
{
|
|
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.");
|
|
}
|
|
}
|
|
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.");
|
|
}
|
|
ImGui.Separator();
|
|
using (ImRaii.Disabled(!v))
|
|
{
|
|
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:");
|
|
using ImRaii.IEndObject endObject2 = ImRaii.TabBar("DutyTypeTabs");
|
|
if (endObject2)
|
|
{
|
|
using (ImRaii.IEndObject endObject3 = ImRaii.TabItem("Dungeons"))
|
|
{
|
|
if (endObject3)
|
|
{
|
|
DrawConfigTable(v, _contentFinderConditionNames);
|
|
}
|
|
}
|
|
using (ImRaii.IEndObject endObject4 = ImRaii.TabItem("Trials"))
|
|
{
|
|
if (endObject4)
|
|
{
|
|
DrawConfigTable(v, _allTrialNames);
|
|
}
|
|
}
|
|
using (ImRaii.IEndObject endObject5 = ImRaii.TabItem("Normal Raids"))
|
|
{
|
|
if (endObject5)
|
|
{
|
|
DrawConfigTable(v, _allNormalRaidNames);
|
|
}
|
|
}
|
|
using ImRaii.IEndObject endObject6 = ImRaii.TabItem("Alliance Raids");
|
|
if (endObject6)
|
|
{
|
|
DrawConfigTable(v, _allAllianceRaidNames);
|
|
}
|
|
}
|
|
DrawEnableAllButton();
|
|
ImGui.SameLine();
|
|
DrawClipboardButtons();
|
|
ImGui.SameLine();
|
|
DrawResetButton();
|
|
}
|
|
}
|
|
|
|
private void DrawConfigTable(bool runInstancedContentWithAutoDuty, Dictionary<EExpansionVersion, List<DutyInfo>> contentByExpansion)
|
|
{
|
|
using ImRaii.IEndObject endObject = ImRaii.Child("DutyConfiguration", new Vector2(725f, 400f), border: true);
|
|
if (!endObject)
|
|
{
|
|
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 table = new ImU8String(6, 1);
|
|
table.AppendLiteral("Duties");
|
|
table.AppendFormatted(eExpansionVersion);
|
|
using ImRaii.IEndObject endObject2 = ImRaii.Table(table, 3, ImGuiTableFlags.SizingFixedFit);
|
|
if (!ImRaii.IEndObject.op_True(endObject2))
|
|
{
|
|
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)
|
|
{
|
|
using ImRaii.IEndObject endObject3 = ImRaii.Tooltip();
|
|
if (endObject3)
|
|
{
|
|
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");
|
|
}
|
|
}
|
|
}
|
|
if (runInstancedContentWithAutoDuty && !_autoDutyIpc.HasPath(num))
|
|
{
|
|
ImGuiComponents.HelpMarker("This duty is not supported by AutoDuty", FontAwesomeIcon.Times, ImGuiColors.DalamudRed);
|
|
}
|
|
else if (flag && dutyOptions.Notes.Count > 0)
|
|
{
|
|
ConfigComponent.DrawNotes(dutyOptions.Enabled, dutyOptions.Notes);
|
|
}
|
|
}
|
|
if (ImGui.TableNextColumn())
|
|
{
|
|
ImU8String id = new ImU8String(16, 1);
|
|
id.AppendLiteral("##DungeonEnabled");
|
|
id.AppendFormatted(num);
|
|
using (ImRaii.PushId(id))
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
if (!ImGui.TableNextColumn())
|
|
{
|
|
continue;
|
|
}
|
|
ImU8String id2 = new ImU8String(13, 1);
|
|
id2.AppendLiteral("##DungeonMode");
|
|
id2.AppendFormatted(num);
|
|
using (ImRaii.PushId(id2))
|
|
{
|
|
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]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (base.Configuration.Duties.ExpansionHeaderStates.GetValueOrDefault(key, defaultValue: false))
|
|
{
|
|
base.Configuration.Duties.ExpansionHeaderStates[key] = false;
|
|
Save();
|
|
}
|
|
}
|
|
}
|
|
|
|
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()
|
|
{
|
|
using (ImRaii.Disabled(base.Configuration.Duties.WhitelistedDutyCfcIds.Count + base.Configuration.Duties.BlacklistedDutyCfcIds.Count + base.Configuration.Duties.DutyModeOverrides.Count == 0))
|
|
{
|
|
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)))));
|
|
}
|
|
}
|
|
ImGui.SameLine();
|
|
string text = ImGui.GetClipboardText().Trim();
|
|
using (ImRaii.Disabled(string.IsNullOrEmpty(text) || !text.StartsWith("qst:duty:", StringComparison.InvariantCulture)))
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
|
|
private void DrawResetButton()
|
|
{
|
|
using (ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
|
{
|
|
ImGui.SetTooltip("Hold CTRL to enable this button.");
|
|
}
|
|
}
|
|
}
|