fix contextmenu etc

This commit is contained in:
Stanley Dimant
2024-07-17 21:29:53 +02:00
parent b9cf7eb6fa
commit bfafcad8e8
16 changed files with 101 additions and 78 deletions

View File

@@ -115,6 +115,9 @@ public sealed class IpcCallerCustomize : IIpcCaller
public void CheckAPI() public void CheckAPI()
{ {
// todo: restore this when it's available again
return;
try try
{ {
var version = _customizePlusApiVersion.InvokeFunc(); var version = _customizePlusApiVersion.InvokeFunc();

View File

@@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc; using Dalamud.Plugin.Ipc;
using MareSynchronos.Services; using MareSynchronos.Services;
using MareSynchronos.Services.Mediator; using MareSynchronos.Services.Mediator;
@@ -15,8 +14,8 @@ public sealed class IpcCallerHeels : IIpcCaller
private readonly ICallGateSubscriber<(int, int)> _heelsGetApiVersion; private readonly ICallGateSubscriber<(int, int)> _heelsGetApiVersion;
private readonly ICallGateSubscriber<string> _heelsGetOffset; private readonly ICallGateSubscriber<string> _heelsGetOffset;
private readonly ICallGateSubscriber<string, object?> _heelsOffsetUpdate; private readonly ICallGateSubscriber<string, object?> _heelsOffsetUpdate;
private readonly ICallGateSubscriber<IGameObject, string, object?> _heelsRegisterPlayer; private readonly ICallGateSubscriber<int, string, object?> _heelsRegisterPlayer;
private readonly ICallGateSubscriber<IGameObject, object?> _heelsUnregisterPlayer; private readonly ICallGateSubscriber<int, object?> _heelsUnregisterPlayer;
public IpcCallerHeels(ILogger<IpcCallerHeels> logger, IDalamudPluginInterface pi, DalamudUtilService dalamudUtil, MareMediator mareMediator) public IpcCallerHeels(ILogger<IpcCallerHeels> logger, IDalamudPluginInterface pi, DalamudUtilService dalamudUtil, MareMediator mareMediator)
{ {
@@ -25,8 +24,8 @@ public sealed class IpcCallerHeels : IIpcCaller
_dalamudUtil = dalamudUtil; _dalamudUtil = dalamudUtil;
_heelsGetApiVersion = pi.GetIpcSubscriber<(int, int)>("SimpleHeels.ApiVersion"); _heelsGetApiVersion = pi.GetIpcSubscriber<(int, int)>("SimpleHeels.ApiVersion");
_heelsGetOffset = pi.GetIpcSubscriber<string>("SimpleHeels.GetLocalPlayer"); _heelsGetOffset = pi.GetIpcSubscriber<string>("SimpleHeels.GetLocalPlayer");
_heelsRegisterPlayer = pi.GetIpcSubscriber<IGameObject, string, object?>("SimpleHeels.RegisterPlayer"); _heelsRegisterPlayer = pi.GetIpcSubscriber<int, string, object?>("SimpleHeels.RegisterPlayer");
_heelsUnregisterPlayer = pi.GetIpcSubscriber<IGameObject, object?>("SimpleHeels.UnregisterPlayer"); _heelsUnregisterPlayer = pi.GetIpcSubscriber<int, object?>("SimpleHeels.UnregisterPlayer");
_heelsOffsetUpdate = pi.GetIpcSubscriber<string, object?>("SimpleHeels.LocalChanged"); _heelsOffsetUpdate = pi.GetIpcSubscriber<string, object?>("SimpleHeels.LocalChanged");
_heelsOffsetUpdate.Subscribe(HeelsOffsetChange); _heelsOffsetUpdate.Subscribe(HeelsOffsetChange);
@@ -56,7 +55,7 @@ public sealed class IpcCallerHeels : IIpcCaller
if (gameObj != null) if (gameObj != null)
{ {
_logger.LogTrace("Restoring Heels data to {chara}", character.ToString("X")); _logger.LogTrace("Restoring Heels data to {chara}", character.ToString("X"));
_heelsUnregisterPlayer.InvokeAction(gameObj); _heelsUnregisterPlayer.InvokeAction(gameObj.ObjectIndex);
} }
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
@@ -70,7 +69,7 @@ public sealed class IpcCallerHeels : IIpcCaller
if (gameObj != null) if (gameObj != null)
{ {
_logger.LogTrace("Applying Heels data to {chara}", character.ToString("X")); _logger.LogTrace("Applying Heels data to {chara}", character.ToString("X"));
_heelsRegisterPlayer.InvokeAction(gameObj, data); _heelsRegisterPlayer.InvokeAction(gameObj.ObjectIndex, data);
} }
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
@@ -79,7 +78,7 @@ public sealed class IpcCallerHeels : IIpcCaller
{ {
try try
{ {
APIAvailable = _heelsGetApiVersion.InvokeFunc() is { Item1: 1, Item2: >= 1 }; APIAvailable = _heelsGetApiVersion.InvokeFunc() is { Item1: 2, Item2: >= 1 };
} }
catch catch
{ {

View File

@@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Ipc; using Dalamud.Plugin.Ipc;
using MareSynchronos.Services; using MareSynchronos.Services;
@@ -12,12 +11,12 @@ namespace MareSynchronos.Interop.Ipc;
public sealed class IpcCallerHonorific : IIpcCaller public sealed class IpcCallerHonorific : IIpcCaller
{ {
private readonly ICallGateSubscriber<(uint major, uint minor)> _honorificApiVersion; private readonly ICallGateSubscriber<(uint major, uint minor)> _honorificApiVersion;
private readonly ICallGateSubscriber<ICharacter, object> _honorificClearCharacterTitle; private readonly ICallGateSubscriber<int, object> _honorificClearCharacterTitle;
private readonly ICallGateSubscriber<object> _honorificDisposing; private readonly ICallGateSubscriber<object> _honorificDisposing;
private readonly ICallGateSubscriber<string> _honorificGetLocalCharacterTitle; private readonly ICallGateSubscriber<string> _honorificGetLocalCharacterTitle;
private readonly ICallGateSubscriber<string, object> _honorificLocalCharacterTitleChanged; private readonly ICallGateSubscriber<string, object> _honorificLocalCharacterTitleChanged;
private readonly ICallGateSubscriber<object> _honorificReady; private readonly ICallGateSubscriber<object> _honorificReady;
private readonly ICallGateSubscriber<ICharacter, string, object> _honorificSetCharacterTitle; private readonly ICallGateSubscriber<int, string, object> _honorificSetCharacterTitle;
private readonly ILogger<IpcCallerHonorific> _logger; private readonly ILogger<IpcCallerHonorific> _logger;
private readonly MareMediator _mareMediator; private readonly MareMediator _mareMediator;
private readonly DalamudUtilService _dalamudUtil; private readonly DalamudUtilService _dalamudUtil;
@@ -30,8 +29,8 @@ public sealed class IpcCallerHonorific : IIpcCaller
_dalamudUtil = dalamudUtil; _dalamudUtil = dalamudUtil;
_honorificApiVersion = pi.GetIpcSubscriber<(uint, uint)>("Honorific.ApiVersion"); _honorificApiVersion = pi.GetIpcSubscriber<(uint, uint)>("Honorific.ApiVersion");
_honorificGetLocalCharacterTitle = pi.GetIpcSubscriber<string>("Honorific.GetLocalCharacterTitle"); _honorificGetLocalCharacterTitle = pi.GetIpcSubscriber<string>("Honorific.GetLocalCharacterTitle");
_honorificClearCharacterTitle = pi.GetIpcSubscriber<ICharacter, object>("Honorific.ClearCharacterTitle"); _honorificClearCharacterTitle = pi.GetIpcSubscriber<int, object>("Honorific.ClearCharacterTitle");
_honorificSetCharacterTitle = pi.GetIpcSubscriber<ICharacter, string, object>("Honorific.SetCharacterTitle"); _honorificSetCharacterTitle = pi.GetIpcSubscriber<int, string, object>("Honorific.SetCharacterTitle");
_honorificLocalCharacterTitleChanged = pi.GetIpcSubscriber<string, object>("Honorific.LocalCharacterTitleChanged"); _honorificLocalCharacterTitleChanged = pi.GetIpcSubscriber<string, object>("Honorific.LocalCharacterTitleChanged");
_honorificDisposing = pi.GetIpcSubscriber<object>("Honorific.Disposing"); _honorificDisposing = pi.GetIpcSubscriber<object>("Honorific.Disposing");
_honorificReady = pi.GetIpcSubscriber<object>("Honorific.Ready"); _honorificReady = pi.GetIpcSubscriber<object>("Honorific.Ready");
@@ -49,7 +48,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
{ {
try try
{ {
APIAvailable = _honorificApiVersion.InvokeFunc() is { Item1: 2, Item2: >= 0 }; APIAvailable = _honorificApiVersion.InvokeFunc() is { Item1: 3, Item2: >= 1 };
} }
catch catch
{ {
@@ -73,7 +72,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
if (gameObj is IPlayerCharacter c) if (gameObj is IPlayerCharacter c)
{ {
_logger.LogTrace("Honorific removing for {addr}", c.Address.ToString("X")); _logger.LogTrace("Honorific removing for {addr}", c.Address.ToString("X"));
_honorificClearCharacterTitle!.InvokeAction(c); _honorificClearCharacterTitle!.InvokeAction(c.ObjectIndex);
} }
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
@@ -99,11 +98,11 @@ public sealed class IpcCallerHonorific : IIpcCaller
string honorificData = string.IsNullOrEmpty(honorificDataB64) ? string.Empty : Encoding.UTF8.GetString(Convert.FromBase64String(honorificDataB64)); string honorificData = string.IsNullOrEmpty(honorificDataB64) ? string.Empty : Encoding.UTF8.GetString(Convert.FromBase64String(honorificDataB64));
if (string.IsNullOrEmpty(honorificData)) if (string.IsNullOrEmpty(honorificData))
{ {
_honorificClearCharacterTitle!.InvokeAction(pc); _honorificClearCharacterTitle!.InvokeAction(pc.ObjectIndex);
} }
else else
{ {
_honorificSetCharacterTitle!.InvokeAction(pc, honorificData); _honorificSetCharacterTitle!.InvokeAction(pc.ObjectIndex, honorificData);
} }
} }
}).ConfigureAwait(false); }).ConfigureAwait(false);

View File

@@ -45,6 +45,9 @@ public sealed class IpcCallerMoodles : IIpcCaller
public void CheckAPI() public void CheckAPI()
{ {
// todo: restore this when it's available again
return;
try try
{ {
APIAvailable = _moodlesApiVersion.InvokeFunc() == 1; APIAvailable = _moodlesApiVersion.InvokeFunc() == 1;

View File

@@ -29,7 +29,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dalamud.ContextMenu" Version="1.3.1" />
<PackageReference Include="DalamudPackager" Version="2.1.13" /> <PackageReference Include="DalamudPackager" Version="2.1.13" />
<PackageReference Include="Downloader" Version="3.1.2" /> <PackageReference Include="Downloader" Version="3.1.2" />
<PackageReference Include="lz4net" Version="1.0.15.93" /> <PackageReference Include="lz4net" Version="1.0.15.93" />

View File

@@ -1,12 +1,10 @@
using Dalamud.Memory; using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using MareSynchronos.Services; using MareSynchronos.Services;
using MareSynchronos.Services.Mediator; using MareSynchronos.Services.Mediator;
using MareSynchronos.Utils; using MareSynchronos.Utils;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using static FFXIVClientStructs.FFXIV.Client.Game.Character.DrawDataContainer; using static FFXIVClientStructs.FFXIV.Client.Game.Character.DrawDataContainer;
using ObjectKind = MareSynchronos.API.Data.Enum.ObjectKind; using ObjectKind = MareSynchronos.API.Data.Enum.ObjectKind;

View File

@@ -13,7 +13,6 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Channels;
using ObjectKind = MareSynchronos.API.Data.Enum.ObjectKind; using ObjectKind = MareSynchronos.API.Data.Enum.ObjectKind;
namespace MareSynchronos.PlayerData.Handlers; namespace MareSynchronos.PlayerData.Handlers;

View File

@@ -1,4 +1,4 @@
using Dalamud.ContextMenu; using Dalamud.Game.Gui.ContextMenu;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using MareSynchronos.API.Data; using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Enum; using MareSynchronos.API.Data.Enum;
@@ -52,34 +52,53 @@ public class Pair
public UserFullPairDto UserPair { get; set; } public UserFullPairDto UserPair { get; set; }
private PairHandler? CachedPlayer { get; set; } private PairHandler? CachedPlayer { get; set; }
public void AddContextMenu(GameObjectContextMenuOpenArgs args) public void AddContextMenu(IMenuOpenedArgs args)
{ {
if (CachedPlayer == null || args.ObjectId != CachedPlayer.PlayerCharacterId || IsPaused) return; if (CachedPlayer == null || (args.Target is not MenuTargetDefault target) || target.TargetObjectId != CachedPlayer.PlayerCharacterId || IsPaused) return;
SeStringBuilder seStringBuilder = new(); SeStringBuilder seStringBuilder = new();
SeStringBuilder seStringBuilder2 = new(); SeStringBuilder seStringBuilder2 = new();
SeStringBuilder seStringBuilder3 = new(); SeStringBuilder seStringBuilder3 = new();
SeStringBuilder seStringBuilder4 = new(); SeStringBuilder seStringBuilder4 = new();
var openProfileSeString = seStringBuilder.AddUiForeground(526).AddText(" ").AddUiForegroundOff().AddText("Open Profile").Build(); var openProfileSeString = seStringBuilder.AddText("Open Profile").Build();
var reapplyDataSeString = seStringBuilder2.AddUiForeground(526).AddText(" ").AddUiForegroundOff().AddText("Reapply last data").Build(); var reapplyDataSeString = seStringBuilder2.AddText("Reapply last data").Build();
var cyclePauseState = seStringBuilder3.AddUiForeground(526).AddText(" ").AddUiForegroundOff().AddText("Cycle pause state").Build(); var cyclePauseState = seStringBuilder3.AddText("Cycle pause state").Build();
var changePermissions = seStringBuilder4.AddUiForeground(526).AddText(" ").AddUiForegroundOff().AddText("Change Permissions").Build(); var changePermissions = seStringBuilder4.AddText("Change Permissions").Build();
args.AddCustomItem(new GameObjectContextMenuItem(openProfileSeString, (a) => args.AddMenuItem(new MenuItem()
{ {
_mediator.Publish(new ProfileOpenStandaloneMessage(this)); Name = openProfileSeString,
})); OnClicked = (a) => _mediator.Publish(new ProfileOpenStandaloneMessage(this)),
args.AddCustomItem(new GameObjectContextMenuItem(reapplyDataSeString, (a) => UseDefaultPrefix = false,
PrefixChar = 'M',
PrefixColor = 526
});
args.AddMenuItem(new MenuItem()
{ {
ApplyLastReceivedData(forced: true); Name = reapplyDataSeString,
}, useDalamudIndicator: false)); OnClicked = (a) => ApplyLastReceivedData(forced: true),
args.AddCustomItem(new GameObjectContextMenuItem(changePermissions, (a) => UseDefaultPrefix = false,
PrefixChar = 'M',
PrefixColor = 526
});
args.AddMenuItem(new MenuItem()
{ {
_mediator.Publish(new OpenPermissionWindow(this)); Name = changePermissions,
}, useDalamudIndicator: false)); OnClicked = (a) => _mediator.Publish(new OpenPermissionWindow(this)),
args.AddCustomItem(new GameObjectContextMenuItem(cyclePauseState, (a) => UseDefaultPrefix = false,
PrefixChar = 'M',
PrefixColor = 526
});
args.AddMenuItem(new MenuItem()
{ {
_mediator.Publish(new CyclePauseMessage(UserData)); Name = cyclePauseState,
}, useDalamudIndicator: false)); OnClicked = (a) => _mediator.Publish(new CyclePauseMessage(UserData)),
UseDefaultPrefix = false,
PrefixChar = 'M',
PrefixColor = 526
});
} }
public void ApplyData(OnlineUserCharaDataDto data) public void ApplyData(OnlineUserCharaDataDto data)

View File

@@ -1,4 +1,4 @@
using Dalamud.ContextMenu; using Dalamud.Plugin.Services;
using MareSynchronos.API.Data; using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Comparer; using MareSynchronos.API.Data.Comparer;
using MareSynchronos.API.Data.Extensions; using MareSynchronos.API.Data.Extensions;
@@ -19,27 +19,26 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
private readonly ConcurrentDictionary<UserData, Pair> _allClientPairs = new(UserDataComparer.Instance); private readonly ConcurrentDictionary<UserData, Pair> _allClientPairs = new(UserDataComparer.Instance);
private readonly ConcurrentDictionary<GroupData, GroupFullInfoDto> _allGroups = new(GroupDataComparer.Instance); private readonly ConcurrentDictionary<GroupData, GroupFullInfoDto> _allGroups = new(GroupDataComparer.Instance);
private readonly MareConfigService _configurationService; private readonly MareConfigService _configurationService;
//private readonly DalamudContextMenu _dalamudContextMenu; private readonly IContextMenu _dalamudContextMenu;
private readonly PairFactory _pairFactory; private readonly PairFactory _pairFactory;
private Lazy<List<Pair>> _directPairsInternal; private Lazy<List<Pair>> _directPairsInternal;
private Lazy<Dictionary<GroupFullInfoDto, List<Pair>>> _groupPairsInternal; private Lazy<Dictionary<GroupFullInfoDto, List<Pair>>> _groupPairsInternal;
private Lazy<Dictionary<Pair, List<GroupFullInfoDto>>> _pairsWithGroupsInternal; private Lazy<Dictionary<Pair, List<GroupFullInfoDto>>> _pairsWithGroupsInternal;
public PairManager(ILogger<PairManager> logger, PairFactory pairFactory, public PairManager(ILogger<PairManager> logger, PairFactory pairFactory,
MareConfigService configurationService, MareMediator mediator MareConfigService configurationService, MareMediator mediator,
//DalamudContextMenu dalamudContextMenu) : base(logger, mediator) IContextMenu dalamudContextMenu) : base(logger, mediator)
) : base(logger, mediator)
{ {
_pairFactory = pairFactory; _pairFactory = pairFactory;
_configurationService = configurationService; _configurationService = configurationService;
//_dalamudContextMenu = dalamudContextMenu; _dalamudContextMenu = dalamudContextMenu;
Mediator.Subscribe<DisconnectedMessage>(this, (_) => ClearPairs()); Mediator.Subscribe<DisconnectedMessage>(this, (_) => ClearPairs());
Mediator.Subscribe<CutsceneEndMessage>(this, (_) => ReapplyPairData()); Mediator.Subscribe<CutsceneEndMessage>(this, (_) => ReapplyPairData());
_directPairsInternal = DirectPairsLazy(); _directPairsInternal = DirectPairsLazy();
_groupPairsInternal = GroupPairsLazy(); _groupPairsInternal = GroupPairsLazy();
_pairsWithGroupsInternal = PairsWithGroupsLazy(); _pairsWithGroupsInternal = PairsWithGroupsLazy();
//_dalamudContextMenu.OnOpenGameObjectContextMenu += DalamudContextMenuOnOnOpenGameObjectContextMenu; _dalamudContextMenu.OnMenuOpened += DalamudContextMenuOnOnOpenGameObjectContextMenu;
} }
public List<Pair> DirectPairs => _directPairsInternal.Value; public List<Pair> DirectPairs => _directPairsInternal.Value;
@@ -320,14 +319,14 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
{ {
base.Dispose(disposing); base.Dispose(disposing);
//_dalamudContextMenu.OnOpenGameObjectContextMenu -= DalamudContextMenuOnOnOpenGameObjectContextMenu; _dalamudContextMenu.OnMenuOpened -= DalamudContextMenuOnOnOpenGameObjectContextMenu;
DisposePairs(); DisposePairs();
} }
private void DalamudContextMenuOnOnOpenGameObjectContextMenu(GameObjectContextMenuOpenArgs args) private void DalamudContextMenuOnOnOpenGameObjectContextMenu(Dalamud.Game.Gui.ContextMenu.IMenuOpenedArgs args)
{ {
if (args.ObjectId == 0xE000000) return; if (args.MenuType == Dalamud.Game.Gui.ContextMenu.ContextMenuType.Inventory) return;
if (!_configurationService.Current.EnableRightClickMenus) return; if (!_configurationService.Current.EnableRightClickMenus) return;
foreach (var pair in _allClientPairs.Where((p => p.Value.IsVisible))) foreach (var pair in _allClientPairs.Where((p => p.Value.IsVisible)))

View File

@@ -1,5 +1,4 @@
using Dalamud.ContextMenu; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin; using Dalamud.Plugin;
@@ -36,7 +35,7 @@ public sealed class Plugin : IDalamudPlugin
public Plugin(IDalamudPluginInterface pluginInterface, ICommandManager commandManager, IDataManager gameData, public Plugin(IDalamudPluginInterface pluginInterface, ICommandManager commandManager, IDataManager gameData,
IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui, IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui,
IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager, INotificationManager notificationManager, IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager, INotificationManager notificationManager,
ITextureProvider textureProvider) ITextureProvider textureProvider, IContextMenu contextMenu)
{ {
_host = new HostBuilder() _host = new HostBuilder()
.UseContentRoot(pluginInterface.ConfigDirectory.FullName) .UseContentRoot(pluginInterface.ConfigDirectory.FullName)
@@ -56,7 +55,6 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<MareMediator>(); collection.AddSingleton<MareMediator>();
collection.AddSingleton<FileCacheManager>(); collection.AddSingleton<FileCacheManager>();
collection.AddSingleton<ServerConfigurationManager>(); collection.AddSingleton<ServerConfigurationManager>();
collection.AddSingleton<PairManager>();
collection.AddSingleton<ApiController>(); collection.AddSingleton<ApiController>();
collection.AddSingleton<MareCharaFileManager>(); collection.AddSingleton<MareCharaFileManager>();
collection.AddSingleton<PerformanceCollectorService>(); collection.AddSingleton<PerformanceCollectorService>();
@@ -84,13 +82,13 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<SelectPairForTagUi>(); collection.AddSingleton<SelectPairForTagUi>();
collection.AddSingleton((s) => new EventAggregator(pluginInterface.ConfigDirectory.FullName, collection.AddSingleton((s) => new EventAggregator(pluginInterface.ConfigDirectory.FullName,
s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>())); s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>()));
//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, targetManager, clientState, objectTable, framework, gameGui, condition, gameData, targetManager,
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>())); s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>()));
collection.AddSingleton((s) => new DtrEntry(s.GetRequiredService<ILogger<DtrEntry>>(), dtrBar, s.GetRequiredService<MareConfigService>(), collection.AddSingleton((s) => new DtrEntry(s.GetRequiredService<ILogger<DtrEntry>>(), dtrBar, s.GetRequiredService<MareConfigService>(),
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<ApiController>())); s.GetRequiredService<MareMediator>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<ApiController>()));
collection.AddSingleton(s => new PairManager(s.GetRequiredService<ILogger<PairManager>>(), s.GetRequiredService<PairFactory>(),
s.GetRequiredService<MareConfigService>(), s.GetRequiredService<MareMediator>(), contextMenu));
collection.AddSingleton<RedrawManager>(); collection.AddSingleton<RedrawManager>();
collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService<ILogger<IpcCallerPenumbra>>(), pluginInterface, collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService<ILogger<IpcCallerPenumbra>>(), pluginInterface,
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<RedrawManager>())); s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<RedrawManager>()));

View File

@@ -1,7 +1,6 @@
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Character;
@@ -197,7 +196,13 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
public async Task<string> GetPlayerNameHashedAsync() public async Task<string> GetPlayerNameHashedAsync()
{ {
return await RunOnFrameworkThread(() => (GetPlayerName(), (ushort)GetHomeWorldId()).GetHash256()).ConfigureAwait(false); return await RunOnFrameworkThread(() => GetHashedAccIdFromPlayerPointer(GetPlayerPointer())).ConfigureAwait(false);
}
private unsafe string GetHashedAccIdFromPlayerPointer(nint ptr)
{
if (ptr == nint.Zero) return string.Empty;
return ((BattleChara*)ptr)->Character.AccountId.ToString().GetHash256();
} }
public IntPtr GetPlayerPointer() public IntPtr GetPlayerPointer()
@@ -453,7 +458,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
continue; continue;
var charaName = ((GameObject*)chara.Address)->NameString; var charaName = ((GameObject*)chara.Address)->NameString;
var hash = (charaName, ((BattleChara*)chara.Address)->Character.HomeWorld).GetHash256(); var hash = GetHashedAccIdFromPlayerPointer(chara.Address);
if (!IsAnythingDrawing) if (!IsAnythingDrawing)
CheckCharacterForDrawing(chara.Address, charaName); CheckCharacterForDrawing(chara.Address, charaName);
_notUpdatedCharas.Remove(hash); _notUpdatedCharas.Remove(hash);

View File

@@ -186,6 +186,8 @@ public sealed class XivDataAnalyzer
var filePath = path.ResolvedFilepath; var filePath = path.ResolvedFilepath;
try
{
_logger.LogDebug("Detected Model File {path}, calculating Tris", filePath); _logger.LogDebug("Detected Model File {path}, calculating Tris", filePath);
var file = _luminaGameData.GetFileFromDisk<MdlFile>(filePath); var file = _luminaGameData.GetFileFromDisk<MdlFile>(filePath);
if (file.FileHeader.LodCount <= 0) if (file.FileHeader.LodCount <= 0)
@@ -199,4 +201,10 @@ public sealed class XivDataAnalyzer
_configService.Save(); _configService.Save();
return Task.FromResult(tris); return Task.FromResult(tris);
} }
catch (Exception e)
{
_logger.LogWarning(e, "Could not parse file {file}", filePath);
return Task.FromResult((long)0);
}
}
} }

View File

@@ -1,7 +1,6 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;

View File

@@ -1,5 +1,4 @@
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;

View File

@@ -1,5 +1,4 @@
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using ImGuiNET; using ImGuiNET;

View File

@@ -1,11 +1,8 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.GameFonts; using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Internal;
using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;