From cf54bc7f57a274a7f6a2265a85f168e239fd1ea5 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sat, 30 Apr 2022 00:47:06 +0200 Subject: [PATCH] Correspond Adventurer Plate Actor to name. --- .../Interop/Resolver/PathResolver.Data.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Penumbra/Interop/Resolver/PathResolver.Data.cs b/Penumbra/Interop/Resolver/PathResolver.Data.cs index abcccc9a..57d55935 100644 --- a/Penumbra/Interop/Resolver/PathResolver.Data.cs +++ b/Penumbra/Interop/Resolver/PathResolver.Data.cs @@ -7,6 +7,7 @@ using Dalamud.Utility.Signatures; using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; +using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Component.GUI; using Penumbra.Collections; using Penumbra.GameData.ByteString; @@ -138,6 +139,25 @@ public unsafe partial class PathResolver return text != null ? text->NodeText.ToString() : null; } + // Obtain the name displayed in the Character Card from the agent. + private static string? GetCardName() + { + var uiModule = ( UIModule* )Dalamud.GameGui.GetUIModule(); + var agentModule = uiModule->GetAgentModule(); + var agent = (byte*) agentModule->GetAgentByInternalID( 393 ); + if( agent == null ) + { + return null; + } + + var data = *(byte**) (agent + 0x28); + if( data == null ) + return null; + + var block = data + 0x7A; + return new Utf8String( block ).ToString(); + } + // Guesstimate whether an unnamed cutscene actor corresponds to the player or not, // and if so, return the player name. private static string? GetCutsceneName( GameObject* gameObject ) @@ -167,9 +187,9 @@ public unsafe partial class PathResolver var name = gameObject->ObjectIndex switch { - 240 => GetPlayerName(), // character window - 241 => GetInspectName(), // inspect - 242 => GetPlayerName(), // try-on + 240 => GetPlayerName(), // character window + 241 => GetInspectName() ?? GetCardName(), // inspect, character card + 242 => GetPlayerName(), // try-on >= 200 => GetCutsceneName( gameObject ), _ => null, }