diff --git a/.github/workflows/lightless-tag-and-release.yml b/.github/workflows/lightless-tag-and-release.yml index 2320cdf..03e5516 100644 --- a/.github/workflows/lightless-tag-and-release.yml +++ b/.github/workflows/lightless-tag-and-release.yml @@ -81,4 +81,50 @@ jobs: name: ${{ steps.package_version.outputs.version }} draft: false prerelease: false - files: output/LightlessClient.zip \ No newline at end of file + files: output/LightlessClient.zip + + - name: Clone plugin hosting repo + run: | + mkdir LightlessSyncRepo + cd LightlessSyncRepo + git clone https://github.com/${{ github.repository_owner }}/LightlessSync.git + env: + GIT_TERMINAL_PROMPT: 0 + + - name: Update plogonmaster.json with version + shell: pwsh + env: + VERSION: ${{ steps.package_version.outputs.version }} + run: | + $pluginJsonPath = "${{ env.PLUGIN_NAME }}/bin/x64/Release/${{ env.PLUGIN_NAME }}.json" + $pluginJson = Get-Content $pluginJsonPath | ConvertFrom-Json + $repoJsonPath = "LightlessSyncRepo/LightlessSync/plogonmaster.json" + $repoJsonRaw = Get-Content $repoJsonPath -Raw + $repoJson = $repoJsonRaw | ConvertFrom-Json + $version = $env:VERSION + $downloadUrl = "https://github.com/${{ github.repository_owner }}/LightlessClient/releases/download/$version/LightlessClient.zip" + + if (-not ($repoJson -is [System.Collections.IEnumerable])) { + $repoJson = @($repoJson) + } + + foreach ($plugin in $repoJson) { + if ($plugin.InternalName -eq $pluginJson.InternalName) { + $plugin.DalamudApiLevel = $pluginJson.DalamudApiLevel + $plugin.AssemblyVersion = $version + $plugin.DownloadLinkInstall = $downloadUrl + $plugin.DownloadLinkTesting = $downloadUrl + $plugin.DownloadLinkUpdate = $downloadUrl + } + } + + $repoJson | ConvertTo-Json -Depth 100 | Set-Content $repoJsonPath + + - name: Commit and push to LightlessSync + run: | + cd LightlessSyncRepo/LightlessSync + git config user.name "github-actions" + git config user.email "github-actions@github.com" + git add . + git commit -m "Update ${{ env.PLUGIN_NAME }} to ${{ steps.package_version.outputs.version }}" + git push https://x-access-token:${{ secrets.LIGHTLESS_TOKEN }}@github.com/${{ github.repository_owner }}/LightlessSync.git HEAD:main \ No newline at end of file diff --git a/LightlessSync/Interop/Ipc/IpcCallerPetNames.cs b/LightlessSync/Interop/Ipc/IpcCallerPetNames.cs index a316502..75aaef8 100644 --- a/LightlessSync/Interop/Ipc/IpcCallerPetNames.cs +++ b/LightlessSync/Interop/Ipc/IpcCallerPetNames.cs @@ -84,7 +84,7 @@ public sealed class IpcCallerPetNames : IIpcCaller { string localNameData = _getPlayerData.InvokeFunc(); return string.IsNullOrEmpty(localNameData) ? string.Empty : localNameData; - } + } catch (Exception e) { _logger.LogWarning(e, "Could not obtain Pet Nicknames data"); diff --git a/LightlessSync/MareConfiguration/CharaDataConfigService.cs b/LightlessSync/LightlessConfiguration/CharaDataConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/CharaDataConfigService.cs rename to LightlessSync/LightlessConfiguration/CharaDataConfigService.cs diff --git a/LightlessSync/MareConfiguration/ConfigurationExtensions.cs b/LightlessSync/LightlessConfiguration/ConfigurationExtensions.cs similarity index 100% rename from LightlessSync/MareConfiguration/ConfigurationExtensions.cs rename to LightlessSync/LightlessConfiguration/ConfigurationExtensions.cs diff --git a/LightlessSync/MareConfiguration/ConfigurationMigrator.cs b/LightlessSync/LightlessConfiguration/ConfigurationMigrator.cs similarity index 100% rename from LightlessSync/MareConfiguration/ConfigurationMigrator.cs rename to LightlessSync/LightlessConfiguration/ConfigurationMigrator.cs diff --git a/LightlessSync/MareConfiguration/ConfigurationSaveService.cs b/LightlessSync/LightlessConfiguration/ConfigurationSaveService.cs similarity index 99% rename from LightlessSync/MareConfiguration/ConfigurationSaveService.cs rename to LightlessSync/LightlessConfiguration/ConfigurationSaveService.cs index 1dc0c44..6208dae 100644 --- a/LightlessSync/MareConfiguration/ConfigurationSaveService.cs +++ b/LightlessSync/LightlessConfiguration/ConfigurationSaveService.cs @@ -1,5 +1,4 @@ using LightlessSync.LightlessConfiguration.Configurations; -using LightlessSync.LightlessConfiguration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System.Reflection; diff --git a/LightlessSync/MareConfiguration/ConfigurationServiceBase.cs b/LightlessSync/LightlessConfiguration/ConfigurationServiceBase.cs similarity index 100% rename from LightlessSync/MareConfiguration/ConfigurationServiceBase.cs rename to LightlessSync/LightlessConfiguration/ConfigurationServiceBase.cs diff --git a/LightlessSync/MareConfiguration/Configurations/CharaDataConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/CharaDataConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/CharaDataConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/CharaDataConfig.cs diff --git a/LightlessSync/MareConfiguration/Configurations/IMareConfiguration.cs b/LightlessSync/LightlessConfiguration/Configurations/ILightlessConfiguration.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/IMareConfiguration.cs rename to LightlessSync/LightlessConfiguration/Configurations/ILightlessConfiguration.cs diff --git a/LightlessSync/MareConfiguration/Configurations/MareConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs similarity index 92% rename from LightlessSync/MareConfiguration/Configurations/MareConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs index 12047bb..660cddf 100644 --- a/LightlessSync/MareConfiguration/Configurations/MareConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs @@ -13,6 +13,8 @@ public class LightlessConfig : ILightlessConfiguration public bool EnableDtrEntry { get; set; } = false; public bool ShowUidInDtrTooltip { get; set; } = true; public bool PreferNoteInDtrTooltip { get; set; } = false; + public bool IsNameplateColorsEnabled { get; set; } = false; + public DtrEntry.Colors NameplateColors { get; set; } = new(Foreground: 0xE69138u, Glow: 0xFFBA47u); public bool UseColorsInDtr { get; set; } = true; public DtrEntry.Colors DtrColorsDefault { get; set; } = default; public DtrEntry.Colors DtrColorsNotConnected { get; set; } = new(Glow: 0x0428FFu); @@ -60,4 +62,6 @@ public class LightlessConfig : ILightlessConfiguration public int Version { get; set; } = 1; public NotificationLocation WarningNotification { get; set; } = NotificationLocation.Both; public bool UseFocusTarget { get; set; } = false; + public bool overrideFriendColor { get; set; } = false; + public bool overridePartyColor { get; set; } = false; } \ No newline at end of file diff --git a/LightlessSync/MareConfiguration/Configurations/PlayerPerformanceConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/PlayerPerformanceConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/PlayerPerformanceConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/PlayerPerformanceConfig.cs diff --git a/LightlessSync/MareConfiguration/Configurations/ServerConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/ServerConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/ServerConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/ServerConfig.cs diff --git a/LightlessSync/MareConfiguration/Configurations/ServerTagConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/ServerTagConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/ServerTagConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/ServerTagConfig.cs diff --git a/LightlessSync/MareConfiguration/Configurations/TransientConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/TransientConfig.cs similarity index 97% rename from LightlessSync/MareConfiguration/Configurations/TransientConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/TransientConfig.cs index 8d40ed4..c9a5f74 100644 --- a/LightlessSync/MareConfiguration/Configurations/TransientConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/TransientConfig.cs @@ -1,5 +1,4 @@ using LightlessSync.API.Data.Enum; -using LightlessSync.LightlessConfiguration.Configurations; namespace LightlessSync.LightlessConfiguration.Configurations; diff --git a/LightlessSync/MareConfiguration/Configurations/UidNotesConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/UidNotesConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/UidNotesConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/UidNotesConfig.cs diff --git a/LightlessSync/MareConfiguration/Configurations/XivDataStorageConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/XivDataStorageConfig.cs similarity index 100% rename from LightlessSync/MareConfiguration/Configurations/XivDataStorageConfig.cs rename to LightlessSync/LightlessConfiguration/Configurations/XivDataStorageConfig.cs diff --git a/LightlessSync/MareConfiguration/IConfigService.cs b/LightlessSync/LightlessConfiguration/IConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/IConfigService.cs rename to LightlessSync/LightlessConfiguration/IConfigService.cs diff --git a/LightlessSync/MareConfiguration/MareConfigService.cs b/LightlessSync/LightlessConfiguration/LightlessConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/MareConfigService.cs rename to LightlessSync/LightlessConfiguration/LightlessConfigService.cs diff --git a/LightlessSync/MareConfiguration/Models/Authentication.cs b/LightlessSync/LightlessConfiguration/Models/Authentication.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/Authentication.cs rename to LightlessSync/LightlessConfiguration/Models/Authentication.cs diff --git a/LightlessSync/MareConfiguration/Models/CharaDataFavorite.cs b/LightlessSync/LightlessConfiguration/Models/CharaDataFavorite.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/CharaDataFavorite.cs rename to LightlessSync/LightlessConfiguration/Models/CharaDataFavorite.cs diff --git a/LightlessSync/MareConfiguration/Models/DownloadSpeeds.cs b/LightlessSync/LightlessConfiguration/Models/DownloadSpeeds.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/DownloadSpeeds.cs rename to LightlessSync/LightlessConfiguration/Models/DownloadSpeeds.cs diff --git a/LightlessSync/MareConfiguration/Models/NotificationLocation.cs b/LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/NotificationLocation.cs rename to LightlessSync/LightlessConfiguration/Models/NotificationLocation.cs diff --git a/LightlessSync/MareConfiguration/Models/Obsolete/ServerStorageV0.cs b/LightlessSync/LightlessConfiguration/Models/Obsolete/ServerStorageV0.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/Obsolete/ServerStorageV0.cs rename to LightlessSync/LightlessConfiguration/Models/Obsolete/ServerStorageV0.cs diff --git a/LightlessSync/MareConfiguration/Models/SecretKey.cs b/LightlessSync/LightlessConfiguration/Models/SecretKey.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/SecretKey.cs rename to LightlessSync/LightlessConfiguration/Models/SecretKey.cs diff --git a/LightlessSync/MareConfiguration/Models/ServerNotesStorage.cs b/LightlessSync/LightlessConfiguration/Models/ServerNotesStorage.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/ServerNotesStorage.cs rename to LightlessSync/LightlessConfiguration/Models/ServerNotesStorage.cs diff --git a/LightlessSync/MareConfiguration/Models/ServerStorage.cs b/LightlessSync/LightlessConfiguration/Models/ServerStorage.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/ServerStorage.cs rename to LightlessSync/LightlessConfiguration/Models/ServerStorage.cs diff --git a/LightlessSync/MareConfiguration/Models/ServerTagStorage.cs b/LightlessSync/LightlessConfiguration/Models/ServerTagStorage.cs similarity index 100% rename from LightlessSync/MareConfiguration/Models/ServerTagStorage.cs rename to LightlessSync/LightlessConfiguration/Models/ServerTagStorage.cs diff --git a/LightlessSync/MareConfiguration/NotesConfigService.cs b/LightlessSync/LightlessConfiguration/NotesConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/NotesConfigService.cs rename to LightlessSync/LightlessConfiguration/NotesConfigService.cs diff --git a/LightlessSync/MareConfiguration/PlayerPerformanceConfigService.cs b/LightlessSync/LightlessConfiguration/PlayerPerformanceConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/PlayerPerformanceConfigService.cs rename to LightlessSync/LightlessConfiguration/PlayerPerformanceConfigService.cs diff --git a/LightlessSync/MareConfiguration/ServerConfigService.cs b/LightlessSync/LightlessConfiguration/ServerConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/ServerConfigService.cs rename to LightlessSync/LightlessConfiguration/ServerConfigService.cs diff --git a/LightlessSync/MareConfiguration/ServerTagConfigService.cs b/LightlessSync/LightlessConfiguration/ServerTagConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/ServerTagConfigService.cs rename to LightlessSync/LightlessConfiguration/ServerTagConfigService.cs diff --git a/LightlessSync/MareConfiguration/TransientConfigService.cs b/LightlessSync/LightlessConfiguration/TransientConfigService.cs similarity index 100% rename from LightlessSync/MareConfiguration/TransientConfigService.cs rename to LightlessSync/LightlessConfiguration/TransientConfigService.cs diff --git a/LightlessSync/MareConfiguration/XivDataStorageService.cs b/LightlessSync/LightlessConfiguration/XivDataStorageService.cs similarity index 100% rename from LightlessSync/MareConfiguration/XivDataStorageService.cs rename to LightlessSync/LightlessConfiguration/XivDataStorageService.cs diff --git a/LightlessSync/MarePlugin.cs b/LightlessSync/LightlessPlugin.cs similarity index 99% rename from LightlessSync/MarePlugin.cs rename to LightlessSync/LightlessPlugin.cs index a78cdbb..85582a0 100644 --- a/LightlessSync/MarePlugin.cs +++ b/LightlessSync/LightlessPlugin.cs @@ -151,6 +151,7 @@ public class LightlessPlugin : MediatorSubscriberBase, IHostedService _runtimeServiceScope.ServiceProvider.GetRequiredService(); _runtimeServiceScope.ServiceProvider.GetRequiredService(); _runtimeServiceScope.ServiceProvider.GetRequiredService(); + _runtimeServiceScope.ServiceProvider.GetRequiredService(); #if !DEBUG if (_lightlessConfigService.Current.LogLevel != LogLevel.Information) diff --git a/LightlessSync/PlayerData/Factories/PlayerDataFactory.cs b/LightlessSync/PlayerData/Factories/PlayerDataFactory.cs index bc30c0e..6e21ad2 100644 --- a/LightlessSync/PlayerData/Factories/PlayerDataFactory.cs +++ b/LightlessSync/PlayerData/Factories/PlayerDataFactory.cs @@ -8,7 +8,6 @@ using LightlessSync.PlayerData.Handlers; using LightlessSync.Services; using LightlessSync.Services.Mediator; using Microsoft.Extensions.Logging; -using CharacterData = LightlessSync.PlayerData.Data.CharacterData; namespace LightlessSync.PlayerData.Factories; diff --git a/LightlessSync/PlayerData/Handlers/PairHandler.cs b/LightlessSync/PlayerData/Handlers/PairHandler.cs index 345118a..2153f87 100644 --- a/LightlessSync/PlayerData/Handlers/PairHandler.cs +++ b/LightlessSync/PlayerData/Handlers/PairHandler.cs @@ -119,6 +119,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase Mediator.Publish(new EventMessage(new Event(PlayerName, Pair.UserData, nameof(PairHandler), EventSeverity.Informational, text))); Mediator.Publish(new RefreshUiMessage()); + Mediator.Publish(new VisibilityChange()); } } } diff --git a/LightlessSync/PlayerData/Pairs/Pair.cs b/LightlessSync/PlayerData/Pairs/Pair.cs index 6eaebb9..fe6cd7b 100644 --- a/LightlessSync/PlayerData/Pairs/Pair.cs +++ b/LightlessSync/PlayerData/Pairs/Pair.cs @@ -48,6 +48,7 @@ public class Pair public long LastAppliedDataTris { get; set; } = -1; public long LastAppliedApproximateVRAMBytes { get; set; } = -1; public string Ident => _onlineUserIdentDto?.Ident ?? string.Empty; + public uint PlayerCharacterId => CachedPlayer?.PlayerCharacterId ?? uint.MaxValue; public UserData UserData => UserPair.User; diff --git a/LightlessSync/Plugin.cs b/LightlessSync/Plugin.cs index 39b1225..cb76876 100644 --- a/LightlessSync/Plugin.cs +++ b/LightlessSync/Plugin.cs @@ -1,4 +1,5 @@ -using Dalamud.Game.ClientState.Objects; +using Dalamud.Game; +using Dalamud.Game.ClientState.Objects; using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.Windowing; using Dalamud.Plugin; @@ -12,6 +13,7 @@ using LightlessSync.PlayerData.Factories; using LightlessSync.PlayerData.Pairs; using LightlessSync.PlayerData.Services; using LightlessSync.Services; +using LightlessSync.Services.CharaData; using LightlessSync.Services.Events; using LightlessSync.Services.Mediator; using LightlessSync.Services.ServerConfiguration; @@ -28,8 +30,6 @@ using Microsoft.Extensions.Logging; using NReco.Logging.File; using System.Net.Http.Headers; using System.Reflection; -using LightlessSync.Services.CharaData; -using Dalamud.Game; namespace LightlessSync; @@ -41,7 +41,7 @@ public sealed class Plugin : IDalamudPlugin IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui, IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager, INotificationManager notificationManager, ITextureProvider textureProvider, IContextMenu contextMenu, IGameInteropProvider gameInteropProvider, IGameConfig gameConfig, - ISigScanner sigScanner) + ISigScanner sigScanner, INamePlateGui namePlateGui) { if (!Directory.Exists(pluginInterface.ConfigDirectory.FullName)) Directory.CreateDirectory(pluginInterface.ConfigDirectory.FullName); @@ -228,6 +228,8 @@ public sealed class Plugin : IDalamudPlugin s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(), pluginInterface, textureProvider, s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService())); + collection.AddScoped((s) => new NameplateService(s.GetRequiredService>(), s.GetRequiredService(), namePlateGui, clientState, + s.GetRequiredService(), s.GetRequiredService())); collection.AddHostedService(p => p.GetRequiredService()); collection.AddHostedService(p => p.GetRequiredService()); diff --git a/LightlessSync/Services/CharaData/CharaDataTogetherManager.cs b/LightlessSync/Services/CharaData/CharaDataTogetherManager.cs index 3d4c791..18d84c3 100644 --- a/LightlessSync/Services/CharaData/CharaDataTogetherManager.cs +++ b/LightlessSync/Services/CharaData/CharaDataTogetherManager.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LightlessSync.Services.CharaData +namespace LightlessSync.Services.CharaData { internal class CharaDataTogetherManager { diff --git a/LightlessSync/Services/CharaData/Models/MareCharaFileData.cs b/LightlessSync/Services/CharaData/Models/LightlessCharaFileData.cs similarity index 100% rename from LightlessSync/Services/CharaData/Models/MareCharaFileData.cs rename to LightlessSync/Services/CharaData/Models/LightlessCharaFileData.cs diff --git a/LightlessSync/Services/CharaData/Models/MareCharaFileHeader.cs b/LightlessSync/Services/CharaData/Models/LightlessCharaFileHeader.cs similarity index 100% rename from LightlessSync/Services/CharaData/Models/MareCharaFileHeader.cs rename to LightlessSync/Services/CharaData/Models/LightlessCharaFileHeader.cs diff --git a/LightlessSync/Services/CharaData/Models/PoseEntryExtended.cs b/LightlessSync/Services/CharaData/Models/PoseEntryExtended.cs index 27325d4..5e563ac 100644 --- a/LightlessSync/Services/CharaData/Models/PoseEntryExtended.cs +++ b/LightlessSync/Services/CharaData/Models/PoseEntryExtended.cs @@ -1,6 +1,6 @@ using Dalamud.Utility; -using Lumina.Excel.Sheets; using LightlessSync.API.Dto.CharaData; +using Lumina.Excel.Sheets; using System.Globalization; using System.Numerics; using System.Text; diff --git a/LightlessSync/Services/CharacterAnalyzer.cs b/LightlessSync/Services/CharacterAnalyzer.cs index b7743aa..c35fd01 100644 --- a/LightlessSync/Services/CharacterAnalyzer.cs +++ b/LightlessSync/Services/CharacterAnalyzer.cs @@ -1,10 +1,10 @@ -using Lumina.Data.Files; -using LightlessSync.API.Data; +using LightlessSync.API.Data; using LightlessSync.API.Data.Enum; using LightlessSync.FileCache; using LightlessSync.Services.Mediator; using LightlessSync.UI; using LightlessSync.Utils; +using Lumina.Data.Files; using Microsoft.Extensions.Logging; namespace LightlessSync.Services; diff --git a/LightlessSync/Services/DalamudUtilService.cs b/LightlessSync/Services/DalamudUtilService.cs index b0539bb..d4d79e0 100644 --- a/LightlessSync/Services/DalamudUtilService.cs +++ b/LightlessSync/Services/DalamudUtilService.cs @@ -1,5 +1,4 @@ -using Dalamud.Game; -using Dalamud.Game.ClientState.Conditions; +using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.Types; @@ -10,13 +9,13 @@ using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Control; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.UI.Agent; -using Lumina.Excel.Sheets; using LightlessSync.API.Dto.CharaData; using LightlessSync.Interop; using LightlessSync.LightlessConfiguration; using LightlessSync.PlayerData.Handlers; using LightlessSync.Services.Mediator; using LightlessSync.Utils; +using Lumina.Excel.Sheets; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System.Numerics; @@ -135,7 +134,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber _cid = RebuildCID(); } - private Lazy RebuildCID() => new(GetCID); + private Lazy RebuildCID() => new(GetCID); public bool IsWine { get; init; } diff --git a/LightlessSync/Services/MareProfileData.cs b/LightlessSync/Services/LightlessProfileData.cs similarity index 100% rename from LightlessSync/Services/MareProfileData.cs rename to LightlessSync/Services/LightlessProfileData.cs diff --git a/LightlessSync/Services/MareProfileManager.cs b/LightlessSync/Services/LightlessProfileManager.cs similarity index 100% rename from LightlessSync/Services/MareProfileManager.cs rename to LightlessSync/Services/LightlessProfileManager.cs diff --git a/LightlessSync/Services/Mediator/MareMediator.cs b/LightlessSync/Services/Mediator/LightlessMediator.cs similarity index 100% rename from LightlessSync/Services/Mediator/MareMediator.cs rename to LightlessSync/Services/Mediator/LightlessMediator.cs diff --git a/LightlessSync/Services/Mediator/Messages.cs b/LightlessSync/Services/Mediator/Messages.cs index f235332..0f52ec5 100644 --- a/LightlessSync/Services/Mediator/Messages.cs +++ b/LightlessSync/Services/Mediator/Messages.cs @@ -93,5 +93,7 @@ public record GPoseLobbyReceiveCharaData(CharaDataDownloadDto CharaDataDownloadD public record GPoseLobbyReceivePoseData(UserData UserData, PoseData PoseData) : MessageBase; public record GPoseLobbyReceiveWorldData(UserData UserData, WorldData WorldData) : MessageBase; public record OpenCharaDataHubWithFilterMessage(UserData UserData) : MessageBase; + +public record VisibilityChange : MessageBase; #pragma warning restore S2094 #pragma warning restore MA0048 // File name must match type name \ No newline at end of file diff --git a/LightlessSync/Services/NameplateService.cs b/LightlessSync/Services/NameplateService.cs new file mode 100644 index 0000000..d83643a --- /dev/null +++ b/LightlessSync/Services/NameplateService.cs @@ -0,0 +1,91 @@ +using Dalamud.Game.ClientState.Objects.Enums; +using Dalamud.Game.Gui.NamePlate; +using Dalamud.Game.Text.SeStringHandling; +using Dalamud.Plugin.Services; +using Dalamud.Utility; +using LightlessSync.LightlessConfiguration; +using LightlessSync.PlayerData.Pairs; +using LightlessSync.Services.Mediator; +using LightlessSync.UI; +using Microsoft.Extensions.Logging; +namespace LightlessSync.Services; + +public class NameplateService : DisposableMediatorSubscriberBase +{ + private readonly LightlessConfigService _configService; + private readonly IClientState _clientState; + private readonly INamePlateGui _namePlateGui; + private readonly PairManager _pairManager; + + public NameplateService(ILogger logger, + LightlessConfigService configService, + INamePlateGui namePlateGui, + IClientState clientState, + PairManager pairManager, + LightlessMediator lightlessMediator) : base(logger, lightlessMediator) + { + _configService = configService; + _namePlateGui = namePlateGui; + _clientState = clientState; + _pairManager = pairManager; + _namePlateGui.OnNamePlateUpdate += OnNamePlateUpdate; + _namePlateGui.RequestRedraw(); + Mediator.Subscribe(this, (_) => _namePlateGui.RequestRedraw()); + + } + + private void OnNamePlateUpdate(INamePlateUpdateContext context, IReadOnlyList handlers) + { + + if (!_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; + if (playerCharacter == null) { continue; } + var isInParty = playerCharacter.StatusFlags.HasFlag(StatusFlags.PartyMember); + var isFriend = playerCharacter.StatusFlags.HasFlag(StatusFlags.Friend); + bool partyColorAllowed = (_configService.Current.overridePartyColor && isInParty); + bool friendColorAllowed = (_configService.Current.overrideFriendColor && isFriend); + + if (visibleUsersIds.Contains(handler.GameObjectId) && + !( + (isInParty && !partyColorAllowed) || + (isFriend && !friendColorAllowed) + )) + { + handler.NameParts.TextWrap = CreateTextWrap(colors); + } + } + } + + public void RequestRedraw() + { + _namePlateGui.RequestRedraw(); + } + + private static (SeString, SeString) CreateTextWrap(DtrEntry.Colors color) + { + var left = new Lumina.Text.SeStringBuilder(); + var right = new Lumina.Text.SeStringBuilder(); + + left.PushColorRgba(color.Foreground); + right.PopColor(); + + left.PushEdgeColorRgba(color.Glow); + right.PopEdgeColor(); + + return (left.ToReadOnlySeString().ToDalamudString(), right.ToReadOnlySeString().ToDalamudString()); + } + + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + _namePlateGui.OnNamePlateUpdate -= OnNamePlateUpdate; + _namePlateGui.RequestRedraw(); + } +} + diff --git a/LightlessSync/UI/CharaDataHubUi.Functions.cs b/LightlessSync/UI/CharaDataHubUi.Functions.cs index e6e0c77..665e640 100644 --- a/LightlessSync/UI/CharaDataHubUi.Functions.cs +++ b/LightlessSync/UI/CharaDataHubUi.Functions.cs @@ -8,187 +8,187 @@ namespace LightlessSync.UI; internal sealed partial class CharaDataHubUi { - private static string GetAccessTypeString(AccessTypeDto dto) => dto switch - { - AccessTypeDto.AllPairs => "All Pairs", - AccessTypeDto.ClosePairs => "Direct Pairs", - AccessTypeDto.Individuals => "Specified", - AccessTypeDto.Public => "Everyone" - }; + private static string GetAccessTypeString(AccessTypeDto dto) => dto switch + { + AccessTypeDto.AllPairs => "All Pairs", + AccessTypeDto.ClosePairs => "Direct Pairs", + AccessTypeDto.Individuals => "Specified", + AccessTypeDto.Public => "Everyone" + }; - private static string GetShareTypeString(ShareTypeDto dto) => dto switch - { - ShareTypeDto.Private => "Code Only", - ShareTypeDto.Shared => "Shared" - }; + private static string GetShareTypeString(ShareTypeDto dto) => dto switch + { + ShareTypeDto.Private => "Code Only", + ShareTypeDto.Shared => "Shared" + }; - private static string GetWorldDataTooltipText(PoseEntryExtended poseEntry) - { - if (!poseEntry.HasWorldData) return "This Pose has no world data attached."; - return poseEntry.WorldDataDescriptor; - } + private static string GetWorldDataTooltipText(PoseEntryExtended poseEntry) + { + if (!poseEntry.HasWorldData) return "This Pose has no world data attached."; + return poseEntry.WorldDataDescriptor; + } - private void GposeMetaInfoAction(Action gposeActionDraw, string actionDescription, CharaDataMetaInfoExtendedDto? dto, bool hasValidGposeTarget, bool isSpawning) - { - StringBuilder sb = new StringBuilder(); + private void GposeMetaInfoAction(Action gposeActionDraw, string actionDescription, CharaDataMetaInfoExtendedDto? dto, bool hasValidGposeTarget, bool isSpawning) + { + StringBuilder sb = new StringBuilder(); - sb.AppendLine(actionDescription); - bool isDisabled = false; + sb.AppendLine(actionDescription); + bool isDisabled = false; - void AddErrorStart(StringBuilder sb) - { - sb.Append(UiSharedService.TooltipSeparator); - sb.AppendLine("Cannot execute:"); - } + void AddErrorStart(StringBuilder sb) + { + sb.Append(UiSharedService.TooltipSeparator); + sb.AppendLine("Cannot execute:"); + } - if (dto == null) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- No metainfo present"); - isDisabled = true; - } - if (!dto?.CanBeDownloaded ?? false) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Character is not downloadable"); - isDisabled = true; - } - if (!_uiSharedService.IsInGpose) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires to be in GPose"); - isDisabled = true; - } - if (!hasValidGposeTarget && !isSpawning) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires a valid GPose target"); - isDisabled = true; - } - if (isSpawning && !_charaDataManager.BrioAvailable) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires Brio to be installed."); - isDisabled = true; - } + if (dto == null) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- No metainfo present"); + isDisabled = true; + } + if (!dto?.CanBeDownloaded ?? false) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Character is not downloadable"); + isDisabled = true; + } + if (!_uiSharedService.IsInGpose) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires to be in GPose"); + isDisabled = true; + } + if (!hasValidGposeTarget && !isSpawning) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires a valid GPose target"); + isDisabled = true; + } + if (isSpawning && !_charaDataManager.BrioAvailable) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires Brio to be installed."); + isDisabled = true; + } - using (ImRaii.Group()) - { - using var dis = ImRaii.Disabled(isDisabled); - gposeActionDraw.Invoke(dto); - } - if (sb.Length > 0) - { - UiSharedService.AttachToolTip(sb.ToString()); - } - } + using (ImRaii.Group()) + { + using var dis = ImRaii.Disabled(isDisabled); + gposeActionDraw.Invoke(dto); + } + if (sb.Length > 0) + { + UiSharedService.AttachToolTip(sb.ToString()); + } + } - private void GposePoseAction(Action poseActionDraw, string poseDescription, bool hasValidGposeTarget) - { - StringBuilder sb = new StringBuilder(); + private void GposePoseAction(Action poseActionDraw, string poseDescription, bool hasValidGposeTarget) + { + StringBuilder sb = new StringBuilder(); - sb.AppendLine(poseDescription); - bool isDisabled = false; + sb.AppendLine(poseDescription); + bool isDisabled = false; - void AddErrorStart(StringBuilder sb) - { - sb.Append(UiSharedService.TooltipSeparator); - sb.AppendLine("Cannot execute:"); - } + void AddErrorStart(StringBuilder sb) + { + sb.Append(UiSharedService.TooltipSeparator); + sb.AppendLine("Cannot execute:"); + } - if (!_uiSharedService.IsInGpose) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires to be in GPose"); - isDisabled = true; - } - if (!hasValidGposeTarget) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires a valid GPose target"); - isDisabled = true; - } - if (!_charaDataManager.BrioAvailable) - { - if (!isDisabled) AddErrorStart(sb); - sb.AppendLine("- Requires Brio to be installed."); - isDisabled = true; - } + if (!_uiSharedService.IsInGpose) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires to be in GPose"); + isDisabled = true; + } + if (!hasValidGposeTarget) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires a valid GPose target"); + isDisabled = true; + } + if (!_charaDataManager.BrioAvailable) + { + if (!isDisabled) AddErrorStart(sb); + sb.AppendLine("- Requires Brio to be installed."); + isDisabled = true; + } - using (ImRaii.Group()) - { - using var dis = ImRaii.Disabled(isDisabled); - poseActionDraw.Invoke(); - } - if (sb.Length > 0) - { - UiSharedService.AttachToolTip(sb.ToString()); - } - } + using (ImRaii.Group()) + { + using var dis = ImRaii.Disabled(isDisabled); + poseActionDraw.Invoke(); + } + if (sb.Length > 0) + { + UiSharedService.AttachToolTip(sb.ToString()); + } + } - private void SetWindowSizeConstraints(bool? inGposeTab = null) - { - SizeConstraints = new() - { - MinimumSize = new((inGposeTab ?? false) ? 400 : 1000, 500), - MaximumSize = new((inGposeTab ?? false) ? 400 : 1000, 2000) - }; - } + private void SetWindowSizeConstraints(bool? inGposeTab = null) + { + SizeConstraints = new() + { + MinimumSize = new((inGposeTab ?? false) ? 400 : 1000, 500), + MaximumSize = new((inGposeTab ?? false) ? 400 : 1000, 2000) + }; + } - private void UpdateFilteredFavorites() - { - _ = Task.Run(async () => - { - if (_charaDataManager.DownloadMetaInfoTask != null) - { - await _charaDataManager.DownloadMetaInfoTask.ConfigureAwait(false); - } - Dictionary newFiltered = []; - foreach (var favorite in _configService.Current.FavoriteCodes) - { - var uid = favorite.Key.Split(":")[0]; - var note = _serverConfigurationManager.GetNoteForUid(uid) ?? string.Empty; - bool hasMetaInfo = _charaDataManager.TryGetMetaInfo(favorite.Key, out var metaInfo); - bool addFavorite = - (string.IsNullOrEmpty(_filterCodeNote) - || (note.Contains(_filterCodeNote, StringComparison.OrdinalIgnoreCase) - || uid.Contains(_filterCodeNote, StringComparison.OrdinalIgnoreCase))) - && (string.IsNullOrEmpty(_filterDescription) - || (favorite.Value.CustomDescription.Contains(_filterDescription, StringComparison.OrdinalIgnoreCase) - || (metaInfo != null && metaInfo!.Description.Contains(_filterDescription, StringComparison.OrdinalIgnoreCase)))) - && (!_filterPoseOnly - || (metaInfo != null && metaInfo!.HasPoses)) - && (!_filterWorldOnly - || (metaInfo != null && metaInfo!.HasWorldData)); - if (addFavorite) - { - newFiltered[favorite.Key] = (favorite.Value, metaInfo, hasMetaInfo); - } - } + private void UpdateFilteredFavorites() + { + _ = Task.Run(async () => + { + if (_charaDataManager.DownloadMetaInfoTask != null) + { + await _charaDataManager.DownloadMetaInfoTask.ConfigureAwait(false); + } + Dictionary newFiltered = []; + foreach (var favorite in _configService.Current.FavoriteCodes) + { + var uid = favorite.Key.Split(":")[0]; + var note = _serverConfigurationManager.GetNoteForUid(uid) ?? string.Empty; + bool hasMetaInfo = _charaDataManager.TryGetMetaInfo(favorite.Key, out var metaInfo); + bool addFavorite = + (string.IsNullOrEmpty(_filterCodeNote) + || (note.Contains(_filterCodeNote, StringComparison.OrdinalIgnoreCase) + || uid.Contains(_filterCodeNote, StringComparison.OrdinalIgnoreCase))) + && (string.IsNullOrEmpty(_filterDescription) + || (favorite.Value.CustomDescription.Contains(_filterDescription, StringComparison.OrdinalIgnoreCase) + || (metaInfo != null && metaInfo!.Description.Contains(_filterDescription, StringComparison.OrdinalIgnoreCase)))) + && (!_filterPoseOnly + || (metaInfo != null && metaInfo!.HasPoses)) + && (!_filterWorldOnly + || (metaInfo != null && metaInfo!.HasWorldData)); + if (addFavorite) + { + newFiltered[favorite.Key] = (favorite.Value, metaInfo, hasMetaInfo); + } + } - _filteredFavorites = newFiltered; - }); - } + _filteredFavorites = newFiltered; + }); + } - private void UpdateFilteredItems() - { - if (_charaDataManager.GetSharedWithYouTask == null) - { - _filteredDict = _charaDataManager.SharedWithYouData - .SelectMany(k => k.Value) - .Where(k => - (!_sharedWithYouDownloadableFilter || k.CanBeDownloaded) - && (string.IsNullOrEmpty(_sharedWithYouDescriptionFilter) || k.Description.Contains(_sharedWithYouDescriptionFilter, StringComparison.OrdinalIgnoreCase))) - .GroupBy(k => k.Uploader) - .ToDictionary(k => - { - var note = _serverConfigurationManager.GetNoteForUid(k.Key.UID); - if (note == null) return k.Key.AliasOrUID; - return $"{note} ({k.Key.AliasOrUID})"; - }, k => k.ToList(), StringComparer.OrdinalIgnoreCase) - .Where(k => (string.IsNullOrEmpty(_sharedWithYouOwnerFilter) || k.Key.Contains(_sharedWithYouOwnerFilter, StringComparison.OrdinalIgnoreCase))) - .OrderBy(k => k.Key, StringComparer.OrdinalIgnoreCase).ToDictionary(); - } - } + private void UpdateFilteredItems() + { + if (_charaDataManager.GetSharedWithYouTask == null) + { + _filteredDict = _charaDataManager.SharedWithYouData + .SelectMany(k => k.Value) + .Where(k => + (!_sharedWithYouDownloadableFilter || k.CanBeDownloaded) + && (string.IsNullOrEmpty(_sharedWithYouDescriptionFilter) || k.Description.Contains(_sharedWithYouDescriptionFilter, StringComparison.OrdinalIgnoreCase))) + .GroupBy(k => k.Uploader) + .ToDictionary(k => + { + var note = _serverConfigurationManager.GetNoteForUid(k.Key.UID); + if (note == null) return k.Key.AliasOrUID; + return $"{note} ({k.Key.AliasOrUID})"; + }, k => k.ToList(), StringComparer.OrdinalIgnoreCase) + .Where(k => (string.IsNullOrEmpty(_sharedWithYouOwnerFilter) || k.Key.Contains(_sharedWithYouOwnerFilter, StringComparison.OrdinalIgnoreCase))) + .OrderBy(k => k.Key, StringComparer.OrdinalIgnoreCase).ToDictionary(); + } + } } diff --git a/LightlessSync/UI/CharaDataHubUi.McdOnline.cs b/LightlessSync/UI/CharaDataHubUi.McdOnline.cs index ef260f3..ed2c624 100644 --- a/LightlessSync/UI/CharaDataHubUi.McdOnline.cs +++ b/LightlessSync/UI/CharaDataHubUi.McdOnline.cs @@ -1,8 +1,8 @@ using Dalamud.Bindings.ImGui; -using Dalamud.Interface.Colors; -using Dalamud.Interface.Utility.Raii; -using Dalamud.Interface.Utility; using Dalamud.Interface; +using Dalamud.Interface.Colors; +using Dalamud.Interface.Utility; +using Dalamud.Interface.Utility.Raii; using LightlessSync.API.Dto.CharaData; using LightlessSync.Services.CharaData.Models; using System.Numerics; diff --git a/LightlessSync/UI/CharaDataHubUi.NearbyPoses.cs b/LightlessSync/UI/CharaDataHubUi.NearbyPoses.cs index 8818f63..e7d985f 100644 --- a/LightlessSync/UI/CharaDataHubUi.NearbyPoses.cs +++ b/LightlessSync/UI/CharaDataHubUi.NearbyPoses.cs @@ -1,8 +1,8 @@ using Dalamud.Bindings.ImGui; -using Dalamud.Interface.Colors; -using Dalamud.Interface.Utility.Raii; -using Dalamud.Interface.Utility; using Dalamud.Interface; +using Dalamud.Interface.Colors; +using Dalamud.Interface.Utility; +using Dalamud.Interface.Utility.Raii; using System.Numerics; namespace LightlessSync.UI; diff --git a/LightlessSync/UI/DownloadUi.cs b/LightlessSync/UI/DownloadUi.cs index e3c0493..83e585e 100644 --- a/LightlessSync/UI/DownloadUi.cs +++ b/LightlessSync/UI/DownloadUi.cs @@ -169,7 +169,7 @@ public class DownloadUi : WindowMediatorSubscriberBase var dlProgressPercent = transferredBytes / (double)totalBytes; drawList.AddRectFilled(dlBarStart, dlBarEnd with { X = dlBarStart.X + (float)(dlProgressPercent * dlBarWidth) }, - UiSharedService.Color(50, 205, 50, transparency), 1); + UiSharedService.Color(173, 138, 245, transparency), 1); if (_configService.Current.TransferBarsShowText) { diff --git a/LightlessSync/UI/IntroUI.cs b/LightlessSync/UI/IntroUI.cs index f21ecee..f21e968 100644 --- a/LightlessSync/UI/IntroUI.cs +++ b/LightlessSync/UI/IntroUI.cs @@ -4,9 +4,9 @@ using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Dalamud.Utility; using LightlessSync.FileCache; -using LightlessSync.Localization; using LightlessSync.LightlessConfiguration; using LightlessSync.LightlessConfiguration.Models; +using LightlessSync.Localization; using LightlessSync.Services; using LightlessSync.Services.Mediator; using LightlessSync.Services.ServerConfiguration; diff --git a/LightlessSync/UI/JoinSyncshellUI.cs b/LightlessSync/UI/JoinSyncshellUI.cs index 64d34b5..cb5c376 100644 --- a/LightlessSync/UI/JoinSyncshellUI.cs +++ b/LightlessSync/UI/JoinSyncshellUI.cs @@ -25,7 +25,7 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase private string _syncshellPassword = string.Empty; public JoinSyncshellUI(ILogger logger, LightlessMediator mediator, - UiSharedService uiSharedService, ApiController apiController, PerformanceCollectorService performanceCollectorService) + UiSharedService uiSharedService, ApiController apiController, PerformanceCollectorService performanceCollectorService) : base(logger, mediator, "Join existing Syncshell###LightlessSyncJoinSyncshell", performanceCollectorService) { _uiSharedService = uiSharedService; diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 1134629..db825c0 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -53,6 +53,7 @@ public class SettingsUi : WindowMediatorSubscriberBase private readonly ServerConfigurationManager _serverConfigurationManager; private readonly UiSharedService _uiShared; private readonly IProgress<(int, int, FileCacheEntity)> _validationProgress; + private readonly NameplateService _nameplateService; private (int, int, FileCacheEntity) _currentProgress; private bool _deleteAccountPopupModalShown = false; private bool _deleteFilesPopupModalShown = false; @@ -77,7 +78,8 @@ public class SettingsUi : WindowMediatorSubscriberBase FileCacheManager fileCacheManager, FileCompactor fileCompactor, ApiController apiController, IpcManager ipcManager, CacheMonitor cacheMonitor, - DalamudUtilService dalamudUtilService, HttpClient httpClient) : base(logger, mediator, "Lightless Sync Settings", performanceCollector) + DalamudUtilService dalamudUtilService, HttpClient httpClient, + NameplateService nameplateService) : base(logger, mediator, "Lightless Sync Settings", performanceCollector) { _configService = configService; _pairManager = pairManager; @@ -94,6 +96,7 @@ public class SettingsUi : WindowMediatorSubscriberBase _httpClient = httpClient; _fileCompactor = fileCompactor; _uiShared = uiShared; + _nameplateService = nameplateService; AllowClickthrough = false; AllowPinning = false; _validationProgress = new Progress<(int, int, FileCacheEntity)>(v => _currentProgress = v); @@ -111,6 +114,7 @@ public class SettingsUi : WindowMediatorSubscriberBase Mediator.Subscribe(this, (msg) => LastCreatedCharacterData = msg.CharacterData); Mediator.Subscribe(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus); Mediator.Subscribe(this, (msg) => _currentDownloads.TryRemove(msg.DownloadId, out _)); + _nameplateService = nameplateService; } public CharacterData? LastCreatedCharacterData { private get; set; } @@ -960,6 +964,41 @@ public class SettingsUi : WindowMediatorSubscriberBase } } + var nameColorsEnabled = _configService.Current.IsNameplateColorsEnabled; + var nameColors = _configService.Current.NameplateColors; + var isFriendOverride = _configService.Current.overrideFriendColor; + var isPartyOverride = _configService.Current.overridePartyColor; + + if (ImGui.Checkbox("Override name color of visible paired players", ref nameColorsEnabled)) + { + _configService.Current.IsNameplateColorsEnabled = nameColorsEnabled; + _configService.Save(); + _nameplateService.RequestRedraw(); + } + + using (ImRaii.Disabled(!nameColorsEnabled)) + { + using var indent = ImRaii.PushIndent(); + if (InputDtrColors("Name color", ref nameColors)) + { + _configService.Current.NameplateColors = nameColors; + _configService.Save(); + _nameplateService.RequestRedraw(); + } + if (ImGui.Checkbox("Override friend color", ref isFriendOverride)) + { + _configService.Current.overrideFriendColor = isFriendOverride; + _configService.Save(); + _nameplateService.RequestRedraw(); + } + if (ImGui.Checkbox("Override party color", ref isPartyOverride)) + { + _configService.Current.overridePartyColor = isPartyOverride; + _configService.Save(); + _nameplateService.RequestRedraw(); + } + } + if (ImGui.Checkbox("Show separate Visible group", ref showVisibleSeparate)) { _configService.Current.ShowVisibleUsersSeparately = showVisibleSeparate; diff --git a/LightlessSync/UI/UISharedService.cs b/LightlessSync/UI/UISharedService.cs index b1fc21f..79cbba1 100644 --- a/LightlessSync/UI/UISharedService.cs +++ b/LightlessSync/UI/UISharedService.cs @@ -12,9 +12,9 @@ using Dalamud.Plugin.Services; using Dalamud.Utility; using LightlessSync.FileCache; using LightlessSync.Interop.Ipc; -using LightlessSync.Localization; using LightlessSync.LightlessConfiguration; using LightlessSync.LightlessConfiguration.Models; +using LightlessSync.Localization; using LightlessSync.PlayerData.Pairs; using LightlessSync.Services; using LightlessSync.Services.Mediator; diff --git a/LightlessSync/Utils/MareInterpolatedStringHandler.cs b/LightlessSync/Utils/LightlessInterpolatedStringHandler.cs similarity index 100% rename from LightlessSync/Utils/MareInterpolatedStringHandler.cs rename to LightlessSync/Utils/LightlessInterpolatedStringHandler.cs diff --git a/LightlessSync/WebAPI/SignalR/ApiController.Functions.Callbacks.cs b/LightlessSync/WebAPI/SignalR/ApiController.Functions.Callbacks.cs index 3454759..154dbe6 100644 --- a/LightlessSync/WebAPI/SignalR/ApiController.Functions.Callbacks.cs +++ b/LightlessSync/WebAPI/SignalR/ApiController.Functions.Callbacks.cs @@ -8,7 +8,6 @@ using LightlessSync.LightlessConfiguration.Models; using LightlessSync.Services.Mediator; using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.Logging; -using static FFXIVClientStructs.FFXIV.Client.Game.UI.MapMarkerData.Delegates; namespace LightlessSync.WebAPI; diff --git a/LightlessSync/WebAPI/SignalR/ApiController.Functions.CharaData.cs b/LightlessSync/WebAPI/SignalR/ApiController.Functions.CharaData.cs index 092ce62..95fcb58 100644 --- a/LightlessSync/WebAPI/SignalR/ApiController.Functions.CharaData.cs +++ b/LightlessSync/WebAPI/SignalR/ApiController.Functions.CharaData.cs @@ -1,6 +1,5 @@ using LightlessSync.API.Data; using LightlessSync.API.Dto.CharaData; -using LightlessSync.Services.CharaData.Models; using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.Logging; diff --git a/LightlessSync/WebAPI/SignalR/MareAuthFailureException.cs b/LightlessSync/WebAPI/SignalR/LightlessAuthFailureException.cs similarity index 100% rename from LightlessSync/WebAPI/SignalR/MareAuthFailureException.cs rename to LightlessSync/WebAPI/SignalR/LightlessAuthFailureException.cs