1
0
Fork 0

Context menu integration for armoury chest

master
Liza 2023-09-21 11:48:49 +02:00
parent 22314f556d
commit 7547db5e9c
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 28 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.3</Version>
<Version>2.4</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -1,12 +1,12 @@
using System;
using System.Linq;
using ARDiscard.GameData;
using ARDiscard.GameData.Agents;
using ARDiscard.Windows;
using Dalamud.ContextMenu;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Logging;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
namespace ARDiscard;
@ -37,7 +37,7 @@ internal sealed class ContextMenuIntegration : IDisposable
_dalamudContextMenu.OnOpenInventoryContextMenu += OpenInventoryContextMenu;
}
private void OpenInventoryContextMenu(InventoryContextMenuOpenArgs args)
private unsafe void OpenInventoryContextMenu(InventoryContextMenuOpenArgs args)
{
if (!_configuration.ContextMenu.Enabled)
return;
@ -45,7 +45,18 @@ internal sealed class ContextMenuIntegration : IDisposable
if (_configuration.ContextMenu.OnlyWhenConfigIsOpen && !_configWindow.IsOpen)
return;
if (!(args.ParentAddonName is "Inventory" or "InventoryExpansion" or "InventoryLarge"))
if (args.ParentAddonName == "ArmouryBoard")
{
var agent = AgentModule.Instance()->GetAgentByInternalId(AgentId.ArmouryBoard);
if (agent == null || !agent->IsAgentActive())
return;
// don't add it in the main/off hand weapon tabs, as we don't use these for discarding
var agentArmouryBoard = (AgentArmouryBoard*)agent;
if (agentArmouryBoard->CurrentTab is 0 or 6)
return;
}
else if (!(args.ParentAddonName is "Inventory" or "InventoryExpansion" or "InventoryLarge"))
return;
if (!_configWindow.CanItemBeConfigured(args.ItemId))

View File

@ -0,0 +1,12 @@
using System.Runtime.InteropServices;
using FFXIVClientStructs.Attributes;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
namespace ARDiscard.GameData.Agents;
[Agent(AgentId.ArmouryBoard)]
[StructLayout(LayoutKind.Explicit, Size = 0x2E)]
public struct AgentArmouryBoard
{
[FieldOffset(0x2C)] public byte CurrentTab;
}