Track and display last known player names automatically
This commit is contained in:
@@ -27,13 +27,14 @@ public class MareConfig : IMareConfiguration
|
|||||||
public int ParallelDownloads { get; set; } = 10;
|
public int ParallelDownloads { get; set; } = 10;
|
||||||
public int DownloadSpeedLimitInBytes { get; set; } = 0;
|
public int DownloadSpeedLimitInBytes { get; set; } = 0;
|
||||||
public DownloadSpeeds DownloadSpeedType { get; set; } = DownloadSpeeds.MBps;
|
public DownloadSpeeds DownloadSpeedType { get; set; } = DownloadSpeeds.MBps;
|
||||||
public bool PreferNotesOverNamesForVisible { get; set; } = false;
|
[Obsolete] public bool PreferNotesOverNamesForVisible { get; set; } = false;
|
||||||
public float ProfileDelay { get; set; } = 1.5f;
|
public float ProfileDelay { get; set; } = 1.5f;
|
||||||
public bool ProfilePopoutRight { get; set; } = false;
|
public bool ProfilePopoutRight { get; set; } = false;
|
||||||
public bool ProfilesAllowNsfw { get; set; } = false;
|
public bool ProfilesAllowNsfw { get; set; } = false;
|
||||||
public bool ProfilesShow { get; set; } = false;
|
public bool ProfilesShow { get; set; } = false;
|
||||||
public bool ShowSyncshellUsersInVisible { get; set; } = true;
|
public bool ShowSyncshellUsersInVisible { get; set; } = true;
|
||||||
public bool ShowCharacterNameInsteadOfNotesForVisible { get; set; } = false;
|
[Obsolete] public bool ShowCharacterNameInsteadOfNotesForVisible { get; set; } = false;
|
||||||
|
public bool ShowCharacterNames { get; set; } = true;
|
||||||
public bool ShowOfflineUsersSeparately { get; set; } = true;
|
public bool ShowOfflineUsersSeparately { get; set; } = true;
|
||||||
public bool ShowSyncshellOfflineUsersSeparately { get; set; } = true;
|
public bool ShowSyncshellOfflineUsersSeparately { get; set; } = true;
|
||||||
public bool GroupUpSyncshells { get; set; } = true;
|
public bool GroupUpSyncshells { get; set; } = true;
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ public class ServerNotesStorage
|
|||||||
{
|
{
|
||||||
public Dictionary<string, string> GidServerComments { get; set; } = new(StringComparer.Ordinal);
|
public Dictionary<string, string> GidServerComments { get; set; } = new(StringComparer.Ordinal);
|
||||||
public Dictionary<string, string> UidServerComments { get; set; } = new(StringComparer.Ordinal);
|
public Dictionary<string, string> UidServerComments { get; set; } = new(StringComparer.Ordinal);
|
||||||
|
public Dictionary<string, string> UidLastSeenNames { get; set; } = new(StringComparer.Ordinal);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using MareSynchronos.PlayerData.Pairs;
|
using MareSynchronos.MareConfiguration;
|
||||||
|
using MareSynchronos.PlayerData.Pairs;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
using MareSynchronos.Services.ServerConfiguration;
|
using MareSynchronos.Services.ServerConfiguration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@@ -10,19 +11,21 @@ public class PairFactory
|
|||||||
private readonly PairHandlerFactory _cachedPlayerFactory;
|
private readonly PairHandlerFactory _cachedPlayerFactory;
|
||||||
private readonly ILoggerFactory _loggerFactory;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private readonly MareMediator _mareMediator;
|
private readonly MareMediator _mareMediator;
|
||||||
|
private readonly MareConfigService _mareConfig;
|
||||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||||
|
|
||||||
public PairFactory(ILoggerFactory loggerFactory, PairHandlerFactory cachedPlayerFactory,
|
public PairFactory(ILoggerFactory loggerFactory, PairHandlerFactory cachedPlayerFactory,
|
||||||
MareMediator mareMediator, ServerConfigurationManager serverConfigurationManager)
|
MareMediator mareMediator, MareConfigService mareConfig, ServerConfigurationManager serverConfigurationManager)
|
||||||
{
|
{
|
||||||
_loggerFactory = loggerFactory;
|
_loggerFactory = loggerFactory;
|
||||||
_cachedPlayerFactory = cachedPlayerFactory;
|
_cachedPlayerFactory = cachedPlayerFactory;
|
||||||
_mareMediator = mareMediator;
|
_mareMediator = mareMediator;
|
||||||
|
_mareConfig = mareConfig;
|
||||||
_serverConfigurationManager = serverConfigurationManager;
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair Create()
|
public Pair Create()
|
||||||
{
|
{
|
||||||
return new Pair(_loggerFactory.CreateLogger<Pair>(), _cachedPlayerFactory, _mareMediator, _serverConfigurationManager);
|
return new Pair(_loggerFactory.CreateLogger<Pair>(), _cachedPlayerFactory, _mareMediator, _mareConfig, _serverConfigurationManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ using MareSynchronos.PlayerData.Handlers;
|
|||||||
using MareSynchronos.PlayerData.Pairs;
|
using MareSynchronos.PlayerData.Pairs;
|
||||||
using MareSynchronos.Services;
|
using MareSynchronos.Services;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
|
using MareSynchronos.Services.ServerConfiguration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MareSynchronos.PlayerData.Factories;
|
namespace MareSynchronos.PlayerData.Factories;
|
||||||
@@ -20,11 +21,12 @@ public class PairHandlerFactory
|
|||||||
private readonly ILoggerFactory _loggerFactory;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private readonly MareMediator _mareMediator;
|
private readonly MareMediator _mareMediator;
|
||||||
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
||||||
|
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||||
|
|
||||||
public PairHandlerFactory(ILoggerFactory loggerFactory, GameObjectHandlerFactory gameObjectHandlerFactory, IpcManager ipcManager,
|
public PairHandlerFactory(ILoggerFactory loggerFactory, GameObjectHandlerFactory gameObjectHandlerFactory, IpcManager ipcManager,
|
||||||
FileDownloadManagerFactory fileDownloadManagerFactory, DalamudUtilService dalamudUtilService,
|
FileDownloadManagerFactory fileDownloadManagerFactory, DalamudUtilService dalamudUtilService,
|
||||||
PluginWarningNotificationService pluginWarningNotificationManager, CancellationToken dalamudLifetime,
|
PluginWarningNotificationService pluginWarningNotificationManager, ServerConfigurationManager serverConfigurationManager,
|
||||||
FileCacheManager fileCacheManager, MareMediator mareMediator)
|
CancellationToken dalamudLifetime, FileCacheManager fileCacheManager, MareMediator mareMediator)
|
||||||
{
|
{
|
||||||
_loggerFactory = loggerFactory;
|
_loggerFactory = loggerFactory;
|
||||||
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
||||||
@@ -32,6 +34,7 @@ public class PairHandlerFactory
|
|||||||
_fileDownloadManagerFactory = fileDownloadManagerFactory;
|
_fileDownloadManagerFactory = fileDownloadManagerFactory;
|
||||||
_dalamudUtilService = dalamudUtilService;
|
_dalamudUtilService = dalamudUtilService;
|
||||||
_pluginWarningNotificationManager = pluginWarningNotificationManager;
|
_pluginWarningNotificationManager = pluginWarningNotificationManager;
|
||||||
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
_dalamudLifetimeToken = dalamudLifetime;
|
_dalamudLifetimeToken = dalamudLifetime;
|
||||||
_fileCacheManager = fileCacheManager;
|
_fileCacheManager = fileCacheManager;
|
||||||
_mareMediator = mareMediator;
|
_mareMediator = mareMediator;
|
||||||
@@ -40,7 +43,7 @@ public class PairHandlerFactory
|
|||||||
public PairHandler Create(OnlineUserIdentDto onlineUserIdentDto)
|
public PairHandler Create(OnlineUserIdentDto onlineUserIdentDto)
|
||||||
{
|
{
|
||||||
return new PairHandler(_loggerFactory.CreateLogger<PairHandler>(), onlineUserIdentDto, _gameObjectHandlerFactory,
|
return new PairHandler(_loggerFactory.CreateLogger<PairHandler>(), onlineUserIdentDto, _gameObjectHandlerFactory,
|
||||||
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _dalamudUtilService, _dalamudLifetimeToken,
|
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _serverConfigurationManager, _dalamudUtilService,
|
||||||
_fileCacheManager, _mareMediator);
|
_dalamudLifetimeToken, _fileCacheManager, _mareMediator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ using MareSynchronos.PlayerData.Factories;
|
|||||||
using MareSynchronos.PlayerData.Pairs;
|
using MareSynchronos.PlayerData.Pairs;
|
||||||
using MareSynchronos.Services;
|
using MareSynchronos.Services;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
|
using MareSynchronos.Services.ServerConfiguration;
|
||||||
using MareSynchronos.Utils;
|
using MareSynchronos.Utils;
|
||||||
using MareSynchronos.WebAPI.Files;
|
using MareSynchronos.WebAPI.Files;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@@ -26,6 +27,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
private readonly IpcManager _ipcManager;
|
private readonly IpcManager _ipcManager;
|
||||||
private readonly CancellationToken _lifetime;
|
private readonly CancellationToken _lifetime;
|
||||||
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
||||||
|
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||||
private CancellationTokenSource? _applicationCancellationTokenSource = new();
|
private CancellationTokenSource? _applicationCancellationTokenSource = new();
|
||||||
private Guid _applicationId;
|
private Guid _applicationId;
|
||||||
private Task? _applicationTask;
|
private Task? _applicationTask;
|
||||||
@@ -42,7 +44,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
public PairHandler(ILogger<PairHandler> logger, OnlineUserIdentDto onlineUser,
|
public PairHandler(ILogger<PairHandler> logger, OnlineUserIdentDto onlineUser,
|
||||||
GameObjectHandlerFactory gameObjectHandlerFactory,
|
GameObjectHandlerFactory gameObjectHandlerFactory,
|
||||||
IpcManager ipcManager, FileDownloadManager transferManager,
|
IpcManager ipcManager, FileDownloadManager transferManager,
|
||||||
PluginWarningNotificationService pluginWarningNotificationManager,
|
PluginWarningNotificationService pluginWarningNotificationManager, ServerConfigurationManager serverConfigurationManager,
|
||||||
DalamudUtilService dalamudUtil, CancellationToken lifetime,
|
DalamudUtilService dalamudUtil, CancellationToken lifetime,
|
||||||
FileCacheManager fileDbManager, MareMediator mediator) : base(logger, mediator)
|
FileCacheManager fileDbManager, MareMediator mediator) : base(logger, mediator)
|
||||||
{
|
{
|
||||||
@@ -51,6 +53,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
_ipcManager = ipcManager;
|
_ipcManager = ipcManager;
|
||||||
_downloadManager = transferManager;
|
_downloadManager = transferManager;
|
||||||
_pluginWarningNotificationManager = pluginWarningNotificationManager;
|
_pluginWarningNotificationManager = pluginWarningNotificationManager;
|
||||||
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
_dalamudUtil = dalamudUtil;
|
_dalamudUtil = dalamudUtil;
|
||||||
_lifetime = lifetime;
|
_lifetime = lifetime;
|
||||||
_fileDbManager = fileDbManager;
|
_fileDbManager = fileDbManager;
|
||||||
@@ -507,6 +510,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
});
|
});
|
||||||
|
|
||||||
_ipcManager.PenumbraAssignTemporaryCollectionAsync(Logger, _penumbraCollection, _charaHandler.GetGameObject()!.ObjectIndex).GetAwaiter().GetResult();
|
_ipcManager.PenumbraAssignTemporaryCollectionAsync(Logger, _penumbraCollection, _charaHandler.GetGameObject()!.ObjectIndex).GetAwaiter().GetResult();
|
||||||
|
_serverConfigurationManager.SetNameForUid(OnlineUser.User.UID, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RevertCustomizationDataAsync(ObjectKind objectKind, string name, Guid applicationId, CancellationToken cancelToken)
|
private async Task RevertCustomizationDataAsync(ObjectKind objectKind, string name, Guid applicationId, CancellationToken cancelToken)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
using Dalamud.ContextMenu;
|
using Dalamud.ContextMenu;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using MareSynchronos.API.Data;
|
using MareSynchronos.API.Data;
|
||||||
using MareSynchronos.API.Data.Comparer;
|
using MareSynchronos.API.Data.Comparer;
|
||||||
using MareSynchronos.API.Data.Enum;
|
using MareSynchronos.API.Data.Enum;
|
||||||
using MareSynchronos.API.Data.Extensions;
|
using MareSynchronos.API.Data.Extensions;
|
||||||
using MareSynchronos.API.Dto.Group;
|
using MareSynchronos.API.Dto.Group;
|
||||||
using MareSynchronos.API.Dto.User;
|
using MareSynchronos.API.Dto.User;
|
||||||
|
using MareSynchronos.MareConfiguration;
|
||||||
using MareSynchronos.PlayerData.Factories;
|
using MareSynchronos.PlayerData.Factories;
|
||||||
using MareSynchronos.PlayerData.Handlers;
|
using MareSynchronos.PlayerData.Handlers;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
@@ -21,16 +23,19 @@ public class Pair
|
|||||||
private readonly SemaphoreSlim _creationSemaphore = new(1);
|
private readonly SemaphoreSlim _creationSemaphore = new(1);
|
||||||
private readonly ILogger<Pair> _logger;
|
private readonly ILogger<Pair> _logger;
|
||||||
private readonly MareMediator _mediator;
|
private readonly MareMediator _mediator;
|
||||||
|
private readonly MareConfigService _mareConfig;
|
||||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||||
private CancellationTokenSource _applicationCts = new CancellationTokenSource();
|
private CancellationTokenSource _applicationCts = new CancellationTokenSource();
|
||||||
private OnlineUserIdentDto? _onlineUserIdentDto = null;
|
private OnlineUserIdentDto? _onlineUserIdentDto = null;
|
||||||
|
private string? _playerName = null;
|
||||||
|
|
||||||
public Pair(ILogger<Pair> logger, PairHandlerFactory cachedPlayerFactory,
|
public Pair(ILogger<Pair> logger, PairHandlerFactory cachedPlayerFactory,
|
||||||
MareMediator mediator, ServerConfigurationManager serverConfigurationManager)
|
MareMediator mediator, MareConfigService mareConfig, ServerConfigurationManager serverConfigurationManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_cachedPlayerFactory = cachedPlayerFactory;
|
_cachedPlayerFactory = cachedPlayerFactory;
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
|
_mareConfig = mareConfig;
|
||||||
_serverConfigurationManager = serverConfigurationManager;
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +48,7 @@ public class Pair
|
|||||||
|
|
||||||
public bool IsVisible => CachedPlayer?.IsVisible ?? false;
|
public bool IsVisible => CachedPlayer?.IsVisible ?? false;
|
||||||
public CharacterData? LastReceivedCharacterData { get; set; }
|
public CharacterData? LastReceivedCharacterData { get; set; }
|
||||||
public string? PlayerName => CachedPlayer?.PlayerName ?? string.Empty;
|
public string? PlayerName => GetPlayerName();
|
||||||
public long LastAppliedDataSize => CachedPlayer?.LastAppliedDataSize ?? -1;
|
public long LastAppliedDataSize => CachedPlayer?.LastAppliedDataSize ?? -1;
|
||||||
|
|
||||||
public UserData UserData => UserPair?.User ?? GroupPair.First().Value.User;
|
public UserData UserData => UserPair?.User ?? GroupPair.First().Value.User;
|
||||||
@@ -154,6 +159,23 @@ public class Pair
|
|||||||
return _serverConfigurationManager.GetNoteForUid(UserData.UID);
|
return _serverConfigurationManager.GetNoteForUid(UserData.UID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string? GetPlayerName()
|
||||||
|
{
|
||||||
|
if (CachedPlayer != null && CachedPlayer.PlayerName != null)
|
||||||
|
return CachedPlayer.PlayerName;
|
||||||
|
else
|
||||||
|
return _serverConfigurationManager.GetNameForUid(UserData.UID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? GetNoteOrName()
|
||||||
|
{
|
||||||
|
string? note = GetNote();
|
||||||
|
if (_mareConfig.Current.ShowCharacterNames || IsVisible)
|
||||||
|
return note ?? GetPlayerName();
|
||||||
|
else
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetPlayerNameHash()
|
public string GetPlayerNameHash()
|
||||||
{
|
{
|
||||||
return CachedPlayer?.PlayerNameHash ?? string.Empty;
|
return CachedPlayer?.PlayerNameHash ?? string.Empty;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
|
|||||||
&& (_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs && !string.IsNullOrEmpty(pair.GetNote())
|
&& (_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs && !string.IsNullOrEmpty(pair.GetNote())
|
||||||
|| !_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs))
|
|| !_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs))
|
||||||
{
|
{
|
||||||
string? note = pair.GetNote();
|
string? note = pair.GetNoteOrName();
|
||||||
var msg = !string.IsNullOrEmpty(note)
|
var msg = !string.IsNullOrEmpty(note)
|
||||||
? $"{note} ({pair.UserData.AliasOrUID}) is now online"
|
? $"{note} ({pair.UserData.AliasOrUID}) is now online"
|
||||||
: $"{pair.UserData.AliasOrUID} is now online";
|
: $"{pair.UserData.AliasOrUID} is now online";
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton<FileDownloadManagerFactory>();
|
collection.AddSingleton<FileDownloadManagerFactory>();
|
||||||
collection.AddSingleton((s) => new PairHandlerFactory(s.GetRequiredService<ILoggerFactory>(), s.GetRequiredService<GameObjectHandlerFactory>(),
|
collection.AddSingleton((s) => new PairHandlerFactory(s.GetRequiredService<ILoggerFactory>(), s.GetRequiredService<GameObjectHandlerFactory>(),
|
||||||
s.GetRequiredService<IpcManager>(), s.GetRequiredService<FileDownloadManagerFactory>(), s.GetRequiredService<DalamudUtilService>(),
|
s.GetRequiredService<IpcManager>(), s.GetRequiredService<FileDownloadManagerFactory>(), s.GetRequiredService<DalamudUtilService>(),
|
||||||
s.GetRequiredService<PluginWarningNotificationService>(),
|
s.GetRequiredService<PluginWarningNotificationService>(), s.GetRequiredService<ServerConfigurationManager>(),
|
||||||
CancellationTokenSource.CreateLinkedTokenSource(addonLifecycle.GameShuttingDownToken, addonLifecycle.DalamudUnloadingToken).Token,
|
CancellationTokenSource.CreateLinkedTokenSource(addonLifecycle.GameShuttingDownToken, addonLifecycle.DalamudUnloadingToken).Token,
|
||||||
s.GetRequiredService<FileCacheManager>(), s.GetRequiredService<MareMediator>()));
|
s.GetRequiredService<FileCacheManager>(), s.GetRequiredService<MareMediator>()));
|
||||||
collection.AddSingleton<PairFactory>();
|
collection.AddSingleton<PairFactory>();
|
||||||
@@ -104,7 +104,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ServerTagConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new ServerTagConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new TransientConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new TransientConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ConfigurationMigrator(s.GetRequiredService<ILogger<ConfigurationMigrator>>(), pluginInterface));
|
collection.AddSingleton((s) => new ConfigurationMigrator(s.GetRequiredService<ILogger<ConfigurationMigrator>>(), pluginInterface, s.GetRequiredService<NotesConfigService>()));
|
||||||
collection.AddSingleton<HubFactory>();
|
collection.AddSingleton<HubFactory>();
|
||||||
|
|
||||||
// add scoped services
|
// add scoped services
|
||||||
|
|||||||
@@ -229,6 +229,16 @@ public class ServerConfigurationManager
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal string? GetNameForUid(string uid)
|
||||||
|
{
|
||||||
|
if (CurrentNotesStorage().UidLastSeenNames.TryGetValue(uid, out var name))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name)) return null;
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
internal HashSet<string> GetServerAvailablePairTags()
|
internal HashSet<string> GetServerAvailablePairTags()
|
||||||
{
|
{
|
||||||
return CurrentServerTagStorage().ServerAvailablePairTags;
|
return CurrentServerTagStorage().ServerAvailablePairTags;
|
||||||
@@ -324,6 +334,17 @@ public class ServerConfigurationManager
|
|||||||
_notesConfig.Save();
|
_notesConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void SetNameForUid(string uid, string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(uid)) return;
|
||||||
|
|
||||||
|
if (CurrentNotesStorage().UidLastSeenNames.TryGetValue(uid, out var currentName) && currentName == name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CurrentNotesStorage().UidLastSeenNames[uid] = name;
|
||||||
|
_notesConfig.Save();
|
||||||
|
}
|
||||||
|
|
||||||
private ServerNotesStorage CurrentNotesStorage()
|
private ServerNotesStorage CurrentNotesStorage()
|
||||||
{
|
{
|
||||||
TryCreateCurrentNotesStorage();
|
TryCreateCurrentNotesStorage();
|
||||||
|
|||||||
@@ -368,11 +368,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
|||||||
var ySize = TransferPartHeight == 0
|
var ySize = TransferPartHeight == 0
|
||||||
? 1
|
? 1
|
||||||
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
|
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
|
||||||
var users = GetFilteredUsers()
|
var users = GetFilteredUsers().OrderBy(u => u.GetNoteOrName());
|
||||||
.OrderBy(
|
|
||||||
u => _configService.Current.ShowCharacterNameInsteadOfNotesForVisible && !string.IsNullOrEmpty(u.PlayerName)
|
|
||||||
? (_configService.Current.PreferNotesOverNamesForVisible ? u.GetNote() : u.PlayerName)
|
|
||||||
: (u.GetNote() ?? u.UserData.AliasOrUID), StringComparer.OrdinalIgnoreCase).ToList();
|
|
||||||
|
|
||||||
var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
||||||
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi)).ToList();
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ internal sealed class GroupPanel
|
|||||||
.OrderByDescending(u => string.Equals(u.UserData.UID, groupDto.OwnerUID, StringComparison.Ordinal))
|
.OrderByDescending(u => string.Equals(u.UserData.UID, groupDto.OwnerUID, StringComparison.Ordinal))
|
||||||
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsModerator())
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsModerator())
|
||||||
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsPinned())
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsPinned())
|
||||||
.ThenBy(u => u.GetNote() ?? u.UserData.AliasOrUID, StringComparer.OrdinalIgnoreCase);
|
.ThenBy(u => u.GetNoteOrName() ?? u.UserData.AliasOrUID, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var visibleUsers = new List<DrawGroupPair>();
|
var visibleUsers = new List<DrawGroupPair>();
|
||||||
var onlineUsers = new List<DrawGroupPair>();
|
var onlineUsers = new List<DrawGroupPair>();
|
||||||
|
|||||||
@@ -144,13 +144,13 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
{
|
{
|
||||||
visiblePairs = _pairManager.GetOnlineUserPairs()
|
visiblePairs = _pairManager.GetOnlineUserPairs()
|
||||||
.Where(x => x.IsVisible)
|
.Where(x => x.IsVisible)
|
||||||
.Select(x => string.Format("{0} ({1})", _configService.Current.PreferNoteInDtrTooltip ? x.GetNote() ?? x.PlayerName : x.PlayerName, x.UserData.AliasOrUID ));
|
.Select(x => string.Format("{0} ({1})", _configService.Current.PreferNoteInDtrTooltip ? x.GetNoteOrName() : x.PlayerName, x.UserData.AliasOrUID ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
visiblePairs = _pairManager.GetOnlineUserPairs()
|
visiblePairs = _pairManager.GetOnlineUserPairs()
|
||||||
.Where(x => x.IsVisible)
|
.Where(x => x.IsVisible)
|
||||||
.Select(x => string.Format("{0}", _configService.Current.PreferNoteInDtrTooltip ? x.GetNote() ?? x.PlayerName : x.PlayerName));
|
.Select(x => string.Format("{0}", _configService.Current.PreferNoteInDtrTooltip ? x.GetNoteOrName() : x.PlayerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip = $"Loporrit: Connected{Environment.NewLine}----------{Environment.NewLine}{string.Join(Environment.NewLine, visiblePairs)}";
|
tooltip = $"Loporrit: Connected{Environment.NewLine}----------{Environment.NewLine}{string.Join(Environment.NewLine, visiblePairs)}";
|
||||||
|
|||||||
@@ -165,12 +165,13 @@ public class UidDisplayHandler
|
|||||||
playerText = pair.UserData.AliasOrUID;
|
playerText = pair.UserData.AliasOrUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mareConfigService.Current.ShowCharacterNameInsteadOfNotesForVisible && pair.IsVisible && !showUidInsteadOfName)
|
if (_mareConfigService.Current.ShowCharacterNames && textIsUid && !showUidInsteadOfName)
|
||||||
{
|
{
|
||||||
playerText = pair.PlayerName;
|
var name = pair.PlayerName;
|
||||||
textIsUid = false;
|
if (name != null)
|
||||||
if (_mareConfigService.Current.PreferNotesOverNamesForVisible)
|
|
||||||
{
|
{
|
||||||
|
playerText = name;
|
||||||
|
textIsUid = false;
|
||||||
var note = pair.GetNote();
|
var note = pair.GetNote();
|
||||||
if (note != null)
|
if (note != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
UiSharedService.FontText("UI", _uiShared.UidFont);
|
UiSharedService.FontText("UI", _uiShared.UidFont);
|
||||||
var showNameInsteadOfNotes = _configService.Current.ShowCharacterNameInsteadOfNotesForVisible;
|
var showCharacterNames = _configService.Current.ShowCharacterNames;
|
||||||
var showVisibleSeparate = _configService.Current.ShowVisibleUsersSeparately;
|
var showVisibleSeparate = _configService.Current.ShowVisibleUsersSeparately;
|
||||||
var showOfflineSeparate = _configService.Current.ShowOfflineUsersSeparately;
|
var showOfflineSeparate = _configService.Current.ShowOfflineUsersSeparately;
|
||||||
var showProfiles = _configService.Current.ProfilesShow;
|
var showProfiles = _configService.Current.ProfilesShow;
|
||||||
@@ -718,23 +718,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
UiSharedService.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
|
UiSharedService.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
|
||||||
|
|
||||||
if (ImGui.Checkbox("Show player name for visible players", ref showNameInsteadOfNotes))
|
if (ImGui.Checkbox("Show player names", ref showCharacterNames))
|
||||||
{
|
{
|
||||||
_configService.Current.ShowCharacterNameInsteadOfNotesForVisible = showNameInsteadOfNotes;
|
_configService.Current.ShowCharacterNames = showCharacterNames;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
UiSharedService.DrawHelpText("This will show the character name instead of custom set note when a character is visible");
|
UiSharedService.DrawHelpText("This will show character names instead of UIDs when possible");
|
||||||
|
|
||||||
ImGui.Indent();
|
|
||||||
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.BeginDisabled();
|
|
||||||
if (ImGui.Checkbox("Prefer notes over player names for visible players", ref preferNotesInsteadOfName))
|
|
||||||
{
|
|
||||||
_configService.Current.PreferNotesOverNamesForVisible = preferNotesInsteadOfName;
|
|
||||||
_configService.Save();
|
|
||||||
}
|
|
||||||
UiSharedService.DrawHelpText("If you set a note for a player it will be shown instead of the player name");
|
|
||||||
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled();
|
|
||||||
ImGui.Unindent();
|
|
||||||
|
|
||||||
if (ImGui.Checkbox("Show Profiles on Hover", ref showProfiles))
|
if (ImGui.Checkbox("Show Profiles on Hover", ref showProfiles))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,9 +155,10 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
ImGui.TableNextColumn(); // online/name
|
ImGui.TableNextColumn(); // online/name
|
||||||
string onlineText = pair.Key.IsOnline ? "Online" : "Offline";
|
string onlineText = pair.Key.IsOnline ? "Online" : "Offline";
|
||||||
if (!string.IsNullOrEmpty(pair.Key.PlayerName))
|
string? name = pair.Key.GetNoteOrName();
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
onlineText += " (" + pair.Key.PlayerName + ")";
|
onlineText += " (" + name + ")";
|
||||||
}
|
}
|
||||||
var boolcolor = UiSharedService.GetBoolColor(pair.Key.IsOnline);
|
var boolcolor = UiSharedService.GetBoolColor(pair.Key.IsOnline);
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
|
|||||||
Reference in New Issue
Block a user