muffin v7.38.7
This commit is contained in:
parent
317800fb39
commit
5e2d8f648b
7 changed files with 703 additions and 486 deletions
|
|
@ -37,12 +37,14 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
|
||||
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _contentFinderConditionNames;
|
||||
|
||||
private readonly Dictionary<EExpansionVersion, List<DutyInfo>> _allTrialNames;
|
||||
|
||||
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<DawnContent>()
|
||||
var source = (from x in dataManager.GetExcelSheet<DawnContent>()
|
||||
where x.RowId != 0 && !x.Unknown16
|
||||
orderby x.Unknown15
|
||||
select x.Content.ValueNullable into x
|
||||
|
|
@ -57,7 +59,22 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
ContentType = x.ContentType.RowId,
|
||||
Level = x.ClassJobLevelRequired,
|
||||
SortKey = x.SortKey
|
||||
}).ToList();
|
||||
_contentFinderConditionNames = (from x in source
|
||||
where x.ContentType == 2
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +95,16 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
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();
|
||||
ImGui.Text("Default duty mode:");
|
||||
ImGui.SameLine();
|
||||
|
|
@ -102,7 +129,22 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
}
|
||||
ImGui.Separator();
|
||||
ImGui.Text("You can override the settings for each individual dungeon/trial:");
|
||||
DrawConfigTable(v);
|
||||
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);
|
||||
}
|
||||
}
|
||||
DrawEnableAllButton();
|
||||
ImGui.SameLine();
|
||||
DrawClipboardButtons();
|
||||
|
|
@ -111,9 +153,9 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawConfigTable(bool runInstancedContentWithAutoDuty)
|
||||
private void DrawConfigTable(bool runInstancedContentWithAutoDuty, Dictionary<EExpansionVersion, List<DutyInfo>> contentByExpansion)
|
||||
{
|
||||
using ImRaii.IEndObject endObject = ImRaii.Child("DutyConfiguration", new Vector2(950f, 400f), border: true);
|
||||
using ImRaii.IEndObject endObject = ImRaii.Child("DutyConfiguration", new Vector2(725f, 400f), border: true);
|
||||
if (!endObject)
|
||||
{
|
||||
return;
|
||||
|
|
@ -122,7 +164,7 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
EExpansionVersion eExpansionVersion = values[i];
|
||||
(int enabledCount, int totalCount) dutyCountsForExpansion = GetDutyCountsForExpansion(eExpansionVersion);
|
||||
(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());
|
||||
|
|
@ -146,7 +188,7 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("Enabled", ImGuiTableColumnFlags.WidthFixed, 200f);
|
||||
ImGui.TableSetupColumn("Mode", ImGuiTableColumnFlags.WidthFixed, 150f);
|
||||
if (!_contentFinderConditionNames.TryGetValue(eExpansionVersion, out List<DutyInfo> value))
|
||||
if (!contentByExpansion.TryGetValue(eExpansionVersion, out List<DutyInfo> value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -156,20 +198,28 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
uint num = CfcId;
|
||||
uint value2 = TerritoryId;
|
||||
string text = Name;
|
||||
if (!_questRegistry.TryGetDutyByContentFinderConditionId(num, out DutyOptions dutyOptions))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
DutyOptions dutyOptions;
|
||||
bool flag = _questRegistry.TryGetDutyByContentFinderConditionId(num, out dutyOptions);
|
||||
ImGui.TableNextRow();
|
||||
string[] items = (dutyOptions.Enabled ? SupportedCfcOptions : UnsupportedCfcOptions);
|
||||
int currentItem = 0;
|
||||
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num))
|
||||
string[] items;
|
||||
int currentItem;
|
||||
if (flag)
|
||||
{
|
||||
currentItem = 1;
|
||||
items = (dutyOptions.Enabled ? SupportedCfcOptions : UnsupportedCfcOptions);
|
||||
currentItem = 0;
|
||||
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num))
|
||||
{
|
||||
currentItem = 1;
|
||||
}
|
||||
if (base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num))
|
||||
{
|
||||
currentItem = 2;
|
||||
}
|
||||
}
|
||||
if (base.Configuration.Duties.BlacklistedDutyCfcIds.Contains(num))
|
||||
else
|
||||
{
|
||||
currentItem = 2;
|
||||
items = new string[2] { "Disabled", "Enabled" };
|
||||
currentItem = (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num) ? 1 : 0);
|
||||
}
|
||||
if (ImGui.TableNextColumn())
|
||||
{
|
||||
|
|
@ -190,13 +240,17 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
table.AppendLiteral("ContentFinderConditionId: ");
|
||||
table.AppendFormatted(num);
|
||||
ImGui.BulletText(table);
|
||||
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 (dutyOptions.Notes.Count > 0)
|
||||
else if (flag && dutyOptions.Notes.Count > 0)
|
||||
{
|
||||
ConfigComponent.DrawNotes(dutyOptions.Enabled, dutyOptions.Notes);
|
||||
}
|
||||
|
|
@ -213,14 +267,21 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
{
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Remove(num);
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Remove(num);
|
||||
switch (currentItem)
|
||||
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)
|
||||
{
|
||||
case 1:
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num);
|
||||
break;
|
||||
case 2:
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Add(num);
|
||||
break;
|
||||
}
|
||||
Save();
|
||||
}
|
||||
|
|
@ -236,8 +297,8 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
using (ImRaii.PushId(table))
|
||||
{
|
||||
EDutyMode value3;
|
||||
bool flag = base.Configuration.Duties.DutyModeOverrides.TryGetValue(num, out value3);
|
||||
EDutyMode num2 = (flag ? value3 : ((EDutyMode)(-1)));
|
||||
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;
|
||||
|
|
@ -264,8 +325,8 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
EDutyMode eDutyMode = (flag ? value3 : base.Configuration.Duties.DefaultDutyMode);
|
||||
ImGui.SetTooltip(flag ? ("Override: " + DutyModeLabels[(int)eDutyMode]) : ("Using default: " + DutyModeLabels[(int)eDutyMode]));
|
||||
EDutyMode eDutyMode = (flag2 ? value3 : base.Configuration.Duties.DefaultDutyMode);
|
||||
ImGui.SetTooltip(flag2 ? ("Override: " + DutyModeLabels[(int)eDutyMode]) : ("Using default: " + DutyModeLabels[(int)eDutyMode]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -278,9 +339,9 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
}
|
||||
}
|
||||
|
||||
private (int enabledCount, int totalCount) GetDutyCountsForExpansion(EExpansionVersion expansion)
|
||||
private (int enabledCount, int totalCount) GetDutyCountsForExpansion(EExpansionVersion expansion, Dictionary<EExpansionVersion, List<DutyInfo>> contentByExpansion)
|
||||
{
|
||||
if (!_contentFinderConditionNames.TryGetValue(expansion, out List<DutyInfo> value))
|
||||
if (!contentByExpansion.TryGetValue(expansion, out List<DutyInfo> value))
|
||||
{
|
||||
return (enabledCount: 0, totalCount: 0);
|
||||
}
|
||||
|
|
@ -296,6 +357,14 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
num++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num2++;
|
||||
if (base.Configuration.Duties.WhitelistedDutyCfcIds.Contains(num5))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (enabledCount: num, totalCount: num2);
|
||||
}
|
||||
|
|
@ -306,14 +375,11 @@ internal sealed class DutyConfigComponent : ConfigComponent
|
|||
{
|
||||
base.Configuration.Duties.BlacklistedDutyCfcIds.Clear();
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Clear();
|
||||
foreach (List<DutyInfo> value in _contentFinderConditionNames.Values)
|
||||
foreach (List<DutyInfo> item2 in _contentFinderConditionNames.Values.Concat<List<DutyInfo>>(_allTrialNames.Values))
|
||||
{
|
||||
foreach (var (num3, _, _) in value)
|
||||
foreach (var (item, _, _) in item2)
|
||||
{
|
||||
if (_questRegistry.TryGetDutyByContentFinderConditionId(num3, out DutyOptions _))
|
||||
{
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(num3);
|
||||
}
|
||||
base.Configuration.Duties.WhitelistedDutyCfcIds.Add(item);
|
||||
}
|
||||
}
|
||||
Save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue