Merge tag '0.9.17' into mare-classic

* tag '0.9.17':
  add census popup on connection
  api update
  census update
  heave fewer redraws as main method for data application, minor fixes
  remove unnecessary exists check
  add visibility for loaded mods size for pair, use menu bar for settings, remove settings button
  fix staging issues
  add download throttling, change header of mare, fix reverting players when going offline/paused when not visible
  use name for glamourer revert
  fix startup breaking
  add inner exception stacktraces
  calc correct button size
  wording
  add permission popup ui
  fix getting identifier during zoning
  indent nonscaled
  remove unnecessary usings
  ui icon boogaloo
  fix cache dict wtf
  add normalized icons
  add owner/moderator/pinned user icons
  check tokentime more precisely in both directions
  more cleanup
  fix sorting and cleanup
  make local groups more usable for pause/resume
  fix outlined font
  rework creation of popout windows into factory and some refactoring in general
  make syncshell admin ui to standalone window
  remove close button on intro ui
  do not allow to open main ui without finishing setup
  readonly bla
  wait for plugin disposal
  fix palette
  wording
  fix palette application and add experimental less redraws option
  some minor fixes
  check for timezone
  idk
  adjust token handling
  fix total user count in syncshell (distinct by UIDs)
  fix text alignment
  fix some shit maybe
  idk some fixes I guess
  fix offset for transfer bar at the bottom, use async collections, clear filter on tab change + add button to clear, require ctrl for align syncshells
  blah
  Some display options for DTR tooltip (#66)
  add ordering
  adjust api to latest
  rework main ui
  add total count on mouseover, make syncshell windows non-blocking
  fix token for character change, add online count to syncshells and groups
  argh
  fix broken font in header
  add more options for the compactui
  fix icons and text of buttons being static in place
  remove logspam
This commit is contained in:
Loporrit
2023-12-08 13:44:18 +00:00
54 changed files with 1646 additions and 743 deletions

View File

@@ -1,6 +1,7 @@
using Dalamud.Game.Command;
using Dalamud.Plugin.Services;
using MareSynchronos.FileCache;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Services.ServerConfiguration;
using MareSynchronos.UI;
@@ -16,13 +17,14 @@ public sealed class CommandManagerService : IDisposable
private readonly ApiController _apiController;
private readonly ICommandManager _commandManager;
private readonly MareMediator _mediator;
private readonly MareConfigService _mareConfigService;
private readonly PerformanceCollectorService _performanceCollectorService;
private readonly PeriodicFileScanner _periodicFileScanner;
private readonly ServerConfigurationManager _serverConfigurationManager;
public CommandManagerService(ICommandManager commandManager, PerformanceCollectorService performanceCollectorService,
ServerConfigurationManager serverConfigurationManager, PeriodicFileScanner periodicFileScanner,
ApiController apiController, MareMediator mediator)
ApiController apiController, MareMediator mediator, MareConfigService mareConfigService)
{
_commandManager = commandManager;
_performanceCollectorService = performanceCollectorService;
@@ -30,6 +32,7 @@ public sealed class CommandManagerService : IDisposable
_periodicFileScanner = periodicFileScanner;
_apiController = apiController;
_mediator = mediator;
_mareConfigService = mareConfigService;
_commandManager.AddHandler(_commandName, new CommandInfo(OnCommand)
{
HelpMessage = "Opens the Mare Synchronos UI"
@@ -48,7 +51,10 @@ public sealed class CommandManagerService : IDisposable
if (splitArgs == null || splitArgs.Length == 0)
{
// Interpret this as toggling the UI
_mediator.Publish(new UiToggleMessage(typeof(CompactUi)));
if (_mareConfigService.Current.HasValidSetup())
_mediator.Publish(new UiToggleMessage(typeof(CompactUi)));
else
_mediator.Publish(new UiToggleMessage(typeof(IntroUi)));
return;
}
@@ -100,7 +106,7 @@ public sealed class CommandManagerService : IDisposable
}
else if (string.Equals(splitArgs[0], "analyze", StringComparison.OrdinalIgnoreCase))
{
_mediator.Publish(new OpenDataAnalysisUiMessage());
_mediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi)));
}
}
}

View File

@@ -173,7 +173,7 @@ public class DalamudUtilService : IHostedService
public async Task<string> GetPlayerNameHashedAsync()
{
return await RunOnFrameworkThread(() => (GetPlayerName() + GetWorldId()).GetHash256()).ConfigureAwait(false);
return await RunOnFrameworkThread(() => (GetPlayerName() + GetHomeWorldId()).GetHash256()).ConfigureAwait(false);
}
public IntPtr GetPlayerPointer()
@@ -187,17 +187,28 @@ public class DalamudUtilService : IHostedService
return await RunOnFrameworkThread(GetPlayerPointer).ConfigureAwait(false);
}
public uint GetWorldId()
public uint GetHomeWorldId()
{
EnsureIsOnFramework();
return _clientState.LocalPlayer!.HomeWorld.Id;
}
public uint GetWorldId()
{
EnsureIsOnFramework();
return _clientState.LocalPlayer!.CurrentWorld.Id;
}
public async Task<uint> GetWorldIdAsync()
{
return await RunOnFrameworkThread(GetWorldId).ConfigureAwait(false);
}
public async Task<uint> GetHomeWorldIdAsync()
{
return await RunOnFrameworkThread(GetHomeWorldId).ConfigureAwait(false);
}
public unsafe bool IsGameObjectPresent(IntPtr key)
{
return _objectTable.Any(f => f.Address == key);
@@ -494,17 +505,6 @@ public class DalamudUtilService : IHostedService
_mediator.Publish(new DalamudLogoutMessage());
}
if (_clientState.LocalPlayer != null && _clientState.LocalPlayer.IsValid())
{
var newclassJobId = _clientState.LocalPlayer.ClassJob.Id;
if (_classJobId != newclassJobId)
{
_classJobId = newclassJobId;
_mediator.Publish(new ClassJobChangedMessage(_classJobId));
}
}
_mediator.Publish(new DelayedFrameworkUpdateMessage());
_delayedFrameworkUpdateCheck = DateTime.Now;

View File

@@ -15,11 +15,10 @@ namespace MareSynchronos.Services.Mediator;
public record SwitchToIntroUiMessage : MessageBase;
public record SwitchToMainUiMessage : MessageBase;
public record OpenSettingsUiMessage : MessageBase;
public record OpenDataAnalysisUiMessage : MessageBase;
public record DalamudLoginMessage : MessageBase;
public record DalamudLogoutMessage : MessageBase;
public record FrameworkUpdateMessage : SameThreadMessage;
public record ClassJobChangedMessage(uint? ClassJob) : MessageBase;
public record ClassJobChangedMessage(GameObjectHandler gameObjectHandler) : MessageBase;
public record DelayedFrameworkUpdateMessage : SameThreadMessage;
public record ZoneSwitchStartMessage : MessageBase;
public record ZoneSwitchEndMessage : MessageBase;
@@ -55,9 +54,9 @@ public record CharacterDataCreatedMessage(CharacterData CharacterData) : SameThr
public record CharacterDataAnalyzedMessage : MessageBase;
public record PenumbraStartRedrawMessage(IntPtr Address) : MessageBase;
public record PenumbraEndRedrawMessage(IntPtr Address) : MessageBase;
public record HubReconnectingMessage(Exception? Exception) : MessageBase;
public record HubReconnectedMessage(string? Arg) : MessageBase;
public record HubClosedMessage(Exception? Exception) : MessageBase;
public record HubReconnectingMessage(Exception? Exception) : SameThreadMessage;
public record HubReconnectedMessage(string? Arg) : SameThreadMessage;
public record HubClosedMessage(Exception? Exception) : SameThreadMessage;
public record DownloadReadyMessage(Guid RequestId) : MessageBase;
public record DownloadStartedMessage(GameObjectHandler DownloadId, Dictionary<string, FileDownloadStatus> DownloadStatus) : MessageBase;
public record DownloadFinishedMessage(GameObjectHandler DownloadId) : MessageBase;
@@ -72,9 +71,10 @@ public record RemoveWindowMessage(WindowMediatorSubscriberBase Window) : Message
public record PairHandlerVisibleMessage(PairHandler Player) : MessageBase;
public record OpenReportPopupMessage(Pair PairToReport) : MessageBase;
public record OpenBanUserPopupMessage(Pair PairToBan, GroupFullInfoDto GroupFullInfoDto) : MessageBase;
public record JoinSyncshellPopupMessage() : MessageBase;
public record OpenCreateSyncshellPopupMessage() : MessageBase;
public record OpenSyncshellAdminPanelPopupMessage(GroupFullInfoDto GroupInfo) : MessageBase;
public record OpenSyncshellAdminPanel(GroupFullInfoDto GroupInfo) : MessageBase;
public record OpenPermissionWindow(Pair Pair) : MessageBase;
public record DownloadLimitChangedMessage() : SameThreadMessage;
public record CensusUpdateMessage(byte Gender, byte RaceId, byte TribeId) : MessageBase;
#pragma warning restore S2094
#pragma warning restore MA0048 // File name must match type name

View File

@@ -62,7 +62,7 @@ public class ServerConfigurationManager
}
var charaName = _dalamudUtil.GetPlayerNameAsync().GetAwaiter().GetResult();
var worldId = _dalamudUtil.GetWorldIdAsync().GetAwaiter().GetResult();
var worldId = _dalamudUtil.GetHomeWorldIdAsync().GetAwaiter().GetResult();
if (!currentServer.Authentications.Any() && currentServer.SecretKeys.Any())
{
currentServer.Authentications.Add(new Authentication()
@@ -136,7 +136,7 @@ public class ServerConfigurationManager
server.Authentications.Add(new Authentication()
{
CharacterName = _dalamudUtil.GetPlayerNameAsync().GetAwaiter().GetResult(),
WorldId = _dalamudUtil.GetWorldIdAsync().GetAwaiter().GetResult(),
WorldId = _dalamudUtil.GetHomeWorldIdAsync().GetAwaiter().GetResult(),
SecretKeyIdx = addLastSecretKey ? server.SecretKeys.Last().Key : -1,
});
Save();

View File

@@ -0,0 +1,52 @@
using MareSynchronos.API.Dto.Group;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Services.ServerConfiguration;
using MareSynchronos.UI;
using MareSynchronos.UI.Components.Popup;
using MareSynchronos.WebAPI;
using Microsoft.Extensions.Logging;
namespace MareSynchronos.Services;
public class UiFactory
{
private readonly ILoggerFactory _loggerFactory;
private readonly MareMediator _mareMediator;
private readonly ApiController _apiController;
private readonly UiSharedService _uiSharedService;
private readonly PairManager _pairManager;
private readonly ServerConfigurationManager _serverConfigManager;
private readonly MareProfileManager _mareProfileManager;
public UiFactory(ILoggerFactory loggerFactory, MareMediator mareMediator, ApiController apiController,
UiSharedService uiSharedService, PairManager pairManager, ServerConfigurationManager serverConfigManager,
MareProfileManager mareProfileManager)
{
_loggerFactory = loggerFactory;
_mareMediator = mareMediator;
_apiController = apiController;
_uiSharedService = uiSharedService;
_pairManager = pairManager;
_serverConfigManager = serverConfigManager;
_mareProfileManager = mareProfileManager;
}
public SyncshellAdminUI CreateSyncshellAdminUi(GroupFullInfoDto dto)
{
return new SyncshellAdminUI(_loggerFactory.CreateLogger<SyncshellAdminUI>(), _mareMediator,
_apiController, _uiSharedService, _pairManager, dto);
}
public StandaloneProfileUi CreateStandaloneProfileUi(Pair pair)
{
return new StandaloneProfileUi(_loggerFactory.CreateLogger<StandaloneProfileUi>(), _mareMediator,
_uiSharedService, _serverConfigManager, _mareProfileManager, _pairManager, pair);
}
public PermissionWindowUI CreatePermissionPopupUi(Pair pair)
{
return new PermissionWindowUI(_loggerFactory.CreateLogger<PermissionWindowUI>(), pair,
_mareMediator, _uiSharedService, _apiController);
}
}

View File

@@ -1,10 +1,10 @@
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services.Mediator;
using MareSynchronos.UI;
using MareSynchronos.UI.Components.Popup;
using Microsoft.Extensions.Logging;
namespace MareSynchronos.Services;
@@ -12,28 +12,31 @@ namespace MareSynchronos.Services;
public sealed class UiService : DisposableMediatorSubscriberBase
{
private readonly List<WindowMediatorSubscriberBase> _createdWindows = [];
private readonly DalamudPluginInterface _dalamudPluginInterface;
private readonly UiBuilder _uiBuilder;
private readonly FileDialogManager _fileDialogManager;
private readonly ILogger<UiService> _logger;
private readonly MareConfigService _mareConfigService;
private readonly WindowSystem _windowSystem;
private readonly UiFactory _uiFactory;
public UiService(ILogger<UiService> logger, DalamudPluginInterface dalamudPluginInterface,
public UiService(ILogger<UiService> logger, UiBuilder uiBuilder,
MareConfigService mareConfigService, WindowSystem windowSystem,
IEnumerable<WindowMediatorSubscriberBase> windows, Func<Pair, StandaloneProfileUi> standaloneProfileUiFactory,
FileDialogManager fileDialogManager, MareMediator mareMediator) : base(logger, mareMediator)
IEnumerable<WindowMediatorSubscriberBase> windows,
UiFactory uiFactory, FileDialogManager fileDialogManager,
MareMediator mareMediator) : base(logger, mareMediator)
{
_logger = logger;
_logger.LogTrace("Creating {type}", GetType().Name);
_dalamudPluginInterface = dalamudPluginInterface;
_uiBuilder = uiBuilder;
_mareConfigService = mareConfigService;
_windowSystem = windowSystem;
_uiFactory = uiFactory;
_fileDialogManager = fileDialogManager;
_dalamudPluginInterface.UiBuilder.DisableGposeUiHide = true;
_dalamudPluginInterface.UiBuilder.Draw += Draw;
_dalamudPluginInterface.UiBuilder.OpenConfigUi += ToggleUi;
_dalamudPluginInterface.UiBuilder.OpenMainUi += ToggleMainUi;
_uiBuilder.DisableGposeUiHide = true;
_uiBuilder.Draw += Draw;
_uiBuilder.OpenConfigUi += ToggleUi;
_uiBuilder.OpenMainUi += ToggleMainUi;
foreach (var window in windows)
{
@@ -45,7 +48,29 @@ public sealed class UiService : DisposableMediatorSubscriberBase
if (!_createdWindows.Exists(p => p is StandaloneProfileUi ui
&& string.Equals(ui.Pair.UserData.AliasOrUID, msg.Pair.UserData.AliasOrUID, StringComparison.Ordinal)))
{
var window = standaloneProfileUiFactory(msg.Pair);
var window = _uiFactory.CreateStandaloneProfileUi(msg.Pair);
_createdWindows.Add(window);
_windowSystem.AddWindow(window);
}
});
Mediator.Subscribe<OpenSyncshellAdminPanel>(this, (msg) =>
{
if (!_createdWindows.Exists(p => p is SyncshellAdminUI ui
&& string.Equals(ui.GroupFullInfo.GID, msg.GroupInfo.GID, StringComparison.Ordinal)))
{
var window = _uiFactory.CreateSyncshellAdminUi(msg.GroupInfo);
_createdWindows.Add(window);
_windowSystem.AddWindow(window);
}
});
Mediator.Subscribe<OpenPermissionWindow>(this, (msg) =>
{
if (!_createdWindows.Exists(p => p is PermissionWindowUI ui
&& msg.Pair == ui.Pair))
{
var window = _uiFactory.CreatePermissionPopupUi(msg.Pair);
_createdWindows.Add(window);
_windowSystem.AddWindow(window);
}
@@ -88,8 +113,9 @@ public sealed class UiService : DisposableMediatorSubscriberBase
window.Dispose();
}
_dalamudPluginInterface.UiBuilder.Draw -= Draw;
_dalamudPluginInterface.UiBuilder.OpenConfigUi -= ToggleUi;
_uiBuilder.Draw -= Draw;
_uiBuilder.OpenConfigUi -= ToggleUi;
_uiBuilder.OpenMainUi -= ToggleMainUi;
}
private void Draw()