diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs b/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs index 029e9716c..28e2c36eb 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs @@ -102,7 +102,7 @@ internal sealed class NamePlateGui : IInternalDisposableService, INamePlateGui /// A span containing the free company tag without its surrounding quote characters. internal static ReadOnlySpan StripFreeCompanyTagQuotes(ReadOnlySpan text) { - if (text.Length > 4 && text[..3].SequenceEqual(" «"u8) && text[^2..].SequenceEqual("»"u8)) + if (text.Length > 4 && text.StartsWith(" «"u8) && text.EndsWith("»"u8)) { return text[3..^2]; } @@ -118,7 +118,7 @@ internal sealed class NamePlateGui : IInternalDisposableService, INamePlateGui /// A span containing the title without its surrounding quote characters. internal static ReadOnlySpan StripTitleQuotes(ReadOnlySpan text) { - if (text.Length > 5 && text[..3].SequenceEqual("《"u8) && text[^3..].SequenceEqual("》"u8)) + if (text.Length > 5 && text.StartsWith("《"u8) && text.EndsWith("》"u8)) { return text[3..^3]; } diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs index 2164d7bee..b8a4a9bd8 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs @@ -59,6 +59,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext { this.ObjectTable = objectTable; this.RaptureAtkModule = FFXIVClientStructs.FFXIV.Client.UI.RaptureAtkModule.Instance(); + this.Ui3DModule = UIModule.Instance()->GetUI3DModule(); this.ResetState(args); } @@ -98,6 +99,11 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext /// internal RaptureAtkModule* RaptureAtkModule { get; } + /// + /// Gets the Ui3DModule. + /// + internal UI3DModule* Ui3DModule { get; } + /// /// Gets the ObjectTable. /// diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs index 14f8101ad..d34aba904 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs @@ -327,7 +327,9 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler public ulong GameObjectId => this.gameObjectId ??= this.NamePlateInfo->ObjectId; /// - public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable.SearchById(this.GameObjectId); + public IGameObject? GameObject => this.gameObject ??= this.context.ObjectTable.CreateObjectReference( + (nint)this.context.Ui3DModule->NamePlateObjectInfoPointers[ + this.ArrayIndex].Value->GameObject); /// public IBattleChara? BattleChara => this.GameObject as IBattleChara;