diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index d09bf92c8..be0acb0a2 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -151,8 +151,6 @@ namespace Dalamud { IsReady = true; }); - - this.conditionDebugWindow = new ConditionDebugWindow( this ); } public void Start() { @@ -217,7 +215,6 @@ namespace Dalamud { private DalamudCreditsWindow creditsWindow; private DalamudSettingsWindow settingsWindow; private PluginInstallerWindow pluginWindow; - private ConditionDebugWindow conditionDebugWindow; private void BuildDalamudUi() { @@ -277,16 +274,6 @@ namespace Dalamud { ImGui.EndMenu(); } - if( ImGui.BeginMenu( "Game" ) ) - { - if( ImGui.MenuItem( "Condition Debug" ) ) - { - this.conditionDebugWindow.Enabled = !this.conditionDebugWindow.Enabled; - } - - ImGui.EndMenu(); - } - if (ImGui.BeginMenu("Plugins")) { if (ImGui.MenuItem("Open Plugin installer")) @@ -391,11 +378,6 @@ namespace Dalamud { if (this.isImguiDrawDemoWindow) ImGui.ShowDemoWindow(); - - if( this.conditionDebugWindow.Enabled ) - { - this.conditionDebugWindow.Draw(); - } } #endregion diff --git a/Dalamud/Interface/ConditionDebugWindow.cs b/Dalamud/Interface/ConditionDebugWindow.cs deleted file mode 100644 index daa86bbdd..000000000 --- a/Dalamud/Interface/ConditionDebugWindow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Numerics; -using Dalamud.Game.ClientState; -using ImGuiNET; - -namespace Dalamud.Interface -{ - internal class ConditionDebugWindow - { - private Condition condition; - - internal bool Enabled = false; - - private static readonly Vector2 DefaultWindowSize = new Vector2( 375, 500 ); - - internal ConditionDebugWindow( Dalamud dalamud ) - { - this.condition = dalamud.ClientState.Condition; - } - - internal void Draw() - { - ImGui.SetNextWindowSize( DefaultWindowSize, ImGuiCond.FirstUseEver ); - - ImGui.Begin( "Condition Debug", ref Enabled ); - - #if DEBUG - ImGui.Text($"ptr: {this.condition.conditionArrayBase.ToString("X16")}" ); - #endif - - ImGui.Text( "Current Conditions:" ); - ImGui.Separator(); - - bool didAny = false; - - for( var i = 0; i < Condition.MaxConditionEntries; i++ ) - { - var typedCondition = ( ConditionFlag )i; - var cond = this.condition[ typedCondition ]; - - if( !cond ) - { - continue; - } - - didAny = true; - - ImGui.Text( $"ID: {i} Enum: {typedCondition}" ); - } - - if( !didAny ) - { - ImGui.Text( "None. Talk to a shop NPC or visit a market board to find out more!!!!!!!" ); - } - - ImGui.End(); - } - } -} diff --git a/Dalamud/Interface/DalamudDataWindow.cs b/Dalamud/Interface/DalamudDataWindow.cs index 3a1001418..90cb4a3ba 100644 --- a/Dalamud/Interface/DalamudDataWindow.cs +++ b/Dalamud/Interface/DalamudDataWindow.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net.Mime; using System.Numerics; using Dalamud.Game.Chat; +using Dalamud.Game.ClientState; using Dalamud.Game.ClientState.Actors.Types; using Dalamud.Game.ClientState.Actors.Types.NonPlayer; using Dalamud.Plugin; @@ -57,8 +58,8 @@ namespace Dalamud.Interface ImGui.SameLine(); var copy = ImGui.Button("Copy all"); ImGui.SameLine(); - ImGui.Combo("Data kind", ref this.currentKind, new[] {"ServerOpCode", "ContentFinderCondition", "Actor Table", "Font Test", "Party List", "Plugin IPC"}, - 6); + ImGui.Combo("Data kind", ref this.currentKind, new[] {"ServerOpCode", "ContentFinderCondition", "Actor Table", "Font Test", "Party List", "Plugin IPC", "Condition"}, + 7); ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar); @@ -75,6 +76,8 @@ namespace Dalamud.Interface case 1: ImGui.TextUnformatted(this.cfcString); break; + + // AT case 2: { var stateString = string.Empty; // LocalPlayer is null in a number of situations (at least with the current visible-actors list) @@ -140,6 +143,8 @@ namespace Dalamud.Interface ImGui.TextUnformatted(stateString); } break; + + // Font case 3: var specialChars = string.Empty; for (var i = 0xE020; i <= 0xE0DB; i++) { @@ -148,6 +153,8 @@ namespace Dalamud.Interface ImGui.TextUnformatted(specialChars); break; + + // Party case 4: var partyString = string.Empty; @@ -172,6 +179,8 @@ namespace Dalamud.Interface } break; + + // Subscriptions case 5: var i1 = new DalamudPluginInterface(this.dalamud, "DalamudTestSub", null); var i2 = new DalamudPluginInterface(this.dalamud, "DalamudTestPub", null); @@ -193,6 +202,39 @@ namespace Dalamud.Interface ImGui.Text($"Source:{sub.SourcePluginName} Sub:{sub.SubPluginName}"); } break; + + // Condition + case 6: +#if DEBUG + ImGui.Text($"ptr: {this.dalamud.ClientState.Condition.conditionArrayBase.ToString("X16")}"); +#endif + + ImGui.Text("Current Conditions:"); + ImGui.Separator(); + + var didAny = false; + + for (var i = 0; i < Condition.MaxConditionEntries; i++) + { + var typedCondition = (ConditionFlag)i; + var cond = this.dalamud.ClientState.Condition[typedCondition]; + + if (!cond) + { + continue; + } + + didAny = true; + + ImGui.Text($"ID: {i} Enum: {typedCondition}"); + } + + if (!didAny) + { + ImGui.Text("None. Talk to a shop NPC or visit a market board to find out more!!!!!!!"); + } + + break; } else ImGui.TextUnformatted("Data not ready."); diff --git a/Dalamud/Interface/SerilogEventSink.cs b/Dalamud/Interface/SerilogEventSink.cs index 3e0f7d2d2..f0d1b38e9 100644 --- a/Dalamud/Interface/SerilogEventSink.cs +++ b/Dalamud/Interface/SerilogEventSink.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Text; using System.Threading.Tasks; using Serilog; @@ -16,7 +17,7 @@ namespace Dalamud.Interface public static SerilogEventSink Instance; - public event EventHandler OnLogLine; + public event EventHandler<(string line, Vector4 color)> OnLogLine; public SerilogEventSink(IFormatProvider formatProvider) { @@ -32,7 +33,11 @@ namespace Dalamud.Interface if (logEvent.Exception != null) message += "\n" + logEvent.Exception; - OnLogLine?.Invoke(this, message); + var color = logEvent.Level switch { + LogEventLevel.Error => Vector4.One + }; + + OnLogLine?.Invoke(this, (message, )); } }