more api9 updates

This commit is contained in:
rootdarkarchon
2023-10-04 01:37:53 +02:00
parent f89f6c1216
commit f371df7aa1
5 changed files with 60 additions and 27 deletions

View File

@@ -26,17 +26,17 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dalamud.ContextMenu" Version="1.2.3" /> <PackageReference Include="Dalamud.ContextMenu" Version="1.3.1" />
<PackageReference Include="DalamudPackager" Version="2.1.11" /> <PackageReference Include="DalamudPackager" Version="2.1.12" />
<PackageReference Include="lz4net" Version="1.0.15.93" /> <PackageReference Include="lz4net" Version="1.0.15.93" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.87"> <PackageReference Include="Meziantou.Analyzer" Version="2.0.92">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.11" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.11" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Penumbra.Api" Version="1.0.10" /> <PackageReference Include="Penumbra.Api" Version="1.0.11" />
<PackageReference Include="Penumbra.String" Version="1.0.4" /> <PackageReference Include="Penumbra.String" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.11.0.78383"> <PackageReference Include="SonarAnalyzer.CSharp" Version="9.11.0.78383">
@@ -87,10 +87,6 @@
<HintPath>$(DalamudLibPath)CheapLoc.dll</HintPath> <HintPath>$(DalamudLibPath)CheapLoc.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
<Reference Include="Dalamud.Interface">
<HintPath>$(DalamudLibPath)Dalamud.Interface.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -13,6 +13,7 @@ using MareSynchronos.PlayerData.Data;
using MareSynchronos.PlayerData.Handlers; using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.Services; using MareSynchronos.Services;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
using CharacterData = MareSynchronos.PlayerData.Data.CharacterData;
namespace MareSynchronos.PlayerData.Factories; namespace MareSynchronos.PlayerData.Factories;

View File

@@ -68,6 +68,7 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<CharacterAnalyzer>(); collection.AddSingleton<CharacterAnalyzer>();
collection.AddSingleton<PluginWarningNotificationService>(); collection.AddSingleton<PluginWarningNotificationService>();
collection.AddSingleton<FileCompactor>(); collection.AddSingleton<FileCompactor>();
collection.AddSingleton((s) => new DalamudContextMenu(pluginInterface));
collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService<ILogger<DalamudUtilService>>(), collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService<ILogger<DalamudUtilService>>(),
clientState, objectTable, framework, gameGui, condition, gameData, clientState, objectTable, framework, gameGui, condition, gameData,
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>())); s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>()));
@@ -82,6 +83,8 @@ public sealed class Plugin : IDalamudPlugin
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));
collection.AddSingleton((s) => new HubFactory(s.GetRequiredService<ILogger<HubFactory>>(), s.GetRequiredService<MareMediator>(),
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<MareConfigService>(), pluginLog));
// func factory method singletons // func factory method singletons
collection.AddSingleton(s => collection.AddSingleton(s =>

View File

@@ -4,6 +4,7 @@ using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using ImGuiNET;
@@ -265,11 +266,11 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
ImGui.PopID(); ImGui.PopID();
} }
public static void FontText(string text, ImFontPtr font) public static void FontText(string text, ImFontPtr font, Vector4? color = null)
{ {
ImGui.PushFont(font); using var pushedFont = ImRaii.PushFont(font);
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, Color(color ?? new Vector4(1, 1, 1, 1)), color != null);
ImGui.TextUnformatted(text); ImGui.TextUnformatted(text);
ImGui.PopFont();
} }
public static Vector4 GetBoolColor(bool input) => input ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; public static Vector4 GetBoolColor(bool input) => input ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
@@ -616,30 +617,58 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
var customizeColor = _customizePlusExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; var customizeColor = _customizePlusExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
var paletteColor = _palettePlusExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; var paletteColor = _palettePlusExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
var honorificColor = _honorificExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; var honorificColor = _honorificExists ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
ImGui.Text("Penumbra:"); var check = FontAwesomeIcon.Check.ToIconString();
var cross = FontAwesomeIcon.SquareXmark.ToIconString();
ImGui.Text("Mandatory Plugins:");
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(penumbraColor, _penumbraExists ? "Available" : "Unavailable"); ImGui.Text("Penumbra");
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text("Glamourer:"); FontText(_penumbraExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(glamourerColor, _glamourerExists ? "Available" : "Unavailable"); AttachToolTip($"Penumbra is " + (_penumbraExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Text("Optional Addons"); ImGui.Spacing();
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text("SimpleHeels:"); ImGui.Text("Glamourer");
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(heelsColor, _heelsExists ? "Available" : "Unavailable"); FontText(_glamourerExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text("Customize+:"); AttachToolTip($"Glamourer is " + (_glamourerExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Spacing();
ImGui.Text("Optional Plugins:");
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(customizeColor, _customizePlusExists ? "Available" : "Unavailable"); ImGui.Text("SimpleHeels");
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text("Palette+:"); FontText(_heelsExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(paletteColor, _palettePlusExists ? "Available" : "Unavailable"); AttachToolTip($"SimpleHeels is " + (_heelsExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Spacing();
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text("Honorific:"); ImGui.Text("Customize+");
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(honorificColor, _honorificExists ? "Available" : "Unavailable"); FontText(_customizePlusExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine();
AttachToolTip($"Customize+ is " + (_customizePlusExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Spacing();
ImGui.SameLine();
ImGui.Text("Palette+");
ImGui.SameLine();
FontText(_palettePlusExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine();
AttachToolTip($"Palette+ is " + (_palettePlusExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Spacing();
ImGui.SameLine();
ImGui.Text("Honorific");
ImGui.SameLine();
FontText(_honorificExists ? check : cross, UiBuilder.IconFont, penumbraColor);
ImGui.SameLine();
AttachToolTip($"Honorific is " + (_honorificExists ? "available and up to date." : "unavailable or not up to date."));
ImGui.Spacing();
if (!_penumbraExists || !_glamourerExists) if (!_penumbraExists || !_glamourerExists)
{ {

View File

@@ -1,4 +1,5 @@
using MareSynchronos.API.SignalR; using Dalamud.Plugin.Services;
using MareSynchronos.API.SignalR;
using MareSynchronos.Interop; using MareSynchronos.Interop;
using MareSynchronos.MareConfiguration; using MareSynchronos.MareConfiguration;
using MareSynchronos.Services.Mediator; using MareSynchronos.Services.Mediator;
@@ -17,13 +18,16 @@ public class HubFactory : MediatorSubscriberBase
{ {
private readonly ServerConfigurationManager _serverConfigurationManager; private readonly ServerConfigurationManager _serverConfigurationManager;
private readonly MareConfigService _configService; private readonly MareConfigService _configService;
private readonly IPluginLog _pluginLog;
private HubConnection? _instance; private HubConnection? _instance;
private bool _isDisposed = false; private bool _isDisposed = false;
public HubFactory(ILogger<HubFactory> logger, MareMediator mediator, ServerConfigurationManager serverConfigurationManager, MareConfigService configService) : base(logger, mediator) public HubFactory(ILogger<HubFactory> logger, MareMediator mediator, ServerConfigurationManager serverConfigurationManager, MareConfigService configService,
IPluginLog pluginLog) : base(logger, mediator)
{ {
_serverConfigurationManager = serverConfigurationManager; _serverConfigurationManager = serverConfigurationManager;
_configService = configService; _configService = configService;
_pluginLog = pluginLog;
} }
private HubConnection BuildHubConnection() private HubConnection BuildHubConnection()
@@ -58,7 +62,7 @@ public class HubFactory : MediatorSubscriberBase
.WithAutomaticReconnect(new ForeverRetryPolicy(Mediator)) .WithAutomaticReconnect(new ForeverRetryPolicy(Mediator))
.ConfigureLogging(a => .ConfigureLogging(a =>
{ {
a.ClearProviders().AddProvider(new DalamudLoggingProvider(_configService)); a.ClearProviders().AddProvider(new DalamudLoggingProvider(_configService, _pluginLog));
a.SetMinimumLevel(LogLevel.Information); a.SetMinimumLevel(LogLevel.Information);
}) })
.Build(); .Build();