Implement service locator

This commit is contained in:
Raymond 2021-08-20 11:59:35 -04:00
parent 06b1163a52
commit ff1d7f2829
101 changed files with 1614 additions and 1436 deletions

View file

@ -22,18 +22,14 @@ namespace Dalamud.Interface.Internal.Windows
If you note any issues or need help, please make sure to ask on our discord server.";
private readonly Dalamud dalamud;
private readonly string assemblyVersion = Util.AssemblyVersion;
/// <summary>
/// Initializes a new instance of the <see cref="ChangelogWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public ChangelogWindow(Dalamud dalamud)
public ChangelogWindow()
: base("What's new in XIVLauncher?", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize)
{
this.dalamud = dalamud;
this.Namespace = "DalamudChangelogWindow";
this.IsOpen = WarrantsChangelog;
@ -59,7 +55,7 @@ If you note any issues or need help, please make sure to ask on our discord serv
if (ImGui.Button(FontAwesomeIcon.Download.ToIconString()))
{
this.dalamud.DalamudUi.OpenPluginInstaller();
Service<DalamudInterface>.Get().OpenPluginInstaller();
}
if (ImGui.IsItemHovered())

View file

@ -6,6 +6,8 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using Dalamud.Configuration.Internal;
using Dalamud.Game.Command;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;
@ -21,8 +23,6 @@ namespace Dalamud.Interface.Internal.Windows
/// </summary>
internal class ConsoleWindow : Window, IDisposable
{
private readonly Dalamud dalamud;
private readonly List<LogEntry> logText = new();
private readonly object renderLock = new();
@ -46,14 +46,13 @@ namespace Dalamud.Interface.Internal.Windows
/// <summary>
/// Initializes a new instance of the <see cref="ConsoleWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public ConsoleWindow(Dalamud dalamud)
public ConsoleWindow()
: base("Dalamud Console")
{
this.dalamud = dalamud;
var configuration = Service<DalamudConfiguration>.Get();
this.autoScroll = this.dalamud.Configuration.LogAutoScroll;
this.openAtStartup = this.dalamud.Configuration.LogOpenAtStartup;
this.autoScroll = configuration.LogAutoScroll;
this.openAtStartup = configuration.LogOpenAtStartup;
SerilogEventSink.Instance.OnLogLine += this.OnLogLine;
this.Size = new Vector2(500, 400);
@ -113,24 +112,27 @@ namespace Dalamud.Interface.Internal.Windows
// Options menu
if (ImGui.BeginPopup("Options"))
{
var dalamud = Service<Dalamud>.Get();
var configuration = Service<DalamudConfiguration>.Get();
if (ImGui.Checkbox("Auto-scroll", ref this.autoScroll))
{
this.dalamud.Configuration.LogAutoScroll = this.autoScroll;
this.dalamud.Configuration.Save();
configuration.LogAutoScroll = this.autoScroll;
configuration.Save();
}
if (ImGui.Checkbox("Open at startup", ref this.openAtStartup))
{
this.dalamud.Configuration.LogOpenAtStartup = this.openAtStartup;
this.dalamud.Configuration.Save();
configuration.LogOpenAtStartup = this.openAtStartup;
configuration.Save();
}
var prevLevel = (int)this.dalamud.LogLevelSwitch.MinimumLevel;
var prevLevel = (int)dalamud.LogLevelSwitch.MinimumLevel;
if (ImGui.Combo("Log Level", ref prevLevel, Enum.GetValues(typeof(LogEventLevel)).Cast<LogEventLevel>().Select(x => x.ToString()).ToArray(), 6))
{
this.dalamud.LogLevelSwitch.MinimumLevel = (LogEventLevel)prevLevel;
this.dalamud.Configuration.LogLevel = (LogEventLevel)prevLevel;
this.dalamud.Configuration.Save();
dalamud.LogLevelSwitch.MinimumLevel = (LogEventLevel)prevLevel;
configuration.LogLevel = (LogEventLevel)prevLevel;
configuration.Save();
}
ImGui.EndPopup();
@ -336,7 +338,7 @@ namespace Dalamud.Interface.Internal.Windows
return;
}
this.lastCmdSuccess = this.dalamud.CommandManager.ProcessCommand("/" + this.commandText);
this.lastCmdSuccess = Service<CommandManager>.Get().ProcessCommand("/" + this.commandText);
this.commandText = string.Empty;
// TODO: Force scroll to bottom
@ -367,7 +369,7 @@ namespace Dalamud.Interface.Internal.Windows
// TODO: Improve this, add partial completion
// https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp#L6443-L6484
var candidates = this.dalamud.CommandManager.Commands.Where(x => x.Key.Contains("/" + words[0])).ToList();
var candidates = Service<CommandManager>.Get().Commands.Where(x => x.Key.Contains("/" + words[0])).ToList();
if (candidates.Count > 0)
{
ptr.DeleteChars(0, ptr.BufTextLen);

View file

@ -4,7 +4,10 @@ using System.IO;
using System.Linq;
using System.Numerics;
using Dalamud.Game;
using Dalamud.Game.Gui;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Internal;
using ImGuiNET;
using ImGuiScene;
@ -115,7 +118,6 @@ Contribute at: https://github.com/goatsoft/Dalamud
Thank you for using XIVLauncher and Dalamud!
";
private readonly Dalamud dalamud;
private readonly TextureWrap logoTexture;
private readonly Stopwatch creditsThrottler;
@ -124,12 +126,13 @@ Thank you for using XIVLauncher and Dalamud!
/// <summary>
/// Initializes a new instance of the <see cref="CreditsWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public CreditsWindow(Dalamud dalamud)
public CreditsWindow()
: base("Dalamud Credits", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize, true)
{
this.dalamud = dalamud;
this.logoTexture = this.dalamud.InterfaceManager.LoadImage(Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "logo.png"));
var dalamud = Service<Dalamud>.Get();
var interfaceManager = Service<InterfaceManager>.Get();
this.logoTexture = interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "logo.png"));
this.creditsThrottler = new();
this.Size = new Vector2(500, 400);
@ -143,14 +146,14 @@ Thank you for using XIVLauncher and Dalamud!
/// <inheritdoc/>
public override void OnOpen()
{
var pluginCredits = this.dalamud.PluginManager.InstalledPlugins
var pluginCredits = Service<PluginManager>.Get().InstalledPlugins
.Where(plugin => plugin.Manifest != null)
.Select(plugin => $"{plugin.Manifest.Name} by {plugin.Manifest.Author}\n")
.Aggregate(string.Empty, (current, next) => $"{current}{next}");
this.creditsText = string.Format(CreditsTextTempl, typeof(Dalamud).Assembly.GetName().Version, pluginCredits);
this.dalamud.Framework.Gui.SetBgm(132);
Service<GameGui>.Get().SetBgm(132);
this.creditsThrottler.Restart();
}
@ -158,7 +161,7 @@ Thank you for using XIVLauncher and Dalamud!
public override void OnClose()
{
this.creditsThrottler.Reset();
this.dalamud.Framework.Gui.SetBgm(9999);
Service<GameGui>.Get().SetBgm(9999);
}
/// <inheritdoc/>

View file

@ -4,19 +4,29 @@ using System.Dynamic;
using System.Linq;
using System.Numerics;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Buddy;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Fates;
using Dalamud.Game.ClientState.GamePad;
using Dalamud.Game.ClientState.JobGauge;
using Dalamud.Game.ClientState.JobGauge.Enums;
using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Party;
using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.Game.Gui.FlyText;
using Dalamud.Game.Gui.Toast;
using Dalamud.Game.Text;
using Dalamud.Interface.Windowing;
using Dalamud.Memory;
using Dalamud.Plugin;
using Dalamud.Plugin.Internal;
using Dalamud.Utility;
using ImGuiNET;
using ImGuiScene;
@ -30,7 +40,6 @@ namespace Dalamud.Interface.Internal.Windows
/// </summary>
internal class DataWindow : Window
{
private readonly Dalamud dalamud;
private readonly string[] dataKindNames = Enum.GetNames(typeof(DataKind)).Select(k => k.Replace("_", " ")).ToArray();
private bool wasReady;
@ -85,12 +94,9 @@ namespace Dalamud.Interface.Internal.Windows
/// <summary>
/// Initializes a new instance of the <see cref="DataWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance to access data of.</param>
public DataWindow(Dalamud dalamud)
public DataWindow()
: base("Dalamud Data")
{
this.dalamud = dalamud;
this.Size = new Vector2(500, 500);
this.SizeCondition = ImGuiCond.FirstUseEver;
@ -160,7 +166,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else
{
this.dalamud.Framework.Gui.Chat.PrintError("/xldata: Invalid Data Type");
Service<ChatGui>.Get().PrintError("/xldata: Invalid Data Type");
}
}
@ -307,7 +313,8 @@ namespace Dalamud.Interface.Internal.Windows
{
try
{
this.sigResult = this.dalamud.SigScanner.ScanText(this.inputSig);
var sigScanner = Service<SigScanner>.Get();
this.sigResult = sigScanner.ScanText(this.inputSig);
}
catch (KeyNotFoundException)
{
@ -337,38 +344,44 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawObjectTable()
{
var chatGui = Service<ChatGui>.Get();
var clientState = Service<ClientState>.Get();
var framework = Service<Framework>.Get();
var gameGui = Service<GameGui>.Get();
var objectTable = Service<ObjectTable>.Get();
var stateString = string.Empty;
if (this.dalamud.ClientState.LocalPlayer == null)
if (clientState.LocalPlayer == null)
{
ImGui.TextUnformatted("LocalPlayer null.");
}
else
{
stateString += $"FrameworkBase: {this.dalamud.Framework.Address.BaseAddress.ToInt64():X}\n";
stateString += $"ObjectTableLen: {this.dalamud.ClientState.Objects.Length}\n";
stateString += $"LocalPlayerName: {this.dalamud.ClientState.LocalPlayer.Name}\n";
stateString += $"CurrentWorldName: {(this.resolveGameData ? this.dalamud.ClientState.LocalPlayer.CurrentWorld.GameData.Name : this.dalamud.ClientState.LocalPlayer.CurrentWorld.Id.ToString())}\n";
stateString += $"HomeWorldName: {(this.resolveGameData ? this.dalamud.ClientState.LocalPlayer.HomeWorld.GameData.Name : this.dalamud.ClientState.LocalPlayer.HomeWorld.Id.ToString())}\n";
stateString += $"LocalCID: {this.dalamud.ClientState.LocalContentId:X}\n";
stateString += $"LastLinkedItem: {this.dalamud.Framework.Gui.Chat.LastLinkedItemId}\n";
stateString += $"TerritoryType: {this.dalamud.ClientState.TerritoryType}\n\n";
stateString += $"FrameworkBase: {framework.Address.BaseAddress.ToInt64():X}\n";
stateString += $"ObjectTableLen: {objectTable.Length}\n";
stateString += $"LocalPlayerName: {clientState.LocalPlayer.Name}\n";
stateString += $"CurrentWorldName: {(this.resolveGameData ? clientState.LocalPlayer.CurrentWorld.GameData.Name : clientState.LocalPlayer.CurrentWorld.Id.ToString())}\n";
stateString += $"HomeWorldName: {(this.resolveGameData ? clientState.LocalPlayer.HomeWorld.GameData.Name : clientState.LocalPlayer.HomeWorld.Id.ToString())}\n";
stateString += $"LocalCID: {clientState.LocalContentId:X}\n";
stateString += $"LastLinkedItem: {chatGui.LastLinkedItemId}\n";
stateString += $"TerritoryType: {clientState.TerritoryType}\n\n";
ImGui.TextUnformatted(stateString);
ImGui.Checkbox("Draw characters on screen", ref this.drawCharas);
ImGui.SliderFloat("Draw Distance", ref this.maxCharaDrawDistance, 2f, 40f);
for (var i = 0; i < this.dalamud.ClientState.Objects.Length; i++)
for (var i = 0; i < objectTable.Length; i++)
{
var obj = this.dalamud.ClientState.Objects[i];
var obj = objectTable[i];
if (obj == null)
continue;
this.PrintGameObject(obj, i.ToString());
if (this.drawCharas && this.dalamud.Framework.Gui.WorldToScreen(obj.Position, out var screenCoords))
if (this.drawCharas && gameGui.WorldToScreen(obj.Position, out var screenCoords))
{
// So, while WorldToScreen will return false if the point is off of game client screen, to
// to avoid performance issues, we have to manually determine if creating a window would
@ -413,21 +426,24 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawFateTable()
{
var fateTable = Service<FateTable>.Get();
var framework = Service<Framework>.Get();
var stateString = string.Empty;
if (this.dalamud.ClientState.Fates.Length == 0)
if (fateTable.Length == 0)
{
ImGui.TextUnformatted("No fates or data not ready.");
}
else
{
stateString += $"FrameworkBase: {this.dalamud.Framework.Address.BaseAddress.ToInt64():X}\n";
stateString += $"FateTableLen: {this.dalamud.ClientState.Fates.Length}\n";
stateString += $"FrameworkBase: {framework.Address.BaseAddress.ToInt64():X}\n";
stateString += $"FateTableLen: {fateTable.Length}\n";
ImGui.TextUnformatted(stateString);
for (var i = 0; i < this.dalamud.ClientState.Fates.Length; i++)
for (var i = 0; i < fateTable.Length; i++)
{
var fate = this.dalamud.ClientState.Fates[i];
var fate = fateTable[i];
if (fate == null)
continue;
@ -473,17 +489,19 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawPartyList()
{
var partyList = Service<PartyList>.Get();
ImGui.Checkbox("Resolve Actors", ref this.resolveObjects);
ImGui.Text($"GroupManager: {this.dalamud.ClientState.PartyList.GroupManagerAddress.ToInt64():X}");
ImGui.Text($"GroupList: {this.dalamud.ClientState.PartyList.GroupListAddress.ToInt64():X}");
ImGui.Text($"AllianceList: {this.dalamud.ClientState.PartyList.AllianceListAddress.ToInt64():X}");
ImGui.Text($"GroupManager: {partyList.GroupManagerAddress.ToInt64():X}");
ImGui.Text($"GroupList: {partyList.GroupListAddress.ToInt64():X}");
ImGui.Text($"AllianceList: {partyList.AllianceListAddress.ToInt64():X}");
ImGui.Text($"{this.dalamud.ClientState.PartyList.Length} Members");
ImGui.Text($"{partyList.Length} Members");
for (var i = 0; i < this.dalamud.ClientState.PartyList.Length; i++)
for (var i = 0; i < partyList.Length; i++)
{
var member = this.dalamud.ClientState.PartyList[i];
var member = partyList[i];
if (member == null)
{
ImGui.Text($"[{i}] was null");
@ -508,11 +526,13 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawBuddyList()
{
var buddyList = Service<BuddyList>.Get();
ImGui.Checkbox("Resolve Actors", ref this.resolveObjects);
ImGui.Text($"BuddyList: {this.dalamud.ClientState.BuddyList.BuddyListAddress.ToInt64():X}");
ImGui.Text($"BuddyList: {buddyList.BuddyListAddress.ToInt64():X}");
{
var member = this.dalamud.ClientState.BuddyList.CompanionBuddy;
var member = buddyList.CompanionBuddy;
if (member == null)
{
ImGui.Text("[Companion] null");
@ -522,21 +542,21 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Text($"[Companion] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}");
if (this.resolveObjects)
{
var actor = member.Actor;
if (actor == null)
var gameObject = member.GameObject;
if (gameObject == null)
{
ImGui.Text("Actor was null");
ImGui.Text("GameObject was null");
}
else
{
this.PrintGameObject(actor, "-");
this.PrintGameObject(gameObject, "-");
}
}
}
}
{
var member = this.dalamud.ClientState.BuddyList.PetBuddy;
var member = buddyList.PetBuddy;
if (member == null)
{
ImGui.Text("[Pet] null");
@ -546,21 +566,21 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Text($"[Pet] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}");
if (this.resolveObjects)
{
var actor = member.Actor;
if (actor == null)
var gameObject = member.GameObject;
if (gameObject == null)
{
ImGui.Text("Actor was null");
ImGui.Text("GameObject was null");
}
else
{
this.PrintGameObject(actor, "-");
this.PrintGameObject(gameObject, "-");
}
}
}
}
{
var count = this.dalamud.ClientState.BuddyList.Length;
var count = buddyList.Length;
if (count == 0)
{
ImGui.Text("[BattleBuddy] None present");
@ -569,18 +589,18 @@ namespace Dalamud.Interface.Internal.Windows
{
for (var i = 0; i < count; i++)
{
var member = this.dalamud.ClientState.BuddyList[i];
var member = buddyList[i];
ImGui.Text($"[BattleBuddy] [{i}] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}");
if (this.resolveObjects)
{
var actor = member.Actor;
if (actor == null)
var gameObject = member.GameObject;
if (gameObject == null)
{
ImGui.Text("Actor was null");
ImGui.Text("GameObject was null");
}
else
{
this.PrintGameObject(actor, "-");
this.PrintGameObject(gameObject, "-");
}
}
}
@ -591,8 +611,8 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawPluginIPC()
{
#pragma warning disable CS0618 // Type or member is obsolete
var i1 = new DalamudPluginInterface(this.dalamud, "DalamudTestSub", PluginLoadReason.Unknown);
var i2 = new DalamudPluginInterface(this.dalamud, "DalamudTestPub", PluginLoadReason.Unknown);
var i1 = new DalamudPluginInterface("DalamudTestSub", PluginLoadReason.Unknown);
var i2 = new DalamudPluginInterface("DalamudTestPub", PluginLoadReason.Unknown);
if (ImGui.Button("Add test sub"))
{
@ -633,15 +653,18 @@ namespace Dalamud.Interface.Internal.Windows
i2.SendMessage("DalamudTestSub", testMsg);
}
foreach (var ipc in this.dalamud.PluginManager.IpcSubscriptions)
var pluginManager = Service<PluginManager>.Get();
foreach (var ipc in pluginManager.IpcSubscriptions)
ImGui.Text($"Source:{ipc.SourcePluginName} Sub:{ipc.SubPluginName}");
#pragma warning restore CS0618 // Type or member is obsolete
}
private void DrawCondition()
{
var condition = Service<Condition>.Get();
#if DEBUG
ImGui.Text($"ptr: 0x{this.dalamud.ClientState.Condition.ConditionArrayBase.ToInt64():X}");
ImGui.Text($"ptr: 0x{condition.ConditionArrayBase.ToInt64():X}");
#endif
ImGui.Text("Current Conditions:");
@ -652,7 +675,7 @@ namespace Dalamud.Interface.Internal.Windows
for (var i = 0; i < Condition.MaxConditionEntries; i++)
{
var typedCondition = (ConditionFlag)i;
var cond = this.dalamud.ClientState.Condition[typedCondition];
var cond = condition[typedCondition];
if (!cond) continue;
@ -667,7 +690,10 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawGauge()
{
var player = this.dalamud.ClientState.LocalPlayer;
var clientState = Service<ClientState>.Get();
var jobGauges = Service<JobGauges>.Get();
var player = clientState.LocalPlayer;
if (player == null)
{
ImGui.Text("Player is not present");
@ -677,25 +703,25 @@ namespace Dalamud.Interface.Internal.Windows
var jobID = player.ClassJob.Id;
if (jobID == 19)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<PLDGauge>();
var gauge = jobGauges.Get<PLDGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.OathGauge)}: {gauge.OathGauge}");
}
else if (jobID == 20)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<MNKGauge>();
var gauge = jobGauges.Get<MNKGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Chakra)}: {gauge.Chakra}");
}
else if (jobID == 21)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<WARGauge>();
var gauge = jobGauges.Get<WARGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.BeastGauge)}: {gauge.BeastGauge}");
}
else if (jobID == 22)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<DRGGauge>();
var gauge = jobGauges.Get<DRGGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.BOTDTimer)}: {gauge.BOTDTimer}");
ImGui.Text($"{nameof(gauge.BOTDState)}: {gauge.BOTDState}");
@ -703,7 +729,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 23)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<BRDGauge>();
var gauge = jobGauges.Get<BRDGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.SongTimer)}: {gauge.SongTimer}");
ImGui.Text($"{nameof(gauge.Repertoire)}: {gauge.Repertoire}");
@ -712,7 +738,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 24)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<WHMGauge>();
var gauge = jobGauges.Get<WHMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.LilyTimer)}: {gauge.LilyTimer}");
ImGui.Text($"{nameof(gauge.Lily)}: {gauge.Lily}");
@ -720,7 +746,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 25)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<BLMGauge>();
var gauge = jobGauges.Get<BLMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.EnochianTimer)}: {gauge.EnochianTimer}");
ImGui.Text($"{nameof(gauge.ElementTimeRemaining)}: {gauge.ElementTimeRemaining}");
@ -734,7 +760,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 27)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<SMNGauge>();
var gauge = jobGauges.Get<SMNGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.TimerRemaining)}: {gauge.TimerRemaining}");
ImGui.Text($"{nameof(gauge.ReturnSummon)}: {gauge.ReturnSummon}");
@ -746,7 +772,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 28)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<SCHGauge>();
var gauge = jobGauges.Get<SCHGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Aetherflow)}: {gauge.Aetherflow}");
ImGui.Text($"{nameof(gauge.FairyGauge)}: {gauge.FairyGauge}");
@ -755,7 +781,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 30)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<NINGauge>();
var gauge = jobGauges.Get<NINGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.HutonTimer)}: {gauge.HutonTimer}");
ImGui.Text($"{nameof(gauge.Ninki)}: {gauge.Ninki}");
@ -763,7 +789,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 31)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<MCHGauge>();
var gauge = jobGauges.Get<MCHGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.OverheatTimeRemaining)}: {gauge.OverheatTimeRemaining}");
ImGui.Text($"{nameof(gauge.SummonTimeRemaining)}: {gauge.SummonTimeRemaining}");
@ -775,7 +801,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 32)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<DRKGauge>();
var gauge = jobGauges.Get<DRKGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Blood)}: {gauge.Blood}");
ImGui.Text($"{nameof(gauge.DarksideTimeRemaining)}: {gauge.DarksideTimeRemaining}");
@ -784,7 +810,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 33)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<ASTGauge>();
var gauge = jobGauges.Get<ASTGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.DrawnCard)}: {gauge.DrawnCard}");
foreach (var seal in Enum.GetValues(typeof(SealType)).Cast<SealType>())
@ -795,7 +821,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 34)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<SAMGauge>();
var gauge = jobGauges.Get<SAMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Kenki)}: {gauge.Kenki}");
ImGui.Text($"{nameof(gauge.MeditationStacks)}: {gauge.MeditationStacks}");
@ -806,14 +832,14 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 35)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<RDMGauge>();
var gauge = jobGauges.Get<RDMGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.WhiteMana)}: {gauge.WhiteMana}");
ImGui.Text($"{nameof(gauge.BlackMana)}: {gauge.BlackMana}");
}
else if (jobID == 37)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<GNBGauge>();
var gauge = jobGauges.Get<GNBGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Ammo)}: {gauge.Ammo}");
ImGui.Text($"{nameof(gauge.MaxTimerDuration)}: {gauge.MaxTimerDuration}");
@ -821,7 +847,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else if (jobID == 38)
{
var gauge = this.dalamud.ClientState.JobGauges.Get<DNCGauge>();
var gauge = jobGauges.Get<DNCGauge>();
ImGui.Text($"Address: 0x{gauge.Address.ToInt64():X}");
ImGui.Text($"{nameof(gauge.Feathers)}: {gauge.Feathers}");
ImGui.Text($"{nameof(gauge.Esprit)}: {gauge.Esprit}");
@ -837,13 +863,17 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawCommand()
{
foreach (var command in this.dalamud.CommandManager.Commands)
var commandManager = Service<CommandManager>.Get();
foreach (var command in commandManager.Commands)
{
ImGui.Text($"{command.Key}\n -> {command.Value.HelpMessage}\n -> In help: {command.Value.ShowInHelp}\n\n");
}
}
private unsafe void DrawAddon()
{
var gameGui = this.dalamud.Framework.Gui;
var gameGui = Service<GameGui>.Get();
ImGui.InputText("Addon name", ref this.inputAddonName, 256);
ImGui.InputInt("Addon Index", ref this.inputAddonIndex);
@ -880,18 +910,21 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawAddonInspector()
{
this.addonInspector ??= new UIDebug(this.dalamud);
this.addonInspector ??= new UIDebug();
this.addonInspector.Draw();
}
private void DrawStartInfo()
{
ImGui.Text(JsonConvert.SerializeObject(this.dalamud.StartInfo, Formatting.Indented));
var startInfo = Service<DalamudStartInfo>.Get();
ImGui.Text(JsonConvert.SerializeObject(startInfo, Formatting.Indented));
}
private void DrawTarget()
{
var targetMgr = this.dalamud.ClientState.Targets;
var clientState = Service<ClientState>.Get();
var targetMgr = Service<TargetManager>.Get();
if (targetMgr.Target != null)
{
@ -917,7 +950,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Clear FT"))
targetMgr.ClearFocusTarget();
var localPlayer = this.dalamud.ClientState.LocalPlayer;
var localPlayer = clientState.LocalPlayer;
if (localPlayer != null)
{
@ -935,6 +968,8 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawToast()
{
var toastGui = Service<ToastGui>.Get();
ImGui.InputText("Toast text", ref this.inputTextToast, 200);
ImGui.Combo("Toast Position", ref this.toastPosition, new[] { "Bottom", "Top", }, 2);
@ -948,7 +983,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Show toast"))
{
this.dalamud.Framework.Gui.Toast.ShowNormal(this.inputTextToast, new ToastOptions
toastGui.ShowNormal(this.inputTextToast, new ToastOptions
{
Position = (ToastPosition)this.toastPosition,
Speed = (ToastSpeed)this.toastSpeed,
@ -957,7 +992,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Show Quest toast"))
{
this.dalamud.Framework.Gui.Toast.ShowQuest(this.inputTextToast, new QuestToastOptions
toastGui.ShowQuest(this.inputTextToast, new QuestToastOptions
{
Position = (QuestToastPosition)this.questToastPosition,
DisplayCheckmark = this.questToastCheckmark,
@ -968,7 +1003,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Show Error toast"))
{
this.dalamud.Framework.Gui.Toast.ShowError(this.inputTextToast);
toastGui.ShowError(this.inputTextToast);
}
}
@ -999,7 +1034,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Send"))
{
this.dalamud.Framework.Gui.FlyText.AddFlyText(
Service<FlyTextGui>.Get().AddFlyText(
this.flyKind,
unchecked((uint)this.flyActor),
unchecked((uint)this.flyVal1),
@ -1013,11 +1048,13 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawImGui()
{
var interfaceManager = Service<InterfaceManager>.Get();
ImGui.Text("Monitor count: " + ImGui.GetPlatformIO().Monitors.Size);
ImGui.Text("OverrideGameCursor: " + this.dalamud.InterfaceManager.OverrideGameCursor);
ImGui.Text("OverrideGameCursor: " + interfaceManager.OverrideGameCursor);
ImGui.Button("THIS IS A BUTTON###hoverTestButton");
this.dalamud.InterfaceManager.OverrideGameCursor = !ImGui.IsItemHovered();
interfaceManager.OverrideGameCursor = !ImGui.IsItemHovered();
ImGui.Separator();
@ -1048,12 +1085,14 @@ namespace Dalamud.Interface.Internal.Windows
var text = "Bla bla bla bla bla bla bla bla bla bla bla.\nBla bla bla bla bla bla bla bla bla bla bla bla bla bla.";
this.dalamud.InterfaceManager.Notifications.AddNotification(text, title, type);
interfaceManager.Notifications.AddNotification(text, title, type);
}
}
private void DrawTex()
{
var dataManager = Service<DataManager>.Get();
ImGui.InputText("Tex Path", ref this.inputTexPath, 255);
ImGui.InputFloat2("UV0", ref this.inputTexUv0);
ImGui.InputFloat2("UV1", ref this.inputTexUv1);
@ -1064,7 +1103,7 @@ namespace Dalamud.Interface.Internal.Windows
{
try
{
this.debugTex = this.dalamud.Data.GetImGuiTexture(this.inputTexPath);
this.debugTex = dataManager.GetImGuiTexture(this.inputTexPath);
this.inputTexScale = new Vector2(this.debugTex.Width, this.debugTex.Height);
}
catch (Exception ex)
@ -1085,6 +1124,8 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawGamepad()
{
var gamepadState = Service<GamepadState>.Get();
static void DrawHelper(string text, uint mask, Func<GamepadButtons, float> resolve)
{
ImGui.Text($"{text} {mask:X4}");
@ -1106,47 +1147,49 @@ namespace Dalamud.Interface.Internal.Windows
$"R3 {resolve(GamepadButtons.R3)} ");
}
ImGui.Text($"GamepadInput 0x{this.dalamud.ClientState.GamepadState.GamepadInputAddress.ToInt64():X}");
ImGui.Text($"GamepadInput 0x{gamepadState.GamepadInputAddress.ToInt64():X}");
#if DEBUG
if (ImGui.IsItemHovered())
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.IsItemClicked())
ImGui.SetClipboardText($"0x{this.dalamud.ClientState.GamepadState.GamepadInputAddress.ToInt64():X}");
ImGui.SetClipboardText($"0x{gamepadState.GamepadInputAddress.ToInt64():X}");
#endif
DrawHelper(
"Buttons Raw",
this.dalamud.ClientState.GamepadState.ButtonsRaw,
this.dalamud.ClientState.GamepadState.Raw);
gamepadState.ButtonsRaw,
gamepadState.Raw);
DrawHelper(
"Buttons Pressed",
this.dalamud.ClientState.GamepadState.ButtonsPressed,
this.dalamud.ClientState.GamepadState.Pressed);
gamepadState.ButtonsPressed,
gamepadState.Pressed);
DrawHelper(
"Buttons Repeat",
this.dalamud.ClientState.GamepadState.ButtonsRepeat,
this.dalamud.ClientState.GamepadState.Repeat);
gamepadState.ButtonsRepeat,
gamepadState.Repeat);
DrawHelper(
"Buttons Released",
this.dalamud.ClientState.GamepadState.ButtonsReleased,
this.dalamud.ClientState.GamepadState.Released);
ImGui.Text($"LeftStickLeft {this.dalamud.ClientState.GamepadState.LeftStickLeft:0.00} " +
$"LeftStickUp {this.dalamud.ClientState.GamepadState.LeftStickUp:0.00} " +
$"LeftStickRight {this.dalamud.ClientState.GamepadState.LeftStickRight:0.00} " +
$"LeftStickDown {this.dalamud.ClientState.GamepadState.LeftStickDown:0.00} ");
ImGui.Text($"RightStickLeft {this.dalamud.ClientState.GamepadState.RightStickLeft:0.00} " +
$"RightStickUp {this.dalamud.ClientState.GamepadState.RightStickUp:0.00} " +
$"RightStickRight {this.dalamud.ClientState.GamepadState.RightStickRight:0.00} " +
$"RightStickDown {this.dalamud.ClientState.GamepadState.RightStickDown:0.00} ");
gamepadState.ButtonsReleased,
gamepadState.Released);
ImGui.Text($"LeftStickLeft {gamepadState.LeftStickLeft:0.00} " +
$"LeftStickUp {gamepadState.LeftStickUp:0.00} " +
$"LeftStickRight {gamepadState.LeftStickRight:0.00} " +
$"LeftStickDown {gamepadState.LeftStickDown:0.00} ");
ImGui.Text($"RightStickLeft {gamepadState.RightStickLeft:0.00} " +
$"RightStickUp {gamepadState.RightStickUp:0.00} " +
$"RightStickRight {gamepadState.RightStickRight:0.00} " +
$"RightStickDown {gamepadState.RightStickDown:0.00} ");
}
private void Load()
{
if (this.dalamud.Data.IsDataReady)
var dataManager = Service<DataManager>.Get();
if (dataManager.IsDataReady)
{
this.serverOpString = JsonConvert.SerializeObject(this.dalamud.Data.ServerOpCodes, Formatting.Indented);
this.serverOpString = JsonConvert.SerializeObject(dataManager.ServerOpCodes, Formatting.Indented);
this.wasReady = true;
}
}

View file

@ -11,16 +11,12 @@ namespace Dalamud.Interface.Internal.Windows
/// </summary>
internal class IMEWindow : Window
{
private readonly DalamudIME dalamudIME;
/// <summary>
/// Initializes a new instance of the <see cref="IMEWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public IMEWindow(Dalamud dalamud)
public IMEWindow()
: base("Dalamud IME", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoFocusOnAppearing)
{
this.dalamudIME = dalamud.IME;
this.Size = new Vector2(100, 200);
this.SizeCondition = ImGuiCond.FirstUseEver;
}
@ -28,18 +24,20 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public override void Draw()
{
if (this.dalamudIME == null || !this.dalamudIME.IsEnabled)
var ime = Service<DalamudIME>.GetNullable();
if (ime == null || ime.IsEnabled)
{
ImGui.Text("IME unavailable.");
ImGui.Text("IME is unavailable.");
return;
}
ImGui.Text(this.dalamudIME.ImmComp);
ImGui.Text(ime.ImmComp);
ImGui.Separator();
for (var i = 0; i < this.dalamudIME.ImmCand.Count; i++)
for (var i = 0; i < ime.ImmCand.Count; i++)
{
ImGui.Text($"{i + 1}. {this.dalamudIME.ImmCand[i]}");
ImGui.Text($"{i + 1}. {ime.ImmCand[i]}");
}
}
}

View file

@ -10,6 +10,8 @@ using System.Numerics;
using System.Threading.Tasks;
using CheapLoc;
using Dalamud.Configuration.Internal;
using Dalamud.Game.Command;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;
@ -37,8 +39,6 @@ namespace Dalamud.Interface.Internal.Windows
private static readonly ModuleLog Log = new("PLUGINW");
private readonly Dalamud dalamud;
private readonly TextureWrap defaultIcon;
private readonly TextureWrap troubleIcon;
private readonly TextureWrap updateIcon;
@ -72,13 +72,11 @@ namespace Dalamud.Interface.Internal.Windows
/// <summary>
/// Initializes a new instance of the <see cref="PluginInstallerWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public PluginInstallerWindow(Dalamud dalamud)
public PluginInstallerWindow()
: base(
Locs.WindowTitle + (dalamud.Configuration.DoPluginTest ? Locs.WindowTitleMod_Testing : string.Empty) + "###XlPluginInstaller",
Locs.WindowTitle + (Service<DalamudConfiguration>.Get().DoPluginTest ? Locs.WindowTitleMod_Testing : string.Empty) + "###XlPluginInstaller",
ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar)
{
this.dalamud = dalamud;
this.IsOpen = true;
this.Size = new Vector2(830, 570);
@ -90,24 +88,22 @@ namespace Dalamud.Interface.Internal.Windows
MaximumSize = new Vector2(5000, 5000),
};
var dalamud = Service<Dalamud>.Get();
var interfaceManager = Service<InterfaceManager>.Get();
var pluginManager = Service<PluginManager>.Get();
// For debugging
if (this.dalamud.PluginManager.PluginsReady)
if (pluginManager.PluginsReady)
this.OnInstalledPluginsChanged();
this.dalamud.PluginManager.OnAvailablePluginsChanged += this.OnAvailablePluginsChanged;
this.dalamud.PluginManager.OnInstalledPluginsChanged += this.OnInstalledPluginsChanged;
pluginManager.OnAvailablePluginsChanged += this.OnAvailablePluginsChanged;
pluginManager.OnInstalledPluginsChanged += this.OnInstalledPluginsChanged;
this.defaultIcon =
this.dalamud.InterfaceManager.LoadImage(
Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "defaultIcon.png"));
this.defaultIcon = interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "defaultIcon.png"));
this.troubleIcon =
this.dalamud.InterfaceManager.LoadImage(
Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "troubleIcon.png"));
this.troubleIcon = interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "troubleIcon.png"));
this.updateIcon =
this.dalamud.InterfaceManager.LoadImage(
Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "updateIcon.png"));
this.updateIcon = interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "updateIcon.png"));
}
private enum OperationStatus
@ -128,8 +124,10 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public void Dispose()
{
this.dalamud.PluginManager.OnAvailablePluginsChanged -= this.OnAvailablePluginsChanged;
this.dalamud.PluginManager.OnInstalledPluginsChanged -= this.OnInstalledPluginsChanged;
var pluginManager = Service<PluginManager>.Get();
pluginManager.OnAvailablePluginsChanged -= this.OnAvailablePluginsChanged;
pluginManager.OnInstalledPluginsChanged -= this.OnInstalledPluginsChanged;
this.defaultIcon.Dispose();
this.troubleIcon.Dispose();
@ -139,7 +137,9 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public override void OnOpen()
{
Task.Run(this.dalamud.PluginManager.ReloadPluginMasters);
var pluginManager = Service<PluginManager>.Get();
Task.Run(pluginManager.ReloadPluginMasters);
this.updatePluginCount = 0;
this.updatedPlugins = null;
@ -152,7 +152,7 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public override void OnClose()
{
this.dalamud.Configuration.Save();
Service<DalamudConfiguration>.Get().Save();
}
/// <inheritdoc/>
@ -223,6 +223,9 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawFooter()
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
var windowSize = ImGui.GetWindowContentRegionMax();
var placeholderButtonSize = GetButtonSize("placeholder");
@ -235,7 +238,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SameLine();
if (ImGui.Button(Locs.FooterButton_Settings))
{
this.dalamud.DalamudUi.OpenSettings();
Service<DalamudInterface>.Get().OpenSettings();
}
// If any dev plugins are installed, allow a shortcut for the /xldev menu item
@ -244,7 +247,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SameLine();
if (ImGui.Button(Locs.FooterButton_ScanDevPlugins))
{
this.dalamud.PluginManager.ScanDevPlugins();
pluginManager.ScanDevPlugins();
}
}
@ -255,13 +258,17 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button(closeText))
{
this.IsOpen = false;
this.dalamud.Configuration.Save();
configuration.Save();
}
}
private void DrawUpdatePluginsButton()
{
var ready = this.dalamud.PluginManager.PluginsReady && this.dalamud.PluginManager.ReposReady;
var interfaceManager = Service<InterfaceManager>.Get();
var pluginManager = Service<PluginManager>.Get();
var notifications = Service<Notifications>.Get();
var ready = pluginManager.PluginsReady && pluginManager.ReposReady;
if (!ready || this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress)
{
@ -279,7 +286,7 @@ namespace Dalamud.Interface.Internal.Windows
{
this.updateStatus = OperationStatus.InProgress;
Task.Run(() => this.dalamud.PluginManager.UpdatePluginsAsync())
Task.Run(() => pluginManager.UpdatePluginsAsync())
.ContinueWith(task =>
{
this.updateStatus = OperationStatus.Complete;
@ -314,12 +321,12 @@ namespace Dalamud.Interface.Internal.Windows
if (this.updatePluginCount > 0)
{
this.dalamud.PluginManager.PrintUpdatedPlugins(this.updatedPlugins, Locs.PluginUpdateHeader_Chatbox);
this.dalamud.InterfaceManager.Notifications.AddNotification(Locs.Notifications_UpdatesInstalled(this.updatePluginCount), Locs.Notifications_UpdatesInstalledTitle, Notifications.Notification.Type.Success);
pluginManager.PrintUpdatedPlugins(this.updatedPlugins, Locs.PluginUpdateHeader_Chatbox);
notifications.AddNotification(Locs.Notifications_UpdatesInstalled(this.updatePluginCount), Locs.Notifications_UpdatesInstalledTitle, Notifications.Notification.Type.Success);
}
else if (this.updatePluginCount == 0)
{
this.dalamud.InterfaceManager.Notifications.AddNotification(Locs.Notifications_NoUpdatesFound, Locs.Notifications_NoUpdatesFoundTitle, Notifications.Notification.Type.Info);
notifications.AddNotification(Locs.Notifications_NoUpdatesFound, Locs.Notifications_NoUpdatesFoundTitle, Notifications.Notification.Type.Info);
}
}
});
@ -493,14 +500,16 @@ namespace Dalamud.Interface.Internal.Windows
private bool DrawPluginListLoading()
{
var ready = this.dalamud.PluginManager.PluginsReady && this.dalamud.PluginManager.ReposReady;
var pluginManager = Service<PluginManager>.Get();
var ready = pluginManager.PluginsReady && pluginManager.ReposReady;
if (!ready)
{
ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_LoadingPlugins);
}
var failedRepos = this.dalamud.PluginManager.Repos
var failedRepos = pluginManager.Repos
.Where(repo => repo.State == PluginRepositoryState.Fail)
.ToArray();
@ -617,7 +626,12 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawAvailablePlugin(RemotePluginManifest manifest, int index)
{
var useTesting = this.dalamud.PluginManager.UseTesting(manifest);
var configuration = Service<DalamudConfiguration>.Get();
var interfaceManager = Service<InterfaceManager>.Get();
var notifications = Service<Notifications>.Get();
var pluginManager = Service<PluginManager>.Get();
var useTesting = pluginManager.UseTesting(manifest);
var wasSeen = this.WasPluginSeen(manifest.InternalName);
// Check for valid versions
@ -641,7 +655,7 @@ namespace Dalamud.Interface.Internal.Windows
if (this.DrawPluginCollapsingHeader(label, manifest, false, false, !wasSeen, () => this.DrawAvailablePluginContextMenu(manifest), index))
{
if (!wasSeen)
this.dalamud.Configuration.SeenPluginInternalName.Add(manifest.InternalName);
configuration.SeenPluginInternalName.Add(manifest.InternalName);
ImGuiHelpers.ScaledDummy(5);
@ -682,7 +696,7 @@ namespace Dalamud.Interface.Internal.Windows
{
this.installStatus = OperationStatus.InProgress;
Task.Run(() => this.dalamud.PluginManager.InstallPluginAsync(manifest, useTesting, PluginLoadReason.Installer))
Task.Run(() => pluginManager.InstallPluginAsync(manifest, useTesting, PluginLoadReason.Installer))
.ContinueWith(task =>
{
// There is no need to set as Complete for an individual plugin installation
@ -691,11 +705,11 @@ namespace Dalamud.Interface.Internal.Windows
{
if (task.Result.State == PluginState.Loaded)
{
this.dalamud.InterfaceManager.Notifications.AddNotification(Locs.Notifications_PluginInstalled(manifest.Name), Locs.Notifications_PluginInstalledTitle, Notifications.Notification.Type.Success);
notifications.AddNotification(Locs.Notifications_PluginInstalled(manifest.Name), Locs.Notifications_PluginInstalledTitle, Notifications.Notification.Type.Success);
}
else
{
this.dalamud.InterfaceManager.Notifications.AddNotification(Locs.Notifications_PluginNotInstalled(manifest.Name), Locs.Notifications_PluginNotInstalledTitle, Notifications.Notification.Type.Error);
notifications.AddNotification(Locs.Notifications_PluginNotInstalled(manifest.Name), Locs.Notifications_PluginNotInstalledTitle, Notifications.Notification.Type.Error);
this.ShowErrorModal(Locs.ErrorModal_InstallFail(manifest.Name));
}
}
@ -718,21 +732,25 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawAvailablePluginContextMenu(PluginManifest manifest)
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
var startInfo = Service<DalamudStartInfo>.Get();
if (ImGui.BeginPopupContextItem("ItemContextMenu"))
{
if (ImGui.Selectable(Locs.PluginContext_MarkAllSeen))
{
this.dalamud.Configuration.SeenPluginInternalName.AddRange(this.pluginListAvailable.Select(x => x.InternalName));
this.dalamud.Configuration.Save();
this.dalamud.PluginManager.RefilterPluginMasters();
configuration.SeenPluginInternalName.AddRange(this.pluginListAvailable.Select(x => x.InternalName));
configuration.Save();
pluginManager.RefilterPluginMasters();
}
if (ImGui.Selectable(Locs.PluginContext_HidePlugin))
{
Log.Debug($"Adding {manifest.InternalName} to hidden plugins");
this.dalamud.Configuration.HiddenPluginInternalName.Add(manifest.InternalName);
this.dalamud.Configuration.Save();
this.dalamud.PluginManager.RefilterPluginMasters();
configuration.HiddenPluginInternalName.Add(manifest.InternalName);
configuration.Save();
pluginManager.RefilterPluginMasters();
}
if (ImGui.Selectable(Locs.PluginContext_DeletePluginConfig))
@ -743,9 +761,9 @@ namespace Dalamud.Interface.Internal.Windows
Task.Run(() =>
{
this.dalamud.PluginManager.PluginConfigs.Delete(manifest.InternalName);
pluginManager.PluginConfigs.Delete(manifest.InternalName);
var path = Path.Combine(this.dalamud.StartInfo.PluginDirectory, manifest.InternalName);
var path = Path.Combine(startInfo.PluginDirectory, manifest.InternalName);
if (Directory.Exists(path))
Directory.Delete(path, true);
})
@ -763,6 +781,11 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawInstalledPlugin(LocalPlugin plugin, int index, bool showInstalled = false)
{
var configuration = Service<DalamudConfiguration>.Get();
var commandManager = Service<CommandManager>.Get();
var pluginManager = Service<PluginManager>.Get();
var startInfo = Service<DalamudStartInfo>.Get();
var trouble = false;
// Name
@ -837,7 +860,7 @@ namespace Dalamud.Interface.Internal.Windows
if (this.DrawPluginCollapsingHeader(label, plugin.Manifest, trouble, availablePluginUpdate != default, false, () => this.DrawInstalledPluginContextMenu(plugin), index))
{
if (!this.WasPluginSeen(plugin.Manifest.InternalName))
this.dalamud.Configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName);
configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName);
var manifest = plugin.Manifest;
@ -884,7 +907,7 @@ namespace Dalamud.Interface.Internal.Windows
// Available commands (if loaded)
if (plugin.IsLoaded)
{
var commands = this.dalamud.CommandManager.Commands.Where(cInfo => cInfo.Value.ShowInHelp && cInfo.Value.LoaderAssemblyName == plugin.Manifest.InternalName);
var commands = commandManager.Commands.Where(cInfo => cInfo.Value.ShowInHelp && cInfo.Value.LoaderAssemblyName == plugin.Manifest.InternalName);
if (commands.Any())
{
ImGui.Dummy(ImGuiHelpers.ScaledVector2(10f, 10f));
@ -926,6 +949,8 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawInstalledPluginContextMenu(LocalPlugin plugin)
{
var pluginManager = Service<PluginManager>.Get();
if (ImGui.BeginPopupContextItem("InstalledItemContextMenu"))
{
if (ImGui.Selectable(Locs.PluginContext_DeletePluginConfigReload))
@ -934,7 +959,7 @@ namespace Dalamud.Interface.Internal.Windows
this.installStatus = OperationStatus.InProgress;
Task.Run(() => this.dalamud.PluginManager.DeleteConfiguration(plugin))
Task.Run(() => pluginManager.DeleteConfiguration(plugin))
.ContinueWith(task =>
{
this.installStatus = OperationStatus.Idle;
@ -949,11 +974,16 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawPluginControlButton(LocalPlugin plugin)
{
var configuration = Service<DalamudConfiguration>.Get();
var notifications = Service<Notifications>.Get();
var pluginManager = Service<PluginManager>.Get();
var startInfo = Service<DalamudStartInfo>.Get();
// Disable everything if the updater is running or another plugin is operating
var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress;
// Disable everything if the plugin is outdated
disabled = disabled || (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !this.dalamud.Configuration.LoadAllApiLevels);
disabled = disabled || (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !configuration.LoadAllApiLevels);
if (plugin.State == PluginState.InProgress)
{
@ -987,10 +1017,10 @@ namespace Dalamud.Interface.Internal.Windows
if (!plugin.IsDev)
{
this.dalamud.PluginManager.RemovePlugin(plugin);
pluginManager.RemovePlugin(plugin);
}
this.dalamud.InterfaceManager.Notifications.AddNotification(Locs.Notifications_PluginDisabled(plugin.Manifest.Name), Locs.Notifications_PluginDisabledTitle, Notifications.Notification.Type.Success);
notifications.AddNotification(Locs.Notifications_PluginDisabled(plugin.Manifest.Name), Locs.Notifications_PluginDisabledTitle, Notifications.Notification.Type.Success);
});
}
}
@ -1041,13 +1071,15 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawUpdateSinglePluginButton(AvailablePluginUpdate update)
{
var pluginManager = Service<PluginManager>.Get();
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Download))
{
this.installStatus = OperationStatus.InProgress;
Task.Run(() => this.dalamud.PluginManager.UpdateSinglePluginAsync(update, true, false))
Task.Run(() => pluginManager.UpdateSinglePluginAsync(update, true, false))
.ContinueWith(task =>
{
// There is no need to set as Complete for an individual plugin installation
@ -1093,6 +1125,9 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawDevPluginButtons(LocalPlugin localPlugin)
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
if (localPlugin is LocalDevPlugin plugin)
{
// https://colorswall.com/palette/2868/
@ -1107,7 +1142,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGuiComponents.IconButton(FontAwesomeIcon.PowerOff))
{
plugin.StartOnBoot ^= true;
this.dalamud.Configuration.Save();
configuration.Save();
}
ImGui.PopStyleColor(2);
@ -1125,7 +1160,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGuiComponents.IconButton(FontAwesomeIcon.SyncAlt))
{
plugin.AutomaticReload ^= true;
this.dalamud.Configuration.Save();
configuration.Save();
}
ImGui.PopStyleColor(2);
@ -1144,7 +1179,7 @@ namespace Dalamud.Interface.Internal.Windows
try
{
plugin.DllFile.Delete();
this.dalamud.PluginManager.RemovePlugin(plugin);
pluginManager.RemovePlugin(plugin);
}
catch (Exception ex)
{
@ -1281,12 +1316,14 @@ namespace Dalamud.Interface.Internal.Windows
private void OnAvailablePluginsChanged()
{
var pluginManager = Service<PluginManager>.Get();
// By removing installed plugins only when the available plugin list changes (basically when the window is
// opened), plugins that have been newly installed remain in the available plugin list as installed.
this.pluginListAvailable = this.dalamud.PluginManager.AvailablePlugins
this.pluginListAvailable = pluginManager.AvailablePlugins
.Where(manifest => !this.IsManifestInstalled(manifest).IsInstalled)
.ToList();
this.pluginListUpdatable = this.dalamud.PluginManager.UpdatablePlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.ResortPlugins();
this.DownloadPluginIcons();
@ -1294,8 +1331,10 @@ namespace Dalamud.Interface.Internal.Windows
private void OnInstalledPluginsChanged()
{
this.pluginListInstalled = this.dalamud.PluginManager.InstalledPlugins.ToList();
this.pluginListUpdatable = this.dalamud.PluginManager.UpdatablePlugins.ToList();
var pluginManager = Service<PluginManager>.Get();
this.pluginListInstalled = pluginManager.InstalledPlugins.ToList();
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
this.hasDevPlugins = this.pluginListInstalled.Any(plugin => plugin.IsDev);
this.ResortPlugins();
@ -1330,7 +1369,7 @@ namespace Dalamud.Interface.Internal.Windows
}
private bool WasPluginSeen(string internalName) =>
this.dalamud.Configuration.SeenPluginInternalName.Contains(internalName);
Service<DalamudConfiguration>.Get().SeenPluginInternalName.Contains(internalName);
/// <summary>
/// A continuation task that displays any errors received into the error modal.
@ -1410,6 +1449,8 @@ namespace Dalamud.Interface.Internal.Windows
private async Task DownloadPluginIconAsync(PluginManifest manifest)
{
var interfaceManager = Service<InterfaceManager>.Get();
Log.Verbose($"Downloading icon for {manifest.InternalName}");
this.pluginIconMap.Add(manifest.InternalName, (false, null));
@ -1419,7 +1460,7 @@ namespace Dalamud.Interface.Internal.Windows
{
var data = await client.GetAsync(manifest.IconUrl);
data.EnsureSuccessStatusCode();
var icon = this.dalamud.InterfaceManager.LoadImage(await data.Content.ReadAsByteArrayAsync());
var icon = interfaceManager.LoadImage(await data.Content.ReadAsByteArrayAsync());
if (icon != null)
{
@ -1436,6 +1477,8 @@ namespace Dalamud.Interface.Internal.Windows
private async Task DownloadPluginImagesAsync(PluginManifest manifest)
{
var interfaceManager = Service<InterfaceManager>.Get();
Log.Verbose($"Downloading images for {manifest.InternalName}");
this.pluginImagesMap.Add(manifest.InternalName, (false, null));
@ -1455,7 +1498,7 @@ namespace Dalamud.Interface.Internal.Windows
{
var data = await client.GetAsync(manifest.ImageUrls[i]);
data.EnsureSuccessStatusCode();
var image = this.dalamud.InterfaceManager.LoadImage(await data.Content.ReadAsByteArrayAsync());
var image = interfaceManager.LoadImage(await data.Content.ReadAsByteArrayAsync());
if (image == null)
{

View file

@ -17,22 +17,21 @@ namespace Dalamud.Interface.Internal.Windows
/// </summary>
internal class PluginStatWindow : Window
{
private readonly PluginManager pluginManager;
private bool showDalamudHooks;
/// <summary>
/// Initializes a new instance of the <see cref="PluginStatWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public PluginStatWindow(Dalamud dalamud)
public PluginStatWindow()
: base("Plugin Statistics###DalamudPluginStatWindow")
{
this.pluginManager = dalamud.PluginManager;
}
/// <inheritdoc/>
public override void Draw()
{
var pluginManager = Service<PluginManager>.Get();
ImGui.BeginTabBar("Stat Tabs");
if (ImGui.BeginTabItem("Draw times"))
@ -49,7 +48,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SameLine();
if (ImGui.Button("Reset"))
{
foreach (var plugin in this.pluginManager.InstalledPlugins)
foreach (var plugin in pluginManager.InstalledPlugins)
{
plugin.DalamudInterface.UiBuilder.LastDrawTime = -1;
plugin.DalamudInterface.UiBuilder.MaxDrawTime = -1;
@ -77,7 +76,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Separator();
foreach (var plugin in this.pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded))
foreach (var plugin in pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded))
{
ImGui.Text(plugin.Manifest.Name);
ImGui.NextColumn();

View file

@ -16,7 +16,6 @@ namespace Dalamud.Interface.Internal.Windows
/// </summary>
internal class ScratchpadWindow : Window, IDisposable
{
private readonly Dalamud dalamud;
private readonly List<ScratchpadDocument> documents = new();
private readonly ScratchFileWatcher watcher = new();
private string pathInput = string.Empty;
@ -24,11 +23,9 @@ namespace Dalamud.Interface.Internal.Windows
/// <summary>
/// Initializes a new instance of the <see cref="ScratchpadWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud instance.</param>
public ScratchpadWindow(Dalamud dalamud)
public ScratchpadWindow()
: base("Plugin Scratchpad", ImGuiWindowFlags.MenuBar)
{
this.dalamud = dalamud;
this.documents.Add(new ScratchpadDocument());
this.SizeConstraints = new WindowSizeConstraints
@ -37,7 +34,7 @@ namespace Dalamud.Interface.Internal.Windows
MaximumSize = new Vector2(1000, 1000),
};
this.Execution = new ScratchExecutionManager(dalamud);
this.Execution = new ScratchExecutionManager();
}
/// <summary>
@ -143,7 +140,7 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button("Toggle Log"))
{
this.dalamud.DalamudUi.ToggleLogWindow();
Service<DalamudInterface>.Get().ToggleLogWindow();
}
ImGui.SameLine();

View file

@ -1,3 +1,4 @@
using Dalamud.Game.ClientState.Objects;
using Dalamud.Utility;
using ImGuiNET;
@ -14,16 +15,18 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test ActorTable";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var objectTable = Service<ObjectTable>.Get();
ImGui.Text("Checking actor table...");
if (this.index == dalamud.ClientState.Objects.Length - 1)
if (this.index == objectTable.Length - 1)
{
return SelfTestStepResult.Pass;
}
var actor = dalamud.ClientState.Objects[this.index];
var actor = objectTable[this.index];
this.index++;
if (actor == null)
@ -37,7 +40,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,5 @@
using Dalamud.Game.Text;
using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using ImGuiNET;
@ -17,12 +18,14 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Chat";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var chatGui = Service<ChatGui>.Get();
switch (this.step)
{
case 0:
dalamud.Framework.Gui.Chat.Print("Testing!");
chatGui.Print("Testing!");
this.step++;
break;
@ -33,12 +36,12 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
if (!this.subscribed)
{
this.subscribed = true;
dalamud.Framework.Gui.Chat.ChatMessage += this.ChatOnOnChatMessage;
chatGui.ChatMessage += this.ChatOnOnChatMessage;
}
if (this.hasPassed)
{
dalamud.Framework.Gui.Chat.ChatMessage -= this.ChatOnOnChatMessage;
chatGui.ChatMessage -= this.ChatOnOnChatMessage;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
@ -50,9 +53,11 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
dalamud.Framework.Gui.Chat.ChatMessage -= this.ChatOnOnChatMessage;
var chatGui = Service<ChatGui>.Get();
chatGui.ChatMessage -= this.ChatOnOnChatMessage;
this.subscribed = false;
}

View file

@ -1,4 +1,4 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Conditions;
using ImGuiNET;
using Serilog;
@ -13,9 +13,11 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Condition";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
if (!dalamud.ClientState.Condition.Any())
var condition = Service<Condition>.Get();
if (!condition.Any())
{
Log.Error("No condition flags present.");
return SelfTestStepResult.Fail;
@ -23,11 +25,11 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
ImGui.Text("Please jump...");
return dalamud.ClientState.Condition[ConditionFlag.Jumping] ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting;
return condition[ConditionFlag.Jumping] ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting;
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,5 @@
using ImGuiNET;
using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
@ -27,19 +28,21 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => $"Enter Terri: {this.terriName}";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var clientState = Service<ClientState>.Get();
ImGui.TextUnformatted(this.Name);
if (!this.subscribed)
{
dalamud.ClientState.TerritoryChanged += this.ClientStateOnTerritoryChanged;
clientState.TerritoryChanged += this.ClientStateOnTerritoryChanged;
this.subscribed = true;
}
if (this.hasPassed)
{
dalamud.ClientState.TerritoryChanged -= this.ClientStateOnTerritoryChanged;
clientState.TerritoryChanged -= this.ClientStateOnTerritoryChanged;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
@ -48,9 +51,11 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
dalamud.ClientState.TerritoryChanged -= this.ClientStateOnTerritoryChanged;
var clientState = Service<ClientState>.Get();
clientState.TerritoryChanged -= this.ClientStateOnTerritoryChanged;
this.subscribed = false;
}

View file

@ -1,4 +1,5 @@
using Dalamud.Utility;
using Dalamud.Game.ClientState.Fates;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -14,16 +15,18 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test FateTable";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var fateTable = Service<FateTable>.Get();
ImGui.Text("Checking fate table...");
if (this.index == dalamud.ClientState.Fates.Length - 1)
if (this.index == fateTable.Length - 1)
{
return SelfTestStepResult.Pass;
}
var actor = dalamud.ClientState.Fates[this.index];
var actor = fateTable[this.index];
this.index++;
if (actor == null)
@ -37,7 +40,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,4 @@
using Dalamud.Game.ClientState.GamePad;
using Dalamud.Game.ClientState.GamePad;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -12,13 +12,15 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test GamePadState";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var gamepadState = Service<GamepadState>.Get();
ImGui.Text("Hold down North, East, L1");
if (dalamud.ClientState.GamepadState.Pressed(GamepadButtons.North) == 1
&& dalamud.ClientState.GamepadState.Pressed(GamepadButtons.East) == 1
&& dalamud.ClientState.GamepadState.Pressed(GamepadButtons.L1) == 1)
if (gamepadState.Pressed(GamepadButtons.North) == 1
&& gamepadState.Pressed(GamepadButtons.East) == 1
&& gamepadState.Pressed(GamepadButtons.L1) == 1)
{
return SelfTestStepResult.Pass;
}
@ -27,7 +29,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -12,7 +12,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Handled Exception";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
try
{
@ -27,7 +27,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,4 @@
using Dalamud.Game.Gui;
using Dalamud.Game.Gui;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -15,16 +15,15 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Hover";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var hoverItem = dalamud.Framework.Gui.HoveredItem;
var hoverAction = dalamud.Framework.Gui.HoveredAction;
var gameGui = Service<GameGui>.Get();
if (!this.clearedItem)
{
ImGui.Text("Hover WHM soul crystal...");
if (hoverItem == 4547)
if (gameGui.HoveredItem == 4547)
{
this.clearedItem = true;
}
@ -34,8 +33,9 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
ImGui.Text("Hover \"Open Linkshells\" action...");
if (hoverAction != null && hoverAction.ActionKind == HoverActionKind.MainCommand &&
hoverAction.ActionID == 28)
if (gameGui.HoveredAction != null &&
gameGui.HoveredAction.ActionKind == HoverActionKind.MainCommand &&
gameGui.HoveredAction.ActionID == 28)
{
this.clearedAction = true;
}
@ -50,7 +50,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,4 @@
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
/// <summary>
/// Interface for test implementations.
@ -13,14 +13,12 @@
/// <summary>
/// Run the test step, once per frame it is active.
/// </summary>
/// <param name="dalamud">Dalamud instance to act on.</param>
/// <returns>The result of this frame, test is discarded once a result other than <see cref="SelfTestStepResult.Waiting"/> is returned.</returns>
public SelfTestStepResult RunStep(Dalamud dalamud);
public SelfTestStepResult RunStep();
/// <summary>
/// Clean up this test.
/// </summary>
/// <param name="dalamud">Dalamud instance to act on.</param>
public void CleanUp(Dalamud dalamud);
public void CleanUp();
}
}

View file

@ -1,4 +1,4 @@
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.ClientState.Keys;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -12,15 +12,17 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test KeyState";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var keyState = Service<KeyState>.Get();
ImGui.Text("Hold down D,A,L,M,U");
if (dalamud.ClientState.KeyState[VirtualKey.D]
&& dalamud.ClientState.KeyState[VirtualKey.A]
&& dalamud.ClientState.KeyState[VirtualKey.L]
&& dalamud.ClientState.KeyState[VirtualKey.M]
&& dalamud.ClientState.KeyState[VirtualKey.U])
if (keyState[VirtualKey.D]
&& keyState[VirtualKey.A]
&& keyState[VirtualKey.L]
&& keyState[VirtualKey.M]
&& keyState[VirtualKey.U])
{
return SelfTestStepResult.Pass;
}
@ -29,7 +31,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,5 +1,6 @@
using System;
using System;
using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -16,19 +17,21 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Log-In";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var clientState = Service<ClientState>.Get();
ImGui.Text("Log in now...");
if (!this.subscribed)
{
dalamud.ClientState.Login += this.ClientStateOnOnLogin;
clientState.Login += this.ClientStateOnOnLogin;
this.subscribed = true;
}
if (this.hasPassed)
{
dalamud.ClientState.Login -= this.ClientStateOnOnLogin;
clientState.Login -= this.ClientStateOnOnLogin;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
@ -37,11 +40,13 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
var clientState = Service<ClientState>.Get();
if (this.subscribed)
{
dalamud.ClientState.Login -= this.ClientStateOnOnLogin;
clientState.Login -= this.ClientStateOnOnLogin;
this.subscribed = false;
}
}

View file

@ -1,5 +1,6 @@
using System;
using System;
using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -16,19 +17,21 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Log-In";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var clientState = Service<ClientState>.Get();
ImGui.Text("Log out now...");
if (!this.subscribed)
{
dalamud.ClientState.Logout += this.ClientStateOnOnLogout;
clientState.Logout += this.ClientStateOnOnLogout;
this.subscribed = true;
}
if (this.hasPassed)
{
dalamud.ClientState.Logout -= this.ClientStateOnOnLogout;
clientState.Logout -= this.ClientStateOnOnLogout;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
@ -37,11 +40,13 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
var clientState = Service<ClientState>.Get();
if (this.subscribed)
{
dalamud.ClientState.Logout -= this.ClientStateOnOnLogout;
clientState.Logout -= this.ClientStateOnOnLogout;
this.subscribed = false;
}
}

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Data;
using Dalamud.Utility;
using Lumina.Excel;
@ -20,9 +21,11 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Lumina";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
this.rows ??= dalamud.Data.GetExcelSheet<T>().ToList();
var dataManager = Service<DataManager>.Get();
this.rows ??= dataManager.GetExcelSheet<T>().ToList();
Util.ShowObject(this.rows[this.step]);
@ -31,7 +34,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,5 @@
using Dalamud.Game.Gui.PartyFinder.Types;
using Dalamud.Game.Gui.PartyFinder;
using Dalamud.Game.Gui.PartyFinder.Types;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
@ -15,17 +16,19 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Party Finder";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var partyFinderGui = Service<PartyFinderGui>.Get();
if (!this.subscribed)
{
dalamud.Framework.Gui.PartyFinder.ReceiveListing += this.PartyFinderOnReceiveListing;
partyFinderGui.ReceiveListing += this.PartyFinderOnReceiveListing;
this.subscribed = true;
}
if (this.hasPassed)
{
dalamud.Framework.Gui.PartyFinder.ReceiveListing -= this.PartyFinderOnReceiveListing;
partyFinderGui.ReceiveListing -= this.PartyFinderOnReceiveListing;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
@ -36,11 +39,13 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
var partyFinderGui = Service<PartyFinderGui>.Get();
if (this.subscribed)
{
dalamud.Framework.Gui.PartyFinder.ReceiveListing -= this.PartyFinderOnReceiveListing;
partyFinderGui.ReceiveListing -= this.PartyFinderOnReceiveListing;
this.subscribed = false;
}
}

View file

@ -1,3 +1,4 @@
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using ImGuiNET;
@ -15,13 +16,15 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
public string Name => "Test Target";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
var targetManager = Service<TargetManager>.Get();
switch (this.step)
{
case 0:
dalamud.ClientState.Targets.ClearTarget();
dalamud.ClientState.Targets.ClearFocusTarget();
targetManager.ClearTarget();
targetManager.ClearFocusTarget();
this.step++;
@ -30,7 +33,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
case 1:
ImGui.Text("Target a player...");
var cTarget = dalamud.ClientState.Targets.Target;
var cTarget = targetManager.Target;
if (cTarget is PlayerCharacter)
{
this.step++;
@ -41,7 +44,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
case 2:
ImGui.Text("Focus-Target a Battle NPC...");
var fTarget = dalamud.ClientState.Targets.FocusTarget;
var fTarget = targetManager.FocusTarget;
if (fTarget is BattleNpc)
{
this.step++;
@ -52,7 +55,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
case 3:
ImGui.Text("Soft-Target an EventObj...");
var sTarget = dalamud.ClientState.Targets.FocusTarget;
var sTarget = targetManager.FocusTarget;
if (sTarget is EventObj)
{
return SelfTestStepResult.Pass;
@ -65,7 +68,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,6 @@
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
using Dalamud.Game.Gui.Toast;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
/// <summary>
/// Test setup for toasts.
@ -9,16 +11,18 @@
public string Name => "Test Toasts";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
dalamud.Framework.Gui.Toast.ShowNormal("Normal Toast");
dalamud.Framework.Gui.Toast.ShowError("Error Toast");
var toastGui = Service<ToastGui>.Get();
toastGui.ShowNormal("Normal Toast");
toastGui.ShowError("Error Toast");
return SelfTestStepResult.Pass;
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
// ignored
}

View file

@ -1,4 +1,4 @@
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
/// <summary>
/// Test that waits N frames.
@ -22,7 +22,7 @@
public string Name => $"Wait {this.cFrames} frames";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
public SelfTestStepResult RunStep()
{
this.cFrames--;
@ -30,7 +30,7 @@
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
public void CleanUp()
{
this.cFrames = this.frames;
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
@ -20,8 +20,6 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest
{
private static readonly ModuleLog Log = new("AGING");
private readonly Dalamud dalamud;
private readonly List<IAgingStep> steps =
new()
{
@ -53,12 +51,9 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest
/// <summary>
/// Initializes a new instance of the <see cref="SelfTestWindow"/> class.
/// </summary>
/// <param name="dalamud">The dalamud instance to act on.</param>
public SelfTestWindow(Dalamud dalamud)
public SelfTestWindow()
: base("Dalamud Self-Test", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.dalamud = dalamud;
this.Size = new Vector2(800, 800);
this.SizeCondition = ImGuiCond.FirstUseEver;
}
@ -142,7 +137,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest
SelfTestStepResult result;
try
{
result = step.RunStep(this.dalamud);
result = step.RunStep();
}
catch (Exception ex)
{
@ -248,7 +243,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest
{
try
{
agingStep.CleanUp(this.dalamud);
agingStep.CleanUp();
}
catch (Exception ex)
{

View file

@ -7,10 +7,12 @@ using System.Threading.Tasks;
using CheapLoc;
using Dalamud.Configuration;
using Dalamud.Configuration.Internal;
using Dalamud.Game.Text;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Internal;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows
@ -23,8 +25,6 @@ namespace Dalamud.Interface.Internal.Windows
private const float MinScale = 0.3f;
private const float MaxScale = 2.0f;
private readonly Dalamud dalamud;
private readonly string[] languages;
private readonly string[] locLanguages;
private int langIndex;
@ -68,41 +68,40 @@ namespace Dalamud.Interface.Internal.Windows
/// <summary>
/// Initializes a new instance of the <see cref="SettingsWindow"/> class.
/// </summary>
/// <param name="dalamud">The Dalamud Instance.</param>
public SettingsWindow(Dalamud dalamud)
public SettingsWindow()
: base(Loc.Localize("DalamudSettingsHeader", "Dalamud Settings") + "###XlSettings2", ImGuiWindowFlags.NoCollapse)
{
this.dalamud = dalamud;
var configuration = Service<DalamudConfiguration>.Get();
this.Size = new Vector2(740, 550);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.dalamudMessagesChatType = this.dalamud.Configuration.GeneralChatType;
this.dalamudMessagesChatType = configuration.GeneralChatType;
this.doCfTaskBarFlash = this.dalamud.Configuration.DutyFinderTaskbarFlash;
this.doCfChatMessage = this.dalamud.Configuration.DutyFinderChatMessage;
this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash;
this.doCfChatMessage = configuration.DutyFinderChatMessage;
this.globalUiScale = this.dalamud.Configuration.GlobalUiScale;
this.doToggleUiHide = this.dalamud.Configuration.ToggleUiHide;
this.doToggleUiHideDuringCutscenes = this.dalamud.Configuration.ToggleUiHideDuringCutscenes;
this.doToggleUiHideDuringGpose = this.dalamud.Configuration.ToggleUiHideDuringGpose;
this.globalUiScale = configuration.GlobalUiScale;
this.doToggleUiHide = configuration.ToggleUiHide;
this.doToggleUiHideDuringCutscenes = configuration.ToggleUiHideDuringCutscenes;
this.doToggleUiHideDuringGpose = configuration.ToggleUiHideDuringGpose;
this.doDocking = this.dalamud.Configuration.IsDocking;
this.doViewport = !this.dalamud.Configuration.IsDisableViewport;
this.doGamepad = this.dalamud.Configuration.IsGamepadNavigationEnabled;
this.doDocking = configuration.IsDocking;
this.doViewport = !configuration.IsDisableViewport;
this.doGamepad = configuration.IsGamepadNavigationEnabled;
this.doPluginTest = this.dalamud.Configuration.DoPluginTest;
this.thirdRepoList = this.dalamud.Configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = this.dalamud.Configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
this.doPluginTest = configuration.DoPluginTest;
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
this.printPluginsWelcomeMsg = this.dalamud.Configuration.PrintPluginsWelcomeMsg;
this.autoUpdatePlugins = this.dalamud.Configuration.AutoUpdatePlugins;
this.doButtonsSystemMenu = this.dalamud.Configuration.DoButtonsSystemMenu;
this.printPluginsWelcomeMsg = configuration.PrintPluginsWelcomeMsg;
this.autoUpdatePlugins = configuration.AutoUpdatePlugins;
this.doButtonsSystemMenu = configuration.DoButtonsSystemMenu;
this.languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
try
{
if (string.IsNullOrEmpty(this.dalamud.Configuration.LanguageOverride))
if (string.IsNullOrEmpty(configuration.LanguageOverride))
{
var currentUiLang = CultureInfo.CurrentUICulture;
@ -113,7 +112,7 @@ namespace Dalamud.Interface.Internal.Windows
}
else
{
this.langIndex = Array.IndexOf(this.languages, this.dalamud.Configuration.LanguageOverride);
this.langIndex = Array.IndexOf(this.languages, configuration.LanguageOverride);
}
}
catch (Exception)
@ -156,14 +155,19 @@ namespace Dalamud.Interface.Internal.Windows
/// <inheritdoc/>
public override void OnClose()
{
ImGui.GetIO().FontGlobalScale = this.dalamud.Configuration.GlobalUiScale;
this.thirdRepoList = this.dalamud.Configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = this.dalamud.Configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
var configuration = Service<DalamudConfiguration>.Get();
ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale;
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
}
/// <inheritdoc/>
public override void Draw()
{
var configuration = Service<DalamudConfiguration>.Get();
var pluginManager = Service<PluginManager>.Get();
var windowSize = ImGui.GetWindowSize();
ImGui.BeginChild("scrolling", new Vector2(windowSize.X - 5 - (5 * ImGuiHelpers.GlobalScale), windowSize.Y - 35 - (35 * ImGuiHelpers.GlobalScale)), false, ImGuiWindowFlags.HorizontalScrollbar);
@ -273,8 +277,8 @@ namespace Dalamud.Interface.Internal.Windows
if (ImGui.Button(Loc.Localize("DalamudSettingsClearHidden", "Clear hidden plugins")))
{
this.dalamud.Configuration.HiddenPluginInternalName.Clear();
this.dalamud.PluginManager.RefilterPluginMasters();
configuration.HiddenPluginInternalName.Clear();
pluginManager.RefilterPluginMasters();
}
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsClearHiddenHint", "Restore plugins you have previously hidden from the plugin installer."));
@ -525,13 +529,13 @@ namespace Dalamud.Interface.Internal.Windows
if (this.thirdRepoListChanged)
{
this.dalamud.PluginManager.SetPluginReposFromConfig(true);
pluginManager.SetPluginReposFromConfig(true);
this.thirdRepoListChanged = false;
}
if (this.devPluginLocationsChanged)
{
this.dalamud.PluginManager.ScanDevPlugins();
pluginManager.ScanDevPlugins();
this.devPluginLocationsChanged = false;
}
}
@ -544,27 +548,30 @@ namespace Dalamud.Interface.Internal.Windows
private void Save()
{
this.dalamud.LocalizationManager.SetupWithLangCode(this.languages[this.langIndex]);
this.dalamud.Configuration.LanguageOverride = this.languages[this.langIndex];
var configuration = Service<DalamudConfiguration>.Get();
var localization = Service<Localization>.Get();
this.dalamud.Configuration.GeneralChatType = this.dalamudMessagesChatType;
localization.SetupWithLangCode(this.languages[this.langIndex]);
configuration.LanguageOverride = this.languages[this.langIndex];
this.dalamud.Configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;
this.dalamud.Configuration.DutyFinderChatMessage = this.doCfChatMessage;
configuration.GeneralChatType = this.dalamudMessagesChatType;
this.dalamud.Configuration.GlobalUiScale = this.globalUiScale;
this.dalamud.Configuration.ToggleUiHide = this.doToggleUiHide;
this.dalamud.Configuration.ToggleUiHideDuringCutscenes = this.doToggleUiHideDuringCutscenes;
this.dalamud.Configuration.ToggleUiHideDuringGpose = this.doToggleUiHideDuringGpose;
configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;
configuration.DutyFinderChatMessage = this.doCfChatMessage;
this.dalamud.Configuration.IsDocking = this.doDocking;
this.dalamud.Configuration.IsGamepadNavigationEnabled = this.doGamepad;
configuration.GlobalUiScale = this.globalUiScale;
configuration.ToggleUiHide = this.doToggleUiHide;
configuration.ToggleUiHideDuringCutscenes = this.doToggleUiHideDuringCutscenes;
configuration.ToggleUiHideDuringGpose = this.doToggleUiHideDuringGpose;
configuration.IsDocking = this.doDocking;
configuration.IsGamepadNavigationEnabled = this.doGamepad;
// This is applied every frame in InterfaceManager::CheckViewportState()
this.dalamud.Configuration.IsDisableViewport = !this.doViewport;
configuration.IsDisableViewport = !this.doViewport;
// Apply docking flag
if (!this.dalamud.Configuration.IsDocking)
if (!configuration.IsDocking)
{
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.DockingEnable;
}
@ -574,7 +581,7 @@ namespace Dalamud.Interface.Internal.Windows
}
// NOTE (Chiv) Toggle gamepad navigation via setting
if (!this.dalamud.Configuration.IsGamepadNavigationEnabled)
if (!configuration.IsGamepadNavigationEnabled)
{
ImGui.GetIO().BackendFlags &= ~ImGuiBackendFlags.HasGamepad;
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.NavEnableSetMousePos;
@ -585,17 +592,17 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.GetIO().ConfigFlags |= ImGuiConfigFlags.NavEnableSetMousePos;
}
this.dalamud.Configuration.DoPluginTest = this.doPluginTest;
this.dalamud.Configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
this.dalamud.Configuration.DevPluginLoadLocations = this.devPluginLocations.Select(x => x.Clone()).ToList();
configuration.DoPluginTest = this.doPluginTest;
configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
configuration.DevPluginLoadLocations = this.devPluginLocations.Select(x => x.Clone()).ToList();
this.dalamud.Configuration.PrintPluginsWelcomeMsg = this.printPluginsWelcomeMsg;
this.dalamud.Configuration.AutoUpdatePlugins = this.autoUpdatePlugins;
this.dalamud.Configuration.DoButtonsSystemMenu = this.doButtonsSystemMenu;
configuration.PrintPluginsWelcomeMsg = this.printPluginsWelcomeMsg;
configuration.AutoUpdatePlugins = this.autoUpdatePlugins;
configuration.DoButtonsSystemMenu = this.doButtonsSystemMenu;
this.dalamud.Configuration.Save();
configuration.Save();
this.dalamud.PluginManager.ReloadPluginMasters();
Service<PluginManager>.Get().ReloadPluginMasters();
}
}
}