using FFXIVClientStructs.FFXIV.Component.GUI; namespace LLib.GameUI; public static class AddonCallback { public unsafe static void Fire(AtkUnitBase* addon, params int[] args) { if (addon != null) { AtkValue* ptr = stackalloc AtkValue[(args.Length == 0) ? 1 : args.Length]; for (int i = 0; i < args.Length; i++) { ptr[i].Type = AtkValueType.Int; ptr[i].Int = args[i]; } addon->FireCallback((uint)args.Length, ptr); } } public unsafe static void FireWithUpdate(AtkUnitBase* addon, params int[] args) { if (addon != null) { AtkValue* ptr = stackalloc AtkValue[(args.Length == 0) ? 1 : args.Length]; for (int i = 0; i < args.Length; i++) { ptr[i].Type = AtkValueType.Int; ptr[i].Int = args[i]; } addon->FireCallback((uint)args.Length, ptr, close: true); } } public unsafe static void ClickYes(AtkUnitBase* addon) { if (addon != null) { addon->FireCallbackInt(0); } } public unsafe static bool ClickButton(AtkUnitBase* addon, AtkComponentButton* button) { if (addon == null || button == null || !button->IsEnabled) { return false; } AtkComponentNode* ownerNode = button->AtkComponentBase.OwnerNode; if (ownerNode == null) { return false; } AtkEvent* ptr = ownerNode->AtkResNode.AtkEventManager.Event; if (ptr == null) { return false; } addon->ReceiveEvent(ptr->State.EventType, (int)ptr->Param, ptr, null); return true; } }