diff --git a/LightlessSync/Services/CommandManagerService.cs b/LightlessSync/Services/CommandManagerService.cs index 3f22195..b2993d3 100644 --- a/LightlessSync/Services/CommandManagerService.cs +++ b/LightlessSync/Services/CommandManagerService.cs @@ -42,7 +42,8 @@ public sealed class CommandManagerService : IDisposable "\t /light toggle on|off - Connects or disconnects to Lightless respectively" + Environment.NewLine + "\t /light gpose - Opens the Lightless Character Data Hub window" + Environment.NewLine + "\t /light analyze - Opens the Lightless Character Data Analysis window" + Environment.NewLine + - "\t /light settings - Opens the Lightless Settings window" + "\t /light settings - Opens the Lightless Settings window" + Environment.NewLine + + "\t /light lightfinder - Opens the Lightfinder window" }); } @@ -122,5 +123,9 @@ public sealed class CommandManagerService : IDisposable { _mediator.Publish(new UiToggleMessage(typeof(SettingsUi))); } + else if (string.Equals(splitArgs[0], "lightfinder", StringComparison.OrdinalIgnoreCase)) + { + _mediator.Publish(new UiToggleMessage(typeof(BroadcastUI))); + } } } \ No newline at end of file diff --git a/LightlessSync/Services/ContextMenuService.cs b/LightlessSync/Services/ContextMenuService.cs index b03ef28..12dae60 100644 --- a/LightlessSync/Services/ContextMenuService.cs +++ b/LightlessSync/Services/ContextMenuService.cs @@ -24,6 +24,7 @@ internal class ContextMenuService : IHostedService private readonly PairRequestService _pairRequestService; private readonly ApiController _apiController; private readonly IObjectTable _objectTable; + private readonly LightlessConfigService _configService; public ContextMenuService( IContextMenu contextMenu, @@ -45,6 +46,7 @@ internal class ContextMenuService : IHostedService _dalamudUtil = dalamudUtil; _apiController = apiController; _objectTable = objectTable; + _configService = configService; _pairManager = pairManager; _pairRequestService = pairRequestService; _clientState = clientState; @@ -108,6 +110,9 @@ internal class ContextMenuService : IHostedService var world = GetWorld(target.TargetHomeWorld.RowId); if (!IsWorldValid(world)) return; + + if (!_configService.Current.EnableRightClickMenus) + return; args.AddMenuItem(new MenuItem { diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index 5b0f35e..d6c672a 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -204,35 +204,43 @@ 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) - 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 && + objectInfo->NamePlateIndex >= 0) { - pNode->AtkResNode.ToggleVisibility(false); - continue; - } + if (objectInfo == null || objectInfo->GameObject == null) + continue; - pNode->AtkResNode.ToggleVisibility(true); + 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 nameContainer = nameplateObject.NameContainer; - var nameText = nameplateObject.NameText; + var cid = DalamudUtilService.GetHashedCIDFromPlayerPointer((nint)objectInfo->GameObject); + 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); @@ -294,6 +302,7 @@ 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; @@ -336,6 +345,9 @@ 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) @@ -367,18 +379,23 @@ 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); @@ -387,6 +404,7 @@ 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; @@ -434,6 +452,10 @@ 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); } diff --git a/LightlessSync/UI/Components/DrawUserPair.cs b/LightlessSync/UI/Components/DrawUserPair.cs index fdd06e8..fa5022e 100644 --- a/LightlessSync/UI/Components/DrawUserPair.cs +++ b/LightlessSync/UI/Components/DrawUserPair.cs @@ -313,7 +313,7 @@ public class DrawUserPair using (ImRaii.PushColor(ImGuiCol.Text, roleColor)) { ImGui.TextUnformatted(_pair.UserData.IsAdmin - ? "Official Lightless Admin" + ? "Official Lightless Developer" : "Official Lightless Moderator"); } ImGui.EndTooltip(); diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 1a28504..58187a6 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -1032,7 +1032,7 @@ public class SettingsUi : WindowMediatorSubscriberBase _configService.Current.EnableRightClickMenus = enableRightClickMenu; _configService.Save(); } - _uiShared.DrawHelpText("This will add Lightless related right click menu entries in the game UI on paired players."); + _uiShared.DrawHelpText("This will add all Lightless related right click menu entries in the game UI."); if (ImGui.Checkbox("Display status and visible pair count in Server Info Bar", ref enableDtrEntry)) {