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

@ -31,6 +31,11 @@ namespace Dalamud.Interface
private string serverOpString;
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 float maxActorDrawDistance = 20;
@ -73,6 +78,31 @@ namespace Dalamud.Interface
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>
/// Draw the window via ImGui.
/// </summary>
@ -87,15 +117,7 @@ namespace Dalamud.Interface
var copy = ImGui.Button("Copy all");
ImGui.SameLine();
ImGui.Combo(
"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.Combo("Data kind", ref this.currentKind, dataKinds, dataKinds.Length);
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);

View file

@ -460,6 +460,16 @@ namespace Dalamud.Interface
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>
/// Toggle the credits window.
/// </summary>