muffin v7.38.2
This commit is contained in:
parent
0336b9c9e9
commit
bbc394c386
10 changed files with 737 additions and 437 deletions
|
|
@ -27,6 +27,10 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
|
||||
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;
|
||||
|
|
@ -72,6 +76,21 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
}
|
||||
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))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("Default duty mode:");
|
||||
ImGui.SameLine();
|
||||
int currentItem = (int)base.Configuration.Duties.DefaultDutyMode;
|
||||
ImGui.SetNextItemWidth(200f);
|
||||
if (ImGui.Combo("##DefaultDutyMode", ref currentItem, in 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))
|
||||
{
|
||||
|
|
@ -94,7 +113,7 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
|
||||
private void DrawConfigTable(bool runInstancedContentWithAutoDuty)
|
||||
{
|
||||
using ImRaii.IEndObject endObject = ImRaii.Child("DutyConfiguration", new Vector2(650f, 400f), border: true);
|
||||
using ImRaii.IEndObject endObject = ImRaii.Child("DutyConfiguration", new Vector2(950f, 400f), border: true);
|
||||
if (!endObject)
|
||||
{
|
||||
return;
|
||||
|
|
@ -119,44 +138,49 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
ImU8String table = new ImU8String(6, 1);
|
||||
table.AppendLiteral("Duties");
|
||||
table.AppendFormatted(eExpansionVersion);
|
||||
using ImRaii.IEndObject endObject2 = ImRaii.Table(table, 2, ImGuiTableFlags.SizingFixedFit);
|
||||
using ImRaii.IEndObject endObject2 = ImRaii.Table(table, 3, ImGuiTableFlags.SizingFixedFit);
|
||||
if (!ImRaii.IEndObject.op_True(endObject2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("Options", ImGuiTableColumnFlags.WidthFixed, 200f);
|
||||
ImGui.TableSetupColumn("Enabled", ImGuiTableColumnFlags.WidthFixed, 200f);
|
||||
ImGui.TableSetupColumn("Mode", ImGuiTableColumnFlags.WidthFixed, 150f);
|
||||
if (!_contentFinderConditionNames.TryGetValue(eExpansionVersion, out List<DutyInfo> value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach (var (num3, value2, text2) in value)
|
||||
foreach (DutyInfo item3 in value)
|
||||
{
|
||||
if (!_questRegistry.TryGetDutyByContentFinderConditionId(num3, out DutyOptions dutyOptions))
|
||||
item3.Deconstruct(out uint CfcId, out uint TerritoryId, out string Name);
|
||||
uint num = CfcId;
|
||||
uint value2 = TerritoryId;
|
||||
string text = Name;
|
||||
if (!_questRegistry.TryGetDutyByContentFinderConditionId(num, out DutyOptions dutyOptions))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ImGui.TableNextRow();
|
||||
string[] items = (dutyOptions.Enabled ? SupportedCfcOptions : UnsupportedCfcOptions);
|
||||
int currentItem = 0;
|
||||
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num3))
|
||||
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num))
|
||||
{
|
||||
currentItem = 1;
|
||||
}
|
||||
if (base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num3))
|
||||
if (base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num))
|
||||
{
|
||||
currentItem = 2;
|
||||
}
|
||||
if (ImGui.TableNextColumn())
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(text2);
|
||||
ImGui.TextUnformatted(text);
|
||||
if (ImGui.IsItemHovered() && base.Configuration.Advanced.AdditionalStatusInformation)
|
||||
{
|
||||
using ImRaii.IEndObject endObject3 = ImRaii.Tooltip();
|
||||
if (endObject3)
|
||||
{
|
||||
ImGui.TextUnformatted(text2);
|
||||
ImGui.TextUnformatted(text);
|
||||
ImGui.Separator();
|
||||
table = new ImU8String(13, 1);
|
||||
table.AppendLiteral("TerritoryId: ");
|
||||
|
|
@ -164,11 +188,11 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
ImGui.BulletText(table);
|
||||
table = new ImU8String(26, 1);
|
||||
table.AppendLiteral("ContentFinderConditionId: ");
|
||||
table.AppendFormatted(num3);
|
||||
table.AppendFormatted(num);
|
||||
ImGui.BulletText(table);
|
||||
}
|
||||
}
|
||||
if (runInstancedContentWithAutoDuty && !_autoDutyIpc.HasPath(num3))
|
||||
if (runInstancedContentWithAutoDuty && !_autoDutyIpc.HasPath(num))
|
||||
{
|
||||
ImGuiComponents.HelpMarker("This duty is not supported by AutoDuty", FontAwesomeIcon.Times, ImGuiColors.DalamudRed);
|
||||
}
|
||||
|
|
@ -177,31 +201,72 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
ConfigComponent.DrawNotes(dutyOptions.Enabled, dutyOptions.Notes);
|
||||
}
|
||||
}
|
||||
if (ImGui.TableNextColumn())
|
||||
{
|
||||
table = new ImU8String(16, 1);
|
||||
table.AppendLiteral("##DungeonEnabled");
|
||||
table.AppendFormatted(num);
|
||||
using (ImRaii.PushId(table))
|
||||
{
|
||||
ImGui.SetNextItemWidth(200f);
|
||||
if (ImGui.Combo(string.Empty, ref currentItem, in items, items.Length))
|
||||
{
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Remove(num);
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Remove(num);
|
||||
switch (currentItem)
|
||||
{
|
||||
case 1:
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num);
|
||||
break;
|
||||
case 2:
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Add(num);
|
||||
break;
|
||||
}
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ImGui.TableNextColumn())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
table = new ImU8String(9, 1);
|
||||
table.AppendLiteral("##Dungeon");
|
||||
table.AppendFormatted(num3);
|
||||
table = new ImU8String(13, 1);
|
||||
table.AppendLiteral("##DungeonMode");
|
||||
table.AppendFormatted(num);
|
||||
using (ImRaii.PushId(table))
|
||||
{
|
||||
ImGui.SetNextItemWidth(200f);
|
||||
if (ImGui.Combo(string.Empty, ref currentItem, in items, items.Length))
|
||||
EDutyMode value3;
|
||||
bool flag = base.Configuration.Duties.DutyModeOverrides.TryGetValue(num, out value3);
|
||||
EDutyMode num2 = (flag ? value3 : ((EDutyMode)(-1)));
|
||||
Name = "Use Default";
|
||||
string[] dutyModeLabels = DutyModeLabels;
|
||||
int num3 = 0;
|
||||
string[] array = new string[1 + dutyModeLabels.Length];
|
||||
array[num3] = Name;
|
||||
num3++;
|
||||
ReadOnlySpan<string> readOnlySpan = new ReadOnlySpan<string>(dutyModeLabels);
|
||||
readOnlySpan.CopyTo(new Span<string>(array).Slice(num3, readOnlySpan.Length));
|
||||
num3 += readOnlySpan.Length;
|
||||
string[] items2 = array;
|
||||
int currentItem2 = (int)(num2 + 1);
|
||||
ImGui.SetNextItemWidth(150f);
|
||||
if (ImGui.Combo(string.Empty, ref currentItem2, in items2, items2.Length))
|
||||
{
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Remove(num3);
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Remove(num3);
|
||||
switch (currentItem)
|
||||
if (currentItem2 == 0)
|
||||
{
|
||||
case 1:
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num3);
|
||||
break;
|
||||
case 2:
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Add(num3);
|
||||
break;
|
||||
base.Configuration.Duties.DutyModeOverrides.Remove(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Configuration.Duties.DutyModeOverrides[num] = (EDutyMode)(currentItem2 - 1);
|
||||
}
|
||||
Save();
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
EDutyMode eDutyMode = (flag ? value3 : base.Configuration.Duties.DefaultDutyMode);
|
||||
ImGui.SetTooltip(flag ? ("Override: " + DutyModeLabels[(int)eDutyMode]) : ("Using default: " + DutyModeLabels[(int)eDutyMode]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -261,13 +326,14 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
|
||||
private void DrawClipboardButtons()
|
||||
{
|
||||
using (ImRaii.Disabled(base.Configuration.Duties.WhitelistedDutyCfcIds.Count + base.Configuration.Duties.BlacklistedDutyCfcIds.Count == 0))
|
||||
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}");
|
||||
ImGui.SetClipboardText("qst:duty:" + Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Join(";", first.Concat(second)))));
|
||||
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();
|
||||
|
|
@ -282,6 +348,7 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
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)
|
||||
{
|
||||
|
|
@ -293,7 +360,22 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -305,6 +387,8 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
{
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Clear();
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Clear();
|
||||
base.Configuration.Duties.DutyModeOverrides.Clear();
|
||||
base.Configuration.Duties.DefaultDutyMode = EDutyMode.Support;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue