muffin v7.38

This commit is contained in:
alydev 2025-11-17 11:31:27 +10:00
parent 411c0bbe76
commit e5b98b3d57
35 changed files with 10700 additions and 7610 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
@ -38,6 +39,10 @@ internal sealed class GeneralConfigComponent : ConfigComponent
private readonly string[] _classJobNames;
private string _mountSearchText = string.Empty;
private bool _mountComboJustOpened;
public GeneralConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration, IDataManager dataManager, ClassJobUtils classJobUtils, QuestRegistry questRegistry, TerritoryData territoryData)
: base(pluginInterface, configuration)
{
@ -45,10 +50,9 @@ internal sealed class GeneralConfigComponent : ConfigComponent
_territoryData = territoryData;
List<(uint, string)> source = (from x in dataManager.GetExcelSheet<Mount>()
where x.RowId != 0 && x.Icon > 0
select (MountId: x.RowId, Name: x.Singular.ToString()) into x
select (MountId: x.RowId, Name: CapitalizeName(x.Singular.ExtractText())) into x
where !string.IsNullOrEmpty(x.Name)
orderby x.Name
select x).ToList();
select x).OrderBy<(uint, string), string>(((uint MountId, string Name) x) => x.Name, StringComparer.OrdinalIgnoreCase).ToList();
_mountIds = DefaultMounts.Select<(uint, string), uint>(((uint Id, string Name) x) => x.Id).Concat(source.Select<(uint, string), uint>(((uint MountId, string Name) x) => x.MountId)).ToArray();
_mountNames = DefaultMounts.Select<(uint, string), string>(((uint Id, string Name) x) => x.Name).Concat(source.Select<(uint, string), string>(((uint MountId, string Name) x) => x.Name)).ToArray();
List<EClassJob> sortedClassJobs = classJobUtils.SortedClassJobs.Select(((EClassJob ClassJob, int Category) x) => x.ClassJob).ToList();
@ -62,6 +66,27 @@ internal sealed class GeneralConfigComponent : ConfigComponent
_classJobNames = DefaultClassJobs.Select<(EClassJob, string), string>(((EClassJob ClassJob, string Name) x) => x.Name).Concat(list.Select((EClassJob x) => x.ToFriendlyString())).ToArray();
}
private static string CapitalizeName(string text)
{
if (string.IsNullOrEmpty(text))
{
return text;
}
if (string.Equals(text, text.ToLowerInvariant(), StringComparison.Ordinal))
{
return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(text);
}
string[] array = text.Split(' ');
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length > 0 && char.IsLower(array[i][0]))
{
array[i] = char.ToUpperInvariant(array[i][0]) + array[i].Substring(1);
}
}
return string.Join(" ", array);
}
public override void DrawTab()
{
using ImRaii.IEndObject endObject = ImRaii.TabItem("General###General");
@ -75,34 +100,71 @@ internal sealed class GeneralConfigComponent : ConfigComponent
base.Configuration.General.CombatModule = (Configuration.ECombatModule)currentItem;
Save();
}
int currentItem2 = Array.FindIndex(_mountIds, (uint x) => x == base.Configuration.General.MountId);
if (currentItem2 == -1)
int num = Array.FindIndex(_mountIds, (uint x) => x == base.Configuration.General.MountId);
if (num == -1)
{
currentItem2 = 0;
base.Configuration.General.MountId = _mountIds[currentItem2];
num = 0;
base.Configuration.General.MountId = _mountIds[num];
Save();
}
if (ImGui.Combo("Preferred Mount", ref currentItem2, in _mountNames, _mountNames.Length))
string text = ((num >= 0 && num < _mountNames.Length) ? _mountNames[num] : "Unknown");
if (ImGui.BeginCombo("Preferred Mount", text, ImGuiComboFlags.HeightLarge))
{
base.Configuration.General.MountId = _mountIds[currentItem2];
if (!_mountComboJustOpened)
{
ImGui.SetKeyboardFocusHere();
_mountComboJustOpened = true;
}
ImGui.SetNextItemWidth(-1f);
ImGui.InputTextWithHint("##MountSearch", "Search mounts...", ref _mountSearchText, 256);
ImGui.Separator();
using (ImRaii.IEndObject endObject2 = ImRaii.Child("##MountScrollArea", new Vector2(0f, 300f), border: false))
{
if (endObject2)
{
string value = _mountSearchText.ToUpperInvariant();
for (int num2 = 0; num2 < _mountNames.Length; num2++)
{
if (string.IsNullOrEmpty(_mountSearchText) || _mountNames[num2].ToUpperInvariant().Contains(value, StringComparison.Ordinal))
{
bool flag = num2 == num;
if (ImGui.Selectable(_mountNames[num2], flag))
{
base.Configuration.General.MountId = _mountIds[num2];
Save();
_mountSearchText = string.Empty;
ImGui.CloseCurrentPopup();
}
if (flag)
{
ImGui.SetItemDefaultFocus();
}
}
}
}
}
ImGui.EndCombo();
}
else
{
_mountComboJustOpened = false;
}
int currentItem2 = (int)base.Configuration.General.GrandCompany;
if (ImGui.Combo("Preferred Grand Company", ref currentItem2, in _grandCompanyNames, _grandCompanyNames.Length))
{
base.Configuration.General.GrandCompany = (FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany)currentItem2;
Save();
}
int currentItem3 = (int)base.Configuration.General.GrandCompany;
if (ImGui.Combo("Preferred Grand Company", ref currentItem3, in _grandCompanyNames, _grandCompanyNames.Length))
{
base.Configuration.General.GrandCompany = (FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany)currentItem3;
Save();
}
int currentItem4 = Array.IndexOf(_classJobIds, base.Configuration.General.CombatJob);
if (currentItem4 == -1)
int currentItem3 = Array.IndexOf(_classJobIds, base.Configuration.General.CombatJob);
if (currentItem3 == -1)
{
base.Configuration.General.CombatJob = EClassJob.Adventurer;
Save();
currentItem4 = 0;
currentItem3 = 0;
}
if (ImGui.Combo("Preferred Combat Job", ref currentItem4, in _classJobNames, _classJobNames.Length))
if (ImGui.Combo("Preferred Combat Job", ref currentItem3, in _classJobNames, _classJobNames.Length))
{
base.Configuration.General.CombatJob = _classJobIds[currentItem4];
base.Configuration.General.CombatJob = _classJobIds[currentItem3];
Save();
}
ImGui.Separator();
@ -116,7 +178,7 @@ internal sealed class GeneralConfigComponent : ConfigComponent
Save();
}
bool v2 = base.Configuration.General.UseEscToCancelQuesting;
if (ImGui.Checkbox("Use ESC to cancel questing/movement", ref v2))
if (ImGui.Checkbox("Double tap ESC to cancel questing/movement", ref v2))
{
base.Configuration.General.UseEscToCancelQuesting = v2;
Save();
@ -133,21 +195,27 @@ internal sealed class GeneralConfigComponent : ConfigComponent
base.Configuration.General.HideSeasonalEventsFromJournalProgress = v4;
Save();
}
bool v5 = base.Configuration.General.ShowChangelogOnUpdate;
if (ImGui.Checkbox("Show changelog window when plugin updates", ref v5))
{
base.Configuration.General.ShowChangelogOnUpdate = v5;
Save();
}
}
ImGui.Separator();
ImGui.Text("Questing");
using (ImRaii.PushIndent())
{
bool v5 = base.Configuration.General.ConfigureTextAdvance;
if (ImGui.Checkbox("Automatically configure TextAdvance with the recommended settings", ref v5))
bool v6 = base.Configuration.General.ConfigureTextAdvance;
if (ImGui.Checkbox("Automatically configure TextAdvance with the recommended settings", ref v6))
{
base.Configuration.General.ConfigureTextAdvance = v5;
base.Configuration.General.ConfigureTextAdvance = v6;
Save();
}
bool v6 = base.Configuration.General.SkipLowPriorityDuties;
if (ImGui.Checkbox("Unlock certain optional dungeons and raids (instead of waiting for completion)", ref v6))
bool v7 = base.Configuration.General.SkipLowPriorityDuties;
if (ImGui.Checkbox("Unlock certain optional dungeons and raids (instead of waiting for completion)", ref v7))
{
base.Configuration.General.SkipLowPriorityDuties = v6;
base.Configuration.General.SkipLowPriorityDuties = v7;
Save();
}
ImGui.SameLine();
@ -167,18 +235,18 @@ internal sealed class GeneralConfigComponent : ConfigComponent
{
if (_territoryData.TryGetContentFinderCondition(lowPriorityContentFinderConditionQuest.ContentFinderConditionId, out TerritoryData.ContentFinderConditionData contentFinderConditionData))
{
ImU8String text = new ImU8String(0, 1);
text.AppendFormatted(contentFinderConditionData.Name);
ImGui.BulletText(text);
ImU8String text2 = new ImU8String(0, 1);
text2.AppendFormatted(contentFinderConditionData.Name);
ImGui.BulletText(text2);
}
}
}
}
ImGui.Spacing();
bool v7 = base.Configuration.General.AutoStepRefreshEnabled;
if (ImGui.Checkbox("Automatically refresh quest steps when stuck", ref v7))
bool v8 = base.Configuration.General.AutoStepRefreshEnabled;
if (ImGui.Checkbox("Automatically refresh quest steps when stuck", ref v8))
{
base.Configuration.General.AutoStepRefreshEnabled = v7;
base.Configuration.General.AutoStepRefreshEnabled = v8;
Save();
}
ImGui.SameLine();
@ -194,37 +262,37 @@ internal sealed class GeneralConfigComponent : ConfigComponent
ImGui.Text("This helps resume automated quest completion when interruptions occur.");
}
}
using (ImRaii.Disabled(!v7))
using (ImRaii.Disabled(!v8))
{
ImGui.Indent();
int v8 = base.Configuration.General.AutoStepRefreshDelaySeconds;
int v9 = base.Configuration.General.AutoStepRefreshDelaySeconds;
ImGui.SetNextItemWidth(150f);
if (ImGui.SliderInt("Refresh delay (seconds)", ref v8, 10, 180))
if (ImGui.SliderInt("Refresh delay (seconds)", ref v9, 10, 180))
{
base.Configuration.General.AutoStepRefreshDelaySeconds = v8;
base.Configuration.General.AutoStepRefreshDelaySeconds = v9;
Save();
}
Vector4 col = new Vector4(0.7f, 0.7f, 0.7f, 1f);
ImU8String text = new ImU8String(77, 1);
text.AppendLiteral("Quest steps will refresh automatically after ");
text.AppendFormatted(v8);
text.AppendLiteral(" seconds if no progress is made.");
ImGui.TextColored(in col, text);
ImU8String text2 = new ImU8String(77, 1);
text2.AppendLiteral("Quest steps will refresh automatically after ");
text2.AppendFormatted(v9);
text2.AppendLiteral(" seconds if no progress is made.");
ImGui.TextColored(in col, text2);
ImGui.Unindent();
}
ImGui.Spacing();
ImGui.Separator();
ImGui.Text("Priority Quest Management");
bool v9 = base.Configuration.General.ClearPriorityQuestsOnLogout;
if (ImGui.Checkbox("Clear priority quests on character logout", ref v9))
bool v10 = base.Configuration.General.ClearPriorityQuestsOnLogout;
if (ImGui.Checkbox("Clear priority quests on character logout", ref v10))
{
base.Configuration.General.ClearPriorityQuestsOnLogout = v9;
base.Configuration.General.ClearPriorityQuestsOnLogout = v10;
Save();
}
bool v10 = base.Configuration.General.ClearPriorityQuestsOnCompletion;
if (ImGui.Checkbox("Remove priority quests when completed", ref v10))
bool v11 = base.Configuration.General.ClearPriorityQuestsOnCompletion;
if (ImGui.Checkbox("Remove priority quests when completed", ref v11))
{
base.Configuration.General.ClearPriorityQuestsOnCompletion = v10;
base.Configuration.General.ClearPriorityQuestsOnCompletion = v11;
Save();
}
ImGui.SameLine();