68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
using Dalamud.Plugin.Services;
|
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
|
using LLib.GameUI;
|
|
|
|
namespace LLib.Buddy;
|
|
|
|
public static class BuddyEquipActions
|
|
{
|
|
private const uint CompanionWindowActionId = 26u;
|
|
|
|
public unsafe static bool TryOpenBuddyAddon()
|
|
{
|
|
ActionManager* ptr = ActionManager.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
return ptr->UseAction(ActionType.GeneralAction, 26u, 3758096384uL, 0u, ActionManager.UseActionMode.None, 0u, null);
|
|
}
|
|
|
|
public unsafe static bool IsBuddyAddonReady(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
return gameGui.TryGetReadyAddon<AtkUnitBase>("Buddy", out addonPtr);
|
|
}
|
|
|
|
public unsafe static bool TrySelectBardingSlot(IGameGui gameGui, int slot)
|
|
{
|
|
if (!gameGui.TryGetReadyAddon<AtkUnitBase>("Buddy", out var addonPtr))
|
|
{
|
|
return false;
|
|
}
|
|
AddonCallback.Fire(addonPtr, 0, 2);
|
|
AddonCallback.Fire(addonPtr, 1, slot);
|
|
return true;
|
|
}
|
|
|
|
public unsafe static bool TryEquipBarding(IGameGui gameGui, int bardingIndex)
|
|
{
|
|
if (!gameGui.TryGetReadyAddon<AtkUnitBase>("Buddy", out var addonPtr))
|
|
{
|
|
return false;
|
|
}
|
|
AddonCallback.Fire(addonPtr, 2, bardingIndex);
|
|
return true;
|
|
}
|
|
|
|
public unsafe static bool TryUnequipBarding(IGameGui gameGui, int slot)
|
|
{
|
|
if (!gameGui.TryGetReadyAddon<AtkUnitBase>("Buddy", out var addonPtr))
|
|
{
|
|
return false;
|
|
}
|
|
AddonCallback.Fire(addonPtr, 3, slot);
|
|
return true;
|
|
}
|
|
|
|
public unsafe static bool TryCloseBuddyAddon(IGameGui gameGui)
|
|
{
|
|
if (!gameGui.TryGetAddonByName<AtkUnitBase>("Buddy", out var addonPtr))
|
|
{
|
|
return false;
|
|
}
|
|
AddonCallback.Fire(addonPtr, -1);
|
|
return true;
|
|
}
|
|
}
|