Integrate Allagan Tools for item info in UI

Added AT interop to check plugin availability and trigger `/moreinfo` command for selected items. UI now displays a button next to each item category label to open more information via AT, with tooltips and error handling if AT is not installed. Initialization for AT interop added to plugin startup.
This commit is contained in:
2026-01-03 02:39:55 +02:00
parent f6d06a652d
commit c9d2b9ce94
3 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using Dalamud.Plugin.Services;
using HeightAdjuster.Interop.Glamourer;
using System;
using System.Collections.Generic;
namespace GlamourBrowser.Interop {
internal class AT {
private static bool Initialized { get; set; } = false;
private static bool Available { get; set; } = false;
private static ICommandManager _commandManager;
private static IChatGui _chatGui;
public static void Initialize(ICommandManager commandManager, IDalamudPluginInterface pluginInterface, IChatGui chatGui) {
if (Initialized)
return;
_commandManager = commandManager;
_chatGui = chatGui;
Initialized = true;
RefreshStatus(pluginInterface);
}
public static void RefreshStatus(IDalamudPluginInterface pluginInterface) {
var prev = Available;
Available = false;
foreach (var plugin in pluginInterface.InstalledPlugins) {
if (plugin.InternalName == "InventoryTools") {
Available = plugin.IsLoaded;
break;
}
}
if (prev == Available)
return;
}
public static void OpenMoreInformationSub(string itemId) {
if (IsAvailable()) {
_commandManager.ProcessCommand("/moreinfo " + itemId);
} else {
_chatGui.PrintError("Allagan Tools was not detected, please install it to get more information about this item.");
}
}
public static bool IsAvailable() {
return Available;
}
}
}

View File

@@ -22,6 +22,7 @@ namespace GlamourBrowser {
this.Commands = new Commands(this);
Interop.Glamourer.Initialize(Service.Interface);
Interop.AT.Initialize(Service.CommandManager, Service.Interface, Service.ChatGui);
Service.Framework.Update += OnFrameworkUpdate;
}

View File

@@ -230,6 +230,19 @@ namespace GlamourBrowser.Ui {
ImGui.TextUnformatted(label);
ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(2, 2));
if (ImGui.Button($"?##info-{label}", new Vector2(20, 20))) {
if (selectedItem.HasValue) {
Interop.AT.OpenMoreInformationSub(selectedItem.Value.RowId.ToString());
}
}
ImGui.PopStyleVar();
if (ImGui.IsItemHovered()) {
ImGui.SetTooltip("Click to see item location");
}
var drawCursor = ImGui.GetCursorScreenPos();
var slotSize = SelectedGearIconSize + SelectedGearPaddingSize;
var borderColour = *ImGui.GetStyleColorVec4(ImGuiCol.Border);
@@ -274,6 +287,7 @@ namespace GlamourBrowser.Ui {
}
ImGui.PopItemWidth();
} else {
ImGui.SetCursorPos(cursorAfter);
ImGui.TextUnformatted("(empty)");