From a2bb1d7336f438d4a63ad567a772f6fc0d005325 Mon Sep 17 00:00:00 2001 From: azyges Date: Mon, 6 Oct 2025 08:31:23 +0900 Subject: [PATCH] fix merge + add catch --- .../PlayerData/Handlers/PairHandler.cs | 7 +- LightlessSync/Services/NameplateHandler.cs | 93 ++++++++----------- 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/LightlessSync/PlayerData/Handlers/PairHandler.cs b/LightlessSync/PlayerData/Handlers/PairHandler.cs index 779e0e7..fb03bfb 100644 --- a/LightlessSync/PlayerData/Handlers/PairHandler.cs +++ b/LightlessSync/PlayerData/Handlers/PairHandler.cs @@ -741,6 +741,11 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase } } } + catch (OperationCanceledException) + { + Logger.LogTrace("[BASE-{appBase}] Modded path calculation cancelled", applicationBase); + throw; + } catch (Exception ex) { Logger.LogError(ex, "[BASE-{appBase}] Something went wrong during calculation replacements", applicationBase); @@ -767,4 +772,4 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase _dataReceivedInDowntime = null; } } -} \ No newline at end of file +} diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index d6c672a..abe6266 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -204,43 +204,40 @@ public unsafe class NameplateHandler : IMediatorSubscriber for (int i = 0; i < ui3DModule->NamePlateObjectInfoCount; ++i) { var objectInfo = ui3DModule->NamePlateObjectInfoPointers[i].Value; - if (objectInfo != null && - objectInfo->GameObject != null && - objectInfo->NamePlateIndex >= 0) + + if (objectInfo == null || objectInfo->GameObject == null) + continue; + + var nameplateIndex = objectInfo->NamePlateIndex; + if (nameplateIndex < 0 || nameplateIndex >= AddonNamePlate.NumNamePlateObjects) + continue; + + var pNode = mTextNodes[nameplateIndex]; + if (pNode == null) + continue; + + var cid = DalamudUtilService.GetHashedCIDFromPlayerPointer((nint)objectInfo->GameObject); + + //_logger.LogInformation($"checking cid: {cid}", cid); + + if (cid == null || !_activeBroadcastingCids.Contains(cid)) { - if (objectInfo == null || objectInfo->GameObject == null) - continue; + pNode->AtkResNode.ToggleVisibility(false); + continue; + } - var nameplateIndex = objectInfo->NamePlateIndex; - if (nameplateIndex < 0 || nameplateIndex >= AddonNamePlate.NumNamePlateObjects) - continue; + var nameplateObject = mpNameplateAddon->NamePlateObjectArray[nameplateIndex]; + nameplateObject.RootComponentNode->Component->UldManager.UpdateDrawNodeList(); - var pNode = mTextNodes[nameplateIndex]; - if (pNode == null) - continue; + var pNameplateIconNode = nameplateObject.MarkerIcon; + var pNameplateResNode = nameplateObject.NameContainer; + var pNameplateTextNode = nameplateObject.NameText; + bool IsVisible = pNameplateIconNode->AtkResNode.IsVisible() || (pNameplateResNode->IsVisible() && pNameplateTextNode->AtkResNode.IsVisible()); + pNode->AtkResNode.ToggleVisibility(IsVisible); - var cid = DalamudUtilService.GetHashedCIDFromPlayerPointer((nint)objectInfo->GameObject); + var nameContainer = nameplateObject.NameContainer; + var nameText = nameplateObject.NameText; - if (cid == null || !_activeBroadcastingCids.Contains(cid)) - { - pNode->AtkResNode.ToggleVisibility(false); - continue; - } - - var nameplateObject = mpNameplateAddon->NamePlateObjectArray[nameplateIndex]; - nameplateObject.RootComponentNode->Component->UldManager.UpdateDrawNodeList(); - - var pNameplateIconNode = nameplateObject.MarkerIcon; - var pNameplateResNode = nameplateObject.NameContainer; - var pNameplateTextNode = nameplateObject.NameText; - bool IsVisible = pNameplateIconNode->AtkResNode.IsVisible() || (pNameplateResNode->IsVisible() && pNameplateTextNode->AtkResNode.IsVisible()); - pNode->AtkResNode.ToggleVisibility(IsVisible); - - var nameContainer = nameplateObject.NameContainer; - var nameText = nameplateObject.NameText; - - var labelColor = UIColors.Get("LightlessPurple"); - var edgeColor = UIColors.Get("FullBlack"); if (nameContainer == null || nameText == null) { pNode->AtkResNode.ToggleVisibility(false); @@ -302,7 +299,6 @@ public unsafe class NameplateHandler : IMediatorSubscriber _cachedNameplateContainerHeights[nameplateIndex] = containerHeight; } - var labelY = nameContainer->Height - nameplateObject.TextH - (int)(24 * nameText->AtkResNode.ScaleY); var blockTop = containerHeight - blockHeight; if (blockTop < 0) blockTop = 0; @@ -345,9 +341,6 @@ public unsafe class NameplateHandler : IMediatorSubscriber hasValidOffset = false; } - pNode->AtkResNode.SetPositionShort(58, (short)labelY); - pNode->AtkResNode.SetUseDepthBasedPriority(true); - pNode->AtkResNode.SetScale(0.5f, 0.5f); if (config.LightfinderAutoAlign && nameContainer != null && hasValidOffset) { switch (config.LabelAlignment) @@ -379,23 +372,18 @@ public unsafe class NameplateHandler : IMediatorSubscriber pNode->AtkResNode.SetUseDepthBasedPriority(true); pNode->AtkResNode.SetScale(effectiveScale, effectiveScale); - pNode->AtkResNode.Color.A = 255; + pNode->AtkResNode.Color.A = 255; - pNode->TextColor.R = (byte)(labelColor.X * 255); - pNode->TextColor.G = (byte)(labelColor.Y * 255); - pNode->TextColor.B = (byte)(labelColor.Z * 255); - pNode->TextColor.A = (byte)(labelColor.W * 255); + pNode->TextColor.R = (byte)(labelColor.X * 255); + pNode->TextColor.G = (byte)(labelColor.Y * 255); + pNode->TextColor.B = (byte)(labelColor.Z * 255); + pNode->TextColor.A = (byte)(labelColor.W * 255); - pNode->EdgeColor.R = (byte)(edgeColor.X * 255); - pNode->EdgeColor.G = (byte)(edgeColor.Y * 255); - pNode->EdgeColor.B = (byte)(edgeColor.Z * 255); - pNode->EdgeColor.A = (byte)(edgeColor.W * 255); + pNode->EdgeColor.R = (byte)(edgeColor.X * 255); + pNode->EdgeColor.G = (byte)(edgeColor.Y * 255); + pNode->EdgeColor.B = (byte)(edgeColor.Z * 255); + pNode->EdgeColor.A = (byte)(edgeColor.W * 255); - pNode->FontSize = 24; - pNode->AlignmentType = AlignmentType.Center; - pNode->FontType = FontType.MiedingerMed; - pNode->LineSpacing = 24; - pNode->CharSpacing = 1; var baseFontSize = config.LightfinderLabelUseIcon ? 36f : 24f; var computedFontSize = (int)System.Math.Round(baseFontSize * scaleMultiplier); pNode->FontSize = (byte)System.Math.Clamp(computedFontSize, 1, 255); @@ -404,7 +392,6 @@ public unsafe class NameplateHandler : IMediatorSubscriber pNode->LineSpacing = (byte)System.Math.Clamp(computedLineSpacing, 0, byte.MaxValue); pNode->CharSpacing = 1; - pNode->TextFlags = TextFlags.Edge | TextFlags.Glare; pNode->TextFlags = config.LightfinderLabelUseIcon ? TextFlags.Edge | TextFlags.Glare | TextFlags.AutoAdjustNodeSize : TextFlags.Edge | TextFlags.Glare; @@ -452,10 +439,6 @@ public unsafe class NameplateHandler : IMediatorSubscriber if (scale <= 0f) scale = 1f; - pNode->SetText("Lightfinder"); - } - } - } var computed = (int)System.Math.Round(rawWidth * scale); return System.Math.Max(1, computed); }