add /xldata

This commit is contained in:
Raymond Lynch 2021-04-09 10:56:49 -04:00
parent 107924c7e2
commit d71e0b2188
3 changed files with 55 additions and 9 deletions

View file

@ -78,6 +78,12 @@ namespace Dalamud
ShowInHelp = false, ShowInHelp = false,
}); });
this.dalamud.CommandManager.AddHandler("/xldata", new CommandInfo(this.OnDebugDrawDataMenu)
{
HelpMessage = Loc.Localize("DalamudDevDataMenuHelp", "Draw dev data menu DEBUG. Usage: /xldata [Data Dropdown Type]"),
ShowInHelp = false,
});
this.dalamud.CommandManager.AddHandler("/xllog", new CommandInfo(this.OnOpenLog) this.dalamud.CommandManager.AddHandler("/xllog", new CommandInfo(this.OnOpenLog)
{ {
HelpMessage = Loc.Localize("DalamudDevLogHelp", "Open dev log DEBUG"), HelpMessage = Loc.Localize("DalamudDevLogHelp", "Open dev log DEBUG"),
@ -223,6 +229,14 @@ namespace Dalamud
this.dalamud.DalamudUi.IsDevMenu = !this.dalamud.DalamudUi.IsDevMenu; this.dalamud.DalamudUi.IsDevMenu = !this.dalamud.DalamudUi.IsDevMenu;
} }
private void OnDebugDrawDataMenu(string command, string arguments)
{
if (string.IsNullOrEmpty(arguments))
this.dalamud.DalamudUi.ToggleData();
else
this.dalamud.DalamudUi.ToggleData(arguments);
}
private void OnOpenLog(string command, string arguments) private void OnOpenLog(string command, string arguments)
{ {
this.dalamud.DalamudUi.ToggleLog(); this.dalamud.DalamudUi.ToggleLog();

View file

@ -31,6 +31,11 @@ namespace Dalamud.Interface
private string serverOpString; private string serverOpString;
private int currentKind; private int currentKind;
private string[] dataKinds = new[]
{
"ServerOpCode", "Address", "Actor Table", "Font Test", "Party List", "Plugin IPC", "Condition",
"Gauge", "Command", "Addon", "Addon Inspector", "StartInfo", "Target", "Toast",
};
private bool drawActors = false; private bool drawActors = false;
private float maxActorDrawDistance = 20; private float maxActorDrawDistance = 20;
@ -73,6 +78,31 @@ namespace Dalamud.Interface
this.Load(); this.Load();
} }
/// <summary>
/// Set the DataKind dropdown menu.
/// </summary>
/// <param name="dataKind">Data kind name, can be lower and/or without spaces.</param>
public void SetDataKind(string dataKind)
{
if (string.IsNullOrEmpty(dataKind))
return;
if (dataKind == "ai")
dataKind = "Addon Inspector";
int index;
dataKind = dataKind.Replace(" ", string.Empty).ToLower();
var dataKinds = this.dataKinds.Select(k => k.Replace(" ", string.Empty).ToLower()).ToList();
if ((index = dataKinds.IndexOf(dataKind)) != -1)
{
this.currentKind = index;
}
else
{
this.dalamud.Framework.Gui.Chat.PrintError("/xldata: Invalid Data Type");
}
}
/// <summary> /// <summary>
/// Draw the window via ImGui. /// Draw the window via ImGui.
/// </summary> /// </summary>
@ -87,15 +117,7 @@ namespace Dalamud.Interface
var copy = ImGui.Button("Copy all"); var copy = ImGui.Button("Copy all");
ImGui.SameLine(); ImGui.SameLine();
ImGui.Combo( ImGui.Combo("Data kind", ref this.currentKind, dataKinds, dataKinds.Length);
"Data kind",
ref this.currentKind,
new[]
{
"ServerOpCode", "Address", "Actor Table", "Font Test", "Party List", "Plugin IPC", "Condition",
"Gauge", "Command", "Addon", "Addon Inspector", "StartInfo", "Target", "Toast",
},
14);
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData); ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);

View file

@ -460,6 +460,16 @@ namespace Dalamud.Interface
this.dataWindow.IsOpen ^= true; this.dataWindow.IsOpen ^= true;
} }
/// <summary>
/// Toggle the data window and preset the dropdown.
/// </summary>
internal void ToggleData(string dataKind)
{
this.dataWindow.IsOpen ^= true;
if (this.dataWindow.IsOpen)
this.dataWindow.SetDataKind(dataKind);
}
/// <summary> /// <summary>
/// Toggle the credits window. /// Toggle the credits window.
/// </summary> /// </summary>