Add option to set visible pairs as focus targets (#85)

This commit is contained in:
N. Lo.
2025-08-16 23:17:18 +02:00
committed by GitHub
parent 0c834f5edd
commit eccfc5b3f0
4 changed files with 20 additions and 3 deletions

View File

@@ -59,4 +59,5 @@ public class MareConfig : IMareConfiguration
public bool AutoPopulateEmptyNotesFromCharaName { get; set; } = false; public bool AutoPopulateEmptyNotesFromCharaName { get; set; } = false;
public int Version { get; set; } = 1; public int Version { get; set; } = 1;
public NotificationLocation WarningNotification { get; set; } = NotificationLocation.Both; public NotificationLocation WarningNotification { get; set; } = NotificationLocation.Both;
public bool UseFocusTarget { get; set; } = false;
} }

View File

@@ -134,7 +134,8 @@ public sealed class Plugin : IDalamudPlugin
s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>())); s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>()));
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, gameConfig, clientState, objectTable, framework, gameGui, condition, gameData, targetManager, gameConfig,
s.GetRequiredService<BlockedCharacterHandler>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>())); s.GetRequiredService<BlockedCharacterHandler>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>(),
s.GetRequiredService<MareConfigService>()));
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>(), collection.AddSingleton(s => new PairManager(s.GetRequiredService<ILogger<PairManager>>(), s.GetRequiredService<PairFactory>(),

View File

@@ -13,6 +13,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
using MareSynchronos.API.Dto.CharaData; using MareSynchronos.API.Dto.CharaData;
using MareSynchronos.Interop; using MareSynchronos.Interop;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Handlers; using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.Services.Mediator; using MareSynchronos.Services.Mediator;
using MareSynchronos.Utils; using MareSynchronos.Utils;
@@ -38,6 +39,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
private readonly ILogger<DalamudUtilService> _logger; private readonly ILogger<DalamudUtilService> _logger;
private readonly IObjectTable _objectTable; private readonly IObjectTable _objectTable;
private readonly PerformanceCollectorService _performanceCollector; private readonly PerformanceCollectorService _performanceCollector;
private readonly MareConfigService _configService;
private uint? _classJobId = 0; private uint? _classJobId = 0;
private DateTime _delayedFrameworkUpdateCheck = DateTime.UtcNow; private DateTime _delayedFrameworkUpdateCheck = DateTime.UtcNow;
private string _lastGlobalBlockPlayer = string.Empty; private string _lastGlobalBlockPlayer = string.Empty;
@@ -50,7 +52,8 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
public DalamudUtilService(ILogger<DalamudUtilService> logger, IClientState clientState, IObjectTable objectTable, IFramework framework, public DalamudUtilService(ILogger<DalamudUtilService> logger, IClientState clientState, IObjectTable objectTable, IFramework framework,
IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, IGameConfig gameConfig, IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, IGameConfig gameConfig,
BlockedCharacterHandler blockedCharacterHandler, MareMediator mediator, PerformanceCollectorService performanceCollector) BlockedCharacterHandler blockedCharacterHandler, MareMediator mediator, PerformanceCollectorService performanceCollector,
MareConfigService configService)
{ {
_logger = logger; _logger = logger;
_clientState = clientState; _clientState = clientState;
@@ -63,6 +66,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
_blockedCharacterHandler = blockedCharacterHandler; _blockedCharacterHandler = blockedCharacterHandler;
Mediator = mediator; Mediator = mediator;
_performanceCollector = performanceCollector; _performanceCollector = performanceCollector;
_configService = configService;
WorldData = new(() => WorldData = new(() =>
{ {
return gameData.GetExcelSheet<Lumina.Excel.Sheets.World>(Dalamud.Game.ClientLanguage.English)! return gameData.GetExcelSheet<Lumina.Excel.Sheets.World>(Dalamud.Game.ClientLanguage.English)!
@@ -118,8 +122,12 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
if (string.IsNullOrEmpty(name)) return; if (string.IsNullOrEmpty(name)) return;
var addr = _playerCharas.FirstOrDefault(f => string.Equals(f.Value.Name, name, StringComparison.Ordinal)).Value.Address; var addr = _playerCharas.FirstOrDefault(f => string.Equals(f.Value.Name, name, StringComparison.Ordinal)).Value.Address;
if (addr == nint.Zero) return; if (addr == nint.Zero) return;
var useFocusTarget = _configService.Current.UseFocusTarget;
_ = RunOnFrameworkThread(() => _ = RunOnFrameworkThread(() =>
{ {
if (useFocusTarget)
targetManager.FocusTarget = CreateGameObject(addr);
else
targetManager.Target = CreateGameObject(addr); targetManager.Target = CreateGameObject(addr);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });

View File

@@ -895,6 +895,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
var dtrColorsNotConnected = _configService.Current.DtrColorsNotConnected; var dtrColorsNotConnected = _configService.Current.DtrColorsNotConnected;
var dtrColorsPairsInRange = _configService.Current.DtrColorsPairsInRange; var dtrColorsPairsInRange = _configService.Current.DtrColorsPairsInRange;
var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible; var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible;
var useFocusTarget = _configService.Current.UseFocusTarget;
var groupUpSyncshells = _configService.Current.GroupUpSyncshells; var groupUpSyncshells = _configService.Current.GroupUpSyncshells;
var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible; var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible;
var syncshellOfflineSeparate = _configService.Current.ShowSyncshellOfflineUsersSeparately; var syncshellOfflineSeparate = _configService.Current.ShowSyncshellOfflineUsersSeparately;
@@ -1025,6 +1026,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled(); if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled();
ImGui.Unindent(); ImGui.Unindent();
if (ImGui.Checkbox("Set visible pairs as focus targets when clicking the eye", ref useFocusTarget))
{
_configService.Current.UseFocusTarget = useFocusTarget;
_configService.Save();
}
if (ImGui.Checkbox("Show Mare Profiles on Hover", ref showProfiles)) if (ImGui.Checkbox("Show Mare Profiles on Hover", ref showProfiles))
{ {
Mediator.Publish(new ClearProfileDataMessage()); Mediator.Publish(new ClearProfileDataMessage());