Fixing PVP Nameplate

This commit is contained in:
defnotken
2025-09-10 08:58:04 -05:00
parent dfc6f4ec3c
commit bd98a630c8

View File

@@ -17,6 +17,7 @@ public class NameplateService : DisposableMediatorSubscriberBase
private readonly INamePlateGui _namePlateGui;
private readonly PairManager _pairManager;
public NameplateService(ILogger<NameplateService> logger,
LightlessConfigService configService,
INamePlateGui namePlateGui,
@@ -36,11 +37,9 @@ public class NameplateService : DisposableMediatorSubscriberBase
private void OnNamePlateUpdate(INamePlateUpdateContext context, IReadOnlyList<INamePlateUpdateHandler> handlers)
{
if (!_configService.Current.IsNameplateColorsEnabled && !_clientState.IsPvPExcludingDen) return;
if (!_configService.Current.IsNameplateColorsEnabled || (_configService.Current.IsNameplateColorsEnabled && _clientState.IsPvPExcludingDen)) return;
var visibleUsersIds = _pairManager.GetOnlineUserPairs().Where(u => u.IsVisible && u.PlayerCharacterId != uint.MaxValue).Select(u => (ulong)u.PlayerCharacterId).ToHashSet();
var colors = _configService.Current.NameplateColors;
foreach (var handler in handlers)
{
var playerCharacter = handler.PlayerCharacter;
@@ -63,6 +62,7 @@ public class NameplateService : DisposableMediatorSubscriberBase
public void RequestRedraw()
{
_namePlateGui.RequestRedraw();
}