feat: add /xlversion command

This commit is contained in:
goat 2021-12-06 19:02:10 +01:00
parent 264cf58a8f
commit 64cb19cb93
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5
2 changed files with 26 additions and 4 deletions

View file

@ -19,7 +19,7 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads
// TODO: even though this is present in some item links, it may not really have a use at all // TODO: even though this is present in some item links, it may not really have a use at all
// For things like owo, changing the text payload is probably correct, whereas changing the // For things like owo, changing the text payload is probably correct, whereas changing the
// actual embedded name might not work properly. // actual embedded name might not work properly.
private string displayName = null; private string? displayName = null;
[JsonProperty] [JsonProperty]
private uint itemId; private uint itemId;
@ -29,14 +29,14 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads
/// Creates a payload representing an interactable item link for the specified item. /// Creates a payload representing an interactable item link for the specified item.
/// </summary> /// </summary>
/// <param name="itemId">The id of the item.</param> /// <param name="itemId">The id of the item.</param>
/// <param name="isHQ">Whether or not the link should be for the high-quality variant of the item.</param> /// <param name="isHq">Whether or not the link should be for the high-quality variant of the item.</param>
/// <param name="displayNameOverride">An optional name to include in the item link. Typically this should /// <param name="displayNameOverride">An optional name to include in the item link. Typically this should
/// be left as null, or set to the normal item name. Actual overrides are better done with the subsequent /// be left as null, or set to the normal item name. Actual overrides are better done with the subsequent
/// TextPayload that is a part of a full item link in chat.</param> /// TextPayload that is a part of a full item link in chat.</param>
public ItemPayload(uint itemId, bool isHQ, string displayNameOverride = null) public ItemPayload(uint itemId, bool isHq, string? displayNameOverride = null)
{ {
this.itemId = itemId; this.itemId = itemId;
this.IsHQ = isHQ; this.IsHQ = isHq;
this.displayName = displayNameOverride; this.displayName = displayNameOverride;
} }

View file

@ -8,7 +8,9 @@ using Dalamud.Configuration.Internal;
using Dalamud.Game; using Dalamud.Game;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin.Internal; using Dalamud.Plugin.Internal;
using Dalamud.Utility;
using Serilog; using Serilog;
namespace Dalamud.Interface.Internal namespace Dalamud.Interface.Internal
@ -124,6 +126,11 @@ namespace Dalamud.Interface.Internal
"Change various In-Game-Addon settings like chat channels and the discord bot setup."), "Change various In-Game-Addon settings like chat channels and the discord bot setup."),
}); });
commandManager.AddHandler("/xlversion", new CommandInfo(this.OnDebugImInfoCommand)
{
HelpMessage = "Dalamud version info",
});
commandManager.AddHandler("/imdebug", new CommandInfo(this.OnDebugImInfoCommand) commandManager.AddHandler("/imdebug", new CommandInfo(this.OnDebugImInfoCommand)
{ {
HelpMessage = "ImGui DEBUG", HelpMessage = "ImGui DEBUG",
@ -306,6 +313,21 @@ namespace Dalamud.Interface.Internal
Log.Information(info); Log.Information(info);
} }
private void OnVersionInfo(string command, string arguments)
{
var chatGui = Service<ChatGui>.Get();
chatGui.Print(new SeStringBuilder()
.AddItalics("Dalamud:")
.AddText($" D{Util.AssemblyVersion}({Util.GetGitHash()}")
.Build());
chatGui.Print(new SeStringBuilder()
.AddItalics("FFXIVCS:")
.AddText($" {Util.GetGitHashClientStructs()}")
.Build());
}
private void OnOpenInstallerCommand(string command, string arguments) private void OnOpenInstallerCommand(string command, string arguments)
{ {
Service<DalamudInterface>.Get().TogglePluginInstallerWindow(); Service<DalamudInterface>.Get().TogglePluginInstallerWindow();