forked from liza/Questionable
Don't allow changing combat module while in combat
This commit is contained in:
parent
f7306166de
commit
7503aa9280
@ -78,6 +78,9 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Sequence": 4
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Sequence": 5,
|
"Sequence": 5,
|
||||||
"Steps": [
|
"Steps": [
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
@ -12,6 +11,7 @@ using Dalamud.Utility;
|
|||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using LLib.ImGui;
|
using LLib.ImGui;
|
||||||
using Lumina.Excel.Sheets;
|
using Lumina.Excel.Sheets;
|
||||||
|
using Questionable.Controller;
|
||||||
using Questionable.External;
|
using Questionable.External;
|
||||||
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
|
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
|
||||||
|
|
||||||
@ -19,24 +19,32 @@ namespace Questionable.Windows;
|
|||||||
|
|
||||||
internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
|
internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
|
||||||
{
|
{
|
||||||
|
private static readonly List<(uint Id, string Name)> DefaultMounts = [(0, "Mount Roulette")];
|
||||||
|
|
||||||
private readonly IDalamudPluginInterface _pluginInterface;
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
private readonly NotificationMasterIpc _notificationMasterIpc;
|
private readonly NotificationMasterIpc _notificationMasterIpc;
|
||||||
private readonly Configuration _configuration;
|
private readonly Configuration _configuration;
|
||||||
|
private readonly CombatController _combatController;
|
||||||
|
|
||||||
private readonly uint[] _mountIds;
|
private readonly uint[] _mountIds;
|
||||||
private readonly string[] _mountNames;
|
private readonly string[] _mountNames;
|
||||||
|
|
||||||
private readonly string[] _combatModuleNames = ["None", "Boss Mod (VBM)", "Rotation Solver Reborn"];
|
private readonly string[] _combatModuleNames = ["None", "Boss Mod (VBM)", "Rotation Solver Reborn"];
|
||||||
|
|
||||||
private readonly string[] _grandCompanyNames =
|
private readonly string[] _grandCompanyNames =
|
||||||
["None (manually pick quest)", "Maelstrom", "Twin Adder", "Immortal Flames"];
|
["None (manually pick quest)", "Maelstrom", "Twin Adder", "Immortal Flames"];
|
||||||
|
|
||||||
[SuppressMessage("Performance", "CA1861", Justification = "One time initialization")]
|
public ConfigWindow(IDalamudPluginInterface pluginInterface,
|
||||||
public ConfigWindow(IDalamudPluginInterface pluginInterface, NotificationMasterIpc notificationMasterIpc, Configuration configuration, IDataManager dataManager)
|
NotificationMasterIpc notificationMasterIpc,
|
||||||
|
Configuration configuration,
|
||||||
|
IDataManager dataManager,
|
||||||
|
CombatController combatController)
|
||||||
: base("Config - Questionable###QuestionableConfig", ImGuiWindowFlags.AlwaysAutoResize)
|
: base("Config - Questionable###QuestionableConfig", ImGuiWindowFlags.AlwaysAutoResize)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_notificationMasterIpc = notificationMasterIpc;
|
_notificationMasterIpc = notificationMasterIpc;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_combatController = combatController;
|
||||||
|
|
||||||
var mounts = dataManager.GetExcelSheet<Mount>()
|
var mounts = dataManager.GetExcelSheet<Mount>()
|
||||||
.Where(x => x is { RowId: > 0, Icon: > 0 })
|
.Where(x => x is { RowId: > 0, Icon: > 0 })
|
||||||
@ -44,8 +52,8 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
|
|||||||
.Where(x => !string.IsNullOrEmpty(x.Name))
|
.Where(x => !string.IsNullOrEmpty(x.Name))
|
||||||
.OrderBy(x => x.Name)
|
.OrderBy(x => x.Name)
|
||||||
.ToList();
|
.ToList();
|
||||||
_mountIds = new uint[] { 0 }.Concat(mounts.Select(x => x.MountId)).ToArray();
|
_mountIds = DefaultMounts.Select(x => x.Id).Concat(mounts.Select(x => x.MountId)).ToArray();
|
||||||
_mountNames = new[] { "Mount Roulette" }.Concat(mounts.Select(x => x.Name)).ToArray();
|
_mountNames = DefaultMounts.Select(x => x.Name).Concat(mounts.Select(x => x.Name)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowConfig WindowConfig => _configuration.ConfigWindowConfig;
|
public WindowConfig WindowConfig => _configuration.ConfigWindowConfig;
|
||||||
@ -67,12 +75,16 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
|
|||||||
if (!tab)
|
if (!tab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
using (ImRaii.Disabled(_combatController.IsRunning))
|
||||||
|
{
|
||||||
int selectedCombatModule = (int)_configuration.General.CombatModule;
|
int selectedCombatModule = (int)_configuration.General.CombatModule;
|
||||||
if (ImGui.Combo("Preferred Combat Module", ref selectedCombatModule, _combatModuleNames, _combatModuleNames.Length))
|
if (ImGui.Combo("Preferred Combat Module", ref selectedCombatModule, _combatModuleNames,
|
||||||
|
_combatModuleNames.Length))
|
||||||
{
|
{
|
||||||
_configuration.General.CombatModule = (Configuration.ECombatModule)selectedCombatModule;
|
_configuration.General.CombatModule = (Configuration.ECombatModule)selectedCombatModule;
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int selectedMount = Array.FindIndex(_mountIds, x => x == _configuration.General.MountId);
|
int selectedMount = Array.FindIndex(_mountIds, x => x == _configuration.General.MountId);
|
||||||
if (selectedMount == -1)
|
if (selectedMount == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user