From 14868d71feb496f41996a08f92d833624b26ec4b Mon Sep 17 00:00:00 2001 From: r00telement <47005506+r00telement@users.noreply.github.com> Date: Mon, 10 Jan 2022 00:22:33 +0000 Subject: [PATCH] Changed lower content id to full content id --- PlayerTags/GameInterface/ContextMenus/ContextMenu.cs | 10 +++++++--- .../FFXIV/Client/UI/Agent/AgentContext.cs | 2 +- .../GameInterface/ContextMenus/GameObjectContext.cs | 10 +++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/PlayerTags/GameInterface/ContextMenus/ContextMenu.cs b/PlayerTags/GameInterface/ContextMenus/ContextMenu.cs index edab936..5aee344 100644 --- a/PlayerTags/GameInterface/ContextMenus/ContextMenu.cs +++ b/PlayerTags/GameInterface/ContextMenus/ContextMenu.cs @@ -429,7 +429,7 @@ namespace PlayerTags.GameInterface.ContextMenus else { var agentContext = (AgentContext*)agent; - if (agentContext->GameObjectLowerContentId != 0 || agentContext->GameObjectWorldId != 0) + if (agentContext->GameObjectContentId != 0 || agentContext->GameObjectWorldId != 0) { SeString objectName; unsafe @@ -437,7 +437,7 @@ namespace PlayerTags.GameInterface.ContextMenus objectName = GameInterfaceHelper.ReadSeString((IntPtr)agentContext->ObjectName.StringPtr); } - gameObjectContext = new GameObjectContext(agentContext->GameObjectId, agentContext->GameObjectLowerContentId, objectName, agentContext->GameObjectWorldId); + gameObjectContext = new GameObjectContext(agentContext->GameObjectId, agentContext->GameObjectContentId, objectName, agentContext->GameObjectWorldId); } } @@ -496,7 +496,7 @@ namespace PlayerTags.GameInterface.ContextMenus { PluginLog.Debug($"ContextMenuItemSelectedImplementation"); - if (m_CurrentContextMenuOpenedArgs == null) + if (m_CurrentContextMenuOpenedArgs == null || selectedIndex == -1) { m_CurrentContextMenuOpenedArgs = null; m_CurrentSelectedItem = null; @@ -508,8 +508,12 @@ namespace PlayerTags.GameInterface.ContextMenus ContextMenuReaderWriter contextMenuReaderWriter = new ContextMenuReaderWriter(m_CurrentContextMenuAgent, addonContext->AtkValuesCount, addonContext->AtkValues); var gameContextMenuItems = contextMenuReaderWriter.Read(); var gameSelectedItem = gameContextMenuItems.ElementAtOrDefault(selectedIndex); + + // This should be impossible if (gameSelectedItem == null) { + m_CurrentContextMenuOpenedArgs = null; + m_CurrentSelectedItem = null; return; } diff --git a/PlayerTags/GameInterface/ContextMenus/FFXIVClientStructs/FFXIV/Client/UI/Agent/AgentContext.cs b/PlayerTags/GameInterface/ContextMenus/FFXIVClientStructs/FFXIV/Client/UI/Agent/AgentContext.cs index 8da6102..613132b 100644 --- a/PlayerTags/GameInterface/ContextMenus/FFXIVClientStructs/FFXIV/Client/UI/Agent/AgentContext.cs +++ b/PlayerTags/GameInterface/ContextMenus/FFXIVClientStructs/FFXIV/Client/UI/Agent/AgentContext.cs @@ -16,7 +16,7 @@ namespace FFXIVClientStructs.FFXIV.Client.UI.Agent [FieldOffset(0xD08)] public byte* SubContextMenuTitle; [FieldOffset(0xD18)] public unsafe AgentContextItemData* ItemData; [FieldOffset(0xE08)] public Utf8String ObjectName; - [FieldOffset(0xEE0)] public uint GameObjectLowerContentId; + [FieldOffset(0xEE0)] public ulong GameObjectContentId; [FieldOffset(0xEF0)] public uint GameObjectId; [FieldOffset(0xF00)] public ushort GameObjectWorldId; [FieldOffset(0x1740)] public bool IsSubContextMenu; diff --git a/PlayerTags/GameInterface/ContextMenus/GameObjectContext.cs b/PlayerTags/GameInterface/ContextMenus/GameObjectContext.cs index 3b8916b..0b07072 100644 --- a/PlayerTags/GameInterface/ContextMenus/GameObjectContext.cs +++ b/PlayerTags/GameInterface/ContextMenus/GameObjectContext.cs @@ -13,9 +13,9 @@ namespace PlayerTags.GameInterface.ContextMenus public uint Id { get; } /// - /// The lower content id of the game object. + /// The content id of the game object. /// - public uint LowerContentId { get; } + public ulong ContentId { get; } /// /// The name of the game object. @@ -31,13 +31,13 @@ namespace PlayerTags.GameInterface.ContextMenus /// Initializes a new instance of the class. /// /// The id of the game object. - /// The lower content id of the game object. + /// The lower content id of the game object. /// The name of the game object. /// The world id of the game object. - public GameObjectContext(uint id, uint lowerContentId, SeString name, ushort worldId) + public GameObjectContext(uint id, ulong contentId, SeString name, ushort worldId) { Id = id; - LowerContentId = lowerContentId; + ContentId = contentId; Name = name; WorldId = worldId; }