forked from liza/ARDiscard
Context menu integration for armoury chest
This commit is contained in:
parent
22314f556d
commit
7547db5e9c
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<Version>2.3</Version>
|
<Version>2.4</Version>
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ARDiscard.GameData;
|
using ARDiscard.GameData;
|
||||||
|
using ARDiscard.GameData.Agents;
|
||||||
using ARDiscard.Windows;
|
using ARDiscard.Windows;
|
||||||
using Dalamud.ContextMenu;
|
using Dalamud.ContextMenu;
|
||||||
using Dalamud.Game.Text;
|
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Logging;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
|
|
||||||
namespace ARDiscard;
|
namespace ARDiscard;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ internal sealed class ContextMenuIntegration : IDisposable
|
|||||||
_dalamudContextMenu.OnOpenInventoryContextMenu += OpenInventoryContextMenu;
|
_dalamudContextMenu.OnOpenInventoryContextMenu += OpenInventoryContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenInventoryContextMenu(InventoryContextMenuOpenArgs args)
|
private unsafe void OpenInventoryContextMenu(InventoryContextMenuOpenArgs args)
|
||||||
{
|
{
|
||||||
if (!_configuration.ContextMenu.Enabled)
|
if (!_configuration.ContextMenu.Enabled)
|
||||||
return;
|
return;
|
||||||
@ -45,7 +45,18 @@ internal sealed class ContextMenuIntegration : IDisposable
|
|||||||
if (_configuration.ContextMenu.OnlyWhenConfigIsOpen && !_configWindow.IsOpen)
|
if (_configuration.ContextMenu.OnlyWhenConfigIsOpen && !_configWindow.IsOpen)
|
||||||
return;
|
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;
|
return;
|
||||||
|
|
||||||
if (!_configWindow.CanItemBeConfigured(args.ItemId))
|
if (!_configWindow.CanItemBeConfigured(args.ItemId))
|
||||||
|
12
ARDiscard/GameData/Agents/AgentArmouryBoard.cs
Normal file
12
ARDiscard/GameData/Agents/AgentArmouryBoard.cs
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user