mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
refactor: move Condition Debug into Dalamud data
This commit is contained in:
parent
cf212e33d6
commit
3cf46089cf
4 changed files with 51 additions and 80 deletions
|
|
@ -151,8 +151,6 @@ namespace Dalamud {
|
||||||
|
|
||||||
IsReady = true;
|
IsReady = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.conditionDebugWindow = new ConditionDebugWindow( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start() {
|
public void Start() {
|
||||||
|
|
@ -217,7 +215,6 @@ namespace Dalamud {
|
||||||
private DalamudCreditsWindow creditsWindow;
|
private DalamudCreditsWindow creditsWindow;
|
||||||
private DalamudSettingsWindow settingsWindow;
|
private DalamudSettingsWindow settingsWindow;
|
||||||
private PluginInstallerWindow pluginWindow;
|
private PluginInstallerWindow pluginWindow;
|
||||||
private ConditionDebugWindow conditionDebugWindow;
|
|
||||||
|
|
||||||
private void BuildDalamudUi()
|
private void BuildDalamudUi()
|
||||||
{
|
{
|
||||||
|
|
@ -277,16 +274,6 @@ namespace Dalamud {
|
||||||
ImGui.EndMenu();
|
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.BeginMenu("Plugins"))
|
||||||
{
|
{
|
||||||
if (ImGui.MenuItem("Open Plugin installer"))
|
if (ImGui.MenuItem("Open Plugin installer"))
|
||||||
|
|
@ -391,11 +378,6 @@ namespace Dalamud {
|
||||||
|
|
||||||
if (this.isImguiDrawDemoWindow)
|
if (this.isImguiDrawDemoWindow)
|
||||||
ImGui.ShowDemoWindow();
|
ImGui.ShowDemoWindow();
|
||||||
|
|
||||||
if( this.conditionDebugWindow.Enabled )
|
|
||||||
{
|
|
||||||
this.conditionDebugWindow.Draw();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Game.Chat;
|
using Dalamud.Game.Chat;
|
||||||
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.ClientState.Actors.Types;
|
using Dalamud.Game.ClientState.Actors.Types;
|
||||||
using Dalamud.Game.ClientState.Actors.Types.NonPlayer;
|
using Dalamud.Game.ClientState.Actors.Types.NonPlayer;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
|
@ -57,8 +58,8 @@ namespace Dalamud.Interface
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
var copy = ImGui.Button("Copy all");
|
var copy = ImGui.Button("Copy all");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.Combo("Data kind", ref this.currentKind, new[] {"ServerOpCode", "ContentFinderCondition", "Actor Table", "Font Test", "Party List", "Plugin IPC"},
|
ImGui.Combo("Data kind", ref this.currentKind, new[] {"ServerOpCode", "ContentFinderCondition", "Actor Table", "Font Test", "Party List", "Plugin IPC", "Condition"},
|
||||||
6);
|
7);
|
||||||
|
|
||||||
ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar);
|
ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar);
|
||||||
|
|
||||||
|
|
@ -75,6 +76,8 @@ namespace Dalamud.Interface
|
||||||
case 1:
|
case 1:
|
||||||
ImGui.TextUnformatted(this.cfcString);
|
ImGui.TextUnformatted(this.cfcString);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// AT
|
||||||
case 2: {
|
case 2: {
|
||||||
var stateString = string.Empty;
|
var stateString = string.Empty;
|
||||||
// LocalPlayer is null in a number of situations (at least with the current visible-actors list)
|
// 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);
|
ImGui.TextUnformatted(stateString);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Font
|
||||||
case 3:
|
case 3:
|
||||||
var specialChars = string.Empty;
|
var specialChars = string.Empty;
|
||||||
for (var i = 0xE020; i <= 0xE0DB; i++) {
|
for (var i = 0xE020; i <= 0xE0DB; i++) {
|
||||||
|
|
@ -148,6 +153,8 @@ namespace Dalamud.Interface
|
||||||
|
|
||||||
ImGui.TextUnformatted(specialChars);
|
ImGui.TextUnformatted(specialChars);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Party
|
||||||
case 4:
|
case 4:
|
||||||
var partyString = string.Empty;
|
var partyString = string.Empty;
|
||||||
|
|
||||||
|
|
@ -172,6 +179,8 @@ namespace Dalamud.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Subscriptions
|
||||||
case 5:
|
case 5:
|
||||||
var i1 = new DalamudPluginInterface(this.dalamud, "DalamudTestSub", null);
|
var i1 = new DalamudPluginInterface(this.dalamud, "DalamudTestSub", null);
|
||||||
var i2 = new DalamudPluginInterface(this.dalamud, "DalamudTestPub", null);
|
var i2 = new DalamudPluginInterface(this.dalamud, "DalamudTestPub", null);
|
||||||
|
|
@ -193,6 +202,39 @@ namespace Dalamud.Interface
|
||||||
ImGui.Text($"Source:{sub.SourcePluginName} Sub:{sub.SubPluginName}");
|
ImGui.Text($"Source:{sub.SourcePluginName} Sub:{sub.SubPluginName}");
|
||||||
}
|
}
|
||||||
break;
|
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
|
else
|
||||||
ImGui.TextUnformatted("Data not ready.");
|
ImGui.TextUnformatted("Data not ready.");
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
@ -16,7 +17,7 @@ namespace Dalamud.Interface
|
||||||
|
|
||||||
public static SerilogEventSink Instance;
|
public static SerilogEventSink Instance;
|
||||||
|
|
||||||
public event EventHandler<string> OnLogLine;
|
public event EventHandler<(string line, Vector4 color)> OnLogLine;
|
||||||
|
|
||||||
public SerilogEventSink(IFormatProvider formatProvider)
|
public SerilogEventSink(IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +33,11 @@ namespace Dalamud.Interface
|
||||||
if (logEvent.Exception != null)
|
if (logEvent.Exception != null)
|
||||||
message += "\n" + logEvent.Exception;
|
message += "\n" + logEvent.Exception;
|
||||||
|
|
||||||
OnLogLine?.Invoke(this, message);
|
var color = logEvent.Level switch {
|
||||||
|
LogEventLevel.Error => Vector4.One
|
||||||
|
};
|
||||||
|
|
||||||
|
OnLogLine?.Invoke(this, (message, ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue