Fix group banner identification.

This commit is contained in:
Ottermandias 2023-01-22 15:15:49 +01:00
parent deb630795d
commit 471005b5b1

View file

@ -13,6 +13,7 @@ using Dalamud.Utility;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Group; using FFXIVClientStructs.FFXIV.Client.Game.Group;
using FFXIVClientStructs.FFXIV.Client.Game.Object; using FFXIVClientStructs.FFXIV.Client.Game.Object;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
@ -204,21 +205,15 @@ public sealed partial class ActorManager : IDisposable
public unsafe bool ResolvePartyBannerPlayer(ScreenActor type, out ActorIdentifier id) public unsafe bool ResolvePartyBannerPlayer(ScreenActor type, out ActorIdentifier id)
{ {
id = ActorIdentifier.Invalid; id = ActorIdentifier.Invalid;
var addon = _gameGui.GetAddonByName("BannerParty"); var addon = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.BannerParty);
if (addon == IntPtr.Zero) if (addon == null || !addon->IsAgentActive())
return false; return false;
var idx = (ushort)type - (ushort)ScreenActor.CharacterScreen; var idx = (ushort)type - (ushort)ScreenActor.CharacterScreen;
if (idx is < 0 or > 7) if (idx is < 0 or > 7)
return true; return true;
if (idx == 0) var obj = GroupManager.Instance()->GetPartyMemberByIndex(idx);
{
id = GetCurrentPlayer();
return true;
}
var obj = GroupManager.Instance()->GetPartyMemberByIndex(idx - 1);
if (obj != null) if (obj != null)
id = CreatePlayer(new ByteString(obj->Name), obj->HomeWorld); id = CreatePlayer(new ByteString(obj->Name), obj->HomeWorld);