Compare commits

...

10 Commits

Author SHA1 Message Date
N. Lo.
eccfc5b3f0 Add option to set visible pairs as focus targets (#85) 2025-08-16 23:17:18 +02:00
rootdarkarchon
0c834f5edd fix sig 2025-08-08 23:39:37 +02:00
rootdarkarchon
b15f6f2c2a fix aid discrepancy 2025-08-08 23:21:17 +02:00
N. Lo.
108bbe2a02 Make it build against Dalamud 13 (#84) 2025-08-08 22:42:18 +02:00
rootdarkarchon
f94af2cc9e Merge branch 'main' of https://github.com/Penumbra-Sync/client 2025-06-30 23:49:11 +02:00
rootdarkarchon
11535caf7e debounce, ignore processing when dead only in duty 2025-06-30 23:49:05 +02:00
rootdarkarchon
95969eeb7c format some shit 2025-04-21 10:28:04 +02:00
rootdarkarchon
c0870e85df rebuild aid on login 2025-04-21 10:25:01 +02:00
Stanley Dimant
85058379e7 easiest solutions to problems is just to remove the thing causing the problem 2025-04-13 22:21:50 +02:00
Stanley Dimant
a3e62f5529 fix gpose world stuff 2025-04-10 20:17:58 +02:00
40 changed files with 168 additions and 187 deletions

View File

@@ -19,7 +19,7 @@ public unsafe class VfxSpawnManager : DisposableMediatorSubscriberBase
[Signature("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")]
private readonly delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate;
[Signature("E8 ?? ?? ?? ?? 8B 4B 7C 85 C9")]
[Signature("E8 ?? ?? ?? ?? ?? ?? ?? 8B 4A ?? 85 C9")]
private readonly delegate* unmanaged<VfxStruct*, float, int, ulong> _staticVfxRun;
[Signature("40 53 48 83 EC 20 48 8B D9 48 8B 89 ?? ?? ?? ?? 48 85 C9 74 28 33 D2 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9")]

View File

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

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Dalamud.NET.Sdk/12.0.2">
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
<PropertyGroup>
<Authors></Authors>
<Company></Company>

View File

@@ -195,7 +195,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
_creationCts.Cancel();
_creationCts.Dispose();
_creationCts = new();
_cacheCreateLock.Wait();
_cacheCreateLock.Wait(_creationCts.Token);
var objectKindsToCreate = _cachesToCreate.ToList();
foreach (var creationObj in objectKindsToCreate)
{
@@ -208,12 +208,14 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
{
using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(_creationCts.Token, _runtimeCts.Token);
await Task.Delay(TimeSpan.FromSeconds(1), linkedCts.Token).ConfigureAwait(false);
Logger.LogDebug("Creating Caches for {objectKinds}", string.Join(", ", objectKindsToCreate));
try
{
Dictionary<ObjectKind, CharacterDataFragment?> createdData = [];
foreach (var objectKind in objectKindsToCreate)
foreach (var objectKind in _currentlyCreating)
{
createdData[objectKind] = await _characterDataFactory.BuildCharacterData(_playerRelatedObjects[objectKind], linkedCts.Token).ConfigureAwait(false);
}

View File

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

View File

@@ -147,17 +147,18 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
return UiBlockingComputation = DataApplicationTask = Task.Run(async () =>
{
var charaName = await _dalamudUtilService.RunOnFrameworkThread(() => _dalamudUtilService.GposeTargetGameObject?.Name.TextValue).ConfigureAwait(false)
?? string.Empty;
var obj = await _dalamudUtilService.GetGposeTargetGameObjectAsync().ConfigureAwait(false);
var charaName = obj?.Name.TextValue ?? string.Empty;
if (string.IsNullOrEmpty(charaName)) return;
await ApplyCharaData(dataMetaInfoDto, charaName).ConfigureAwait(false);
});
}
public void ApplyOwnDataToGposeTarget(CharaDataFullExtendedDto dataDto)
public async Task ApplyOwnDataToGposeTarget(CharaDataFullExtendedDto dataDto)
{
var charaName = _dalamudUtilService.GposeTargetGameObject?.Name.TextValue ?? string.Empty;
var chara = await _dalamudUtilService.GetGposeTargetGameObjectAsync().ConfigureAwait(false);
var charaName = chara?.Name.TextValue ?? string.Empty;
CharaDataDownloadDto downloadDto = new(dataDto.Id, dataDto.Uploader)
{
CustomizeData = dataDto.CustomizeData,
@@ -184,7 +185,7 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
return UiBlockingComputation = Task.Run(async () =>
{
if (string.IsNullOrEmpty(pose.PoseData) || !CanApplyInGpose(out _)) return;
if (string.IsNullOrEmpty(pose.PoseData) || !(await CanApplyInGpose().ConfigureAwait(false)).CanApply) return;
var gposeChara = await _dalamudUtilService.GetGposeCharacterFromObjectTableByNameAsync(targetName, true).ConfigureAwait(false);
if (gposeChara == null) return;
@@ -199,9 +200,11 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
return UiBlockingComputation = Task.Run(async () =>
{
if (CanApplyInGpose(out var chara))
var apply = await CanApplyInGpose().ConfigureAwait(false);
if (apply.CanApply)
{
await ApplyPoseData(pose, chara).ConfigureAwait(false);
await ApplyPoseData(pose, apply.TargetName).ConfigureAwait(false);
}
});
}
@@ -210,7 +213,8 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
return UiBlockingComputation = Task.Run(async () =>
{
if (pose.WorldData == default || !CanApplyInGpose(out _)) return;
var apply = await CanApplyInGpose().ConfigureAwait(false);
if (pose.WorldData == default || !(await CanApplyInGpose().ConfigureAwait(false)).CanApply) return;
var gposeChara = await _dalamudUtilService.GetGposeCharacterFromObjectTableByNameAsync(targetName, true).ConfigureAwait(false);
if (gposeChara == null) return;
@@ -226,9 +230,10 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
return UiBlockingComputation = Task.Run(async () =>
{
if (CanApplyInGpose(out var chara))
var apply = await CanApplyInGpose().ConfigureAwait(false);
if (apply.CanApply)
{
await ApplyPoseData(pose, chara).ConfigureAwait(false);
await ApplyPoseData(pose, apply.TargetName).ConfigureAwait(false);
}
});
}
@@ -259,19 +264,21 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
});
}
public bool CanApplyInGpose(out string targetName)
public async Task<(bool CanApply, string TargetName)> CanApplyInGpose()
{
bool canApply = _dalamudUtilService.IsInGpose && _dalamudUtilService.GposeTargetGameObject != null
&& _dalamudUtilService.GposeTargetGameObject.ObjectKind == Dalamud.Game.ClientState.Objects.Enums.ObjectKind.Player;
var obj = await _dalamudUtilService.GetGposeTargetGameObjectAsync().ConfigureAwait(false);
string targetName = string.Empty;
bool canApply = _dalamudUtilService.IsInGpose && obj != null
&& obj.ObjectKind == Dalamud.Game.ClientState.Objects.Enums.ObjectKind.Player;
if (canApply)
{
targetName = _dalamudUtilService.GposeTargetGameObject!.Name.TextValue;
targetName = obj!.Name.TextValue;
}
else
{
targetName = "Invalid Target";
}
return canApply;
return (canApply, targetName);
}
public void CancelDataApplication()
@@ -503,11 +510,12 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
});
}
public void McdfApplyToGposeTarget()
public async Task McdfApplyToGposeTarget()
{
if (CanApplyInGpose(out string target))
var apply = await CanApplyInGpose().ConfigureAwait(false);
if (apply.CanApply)
{
McdfApplyToTarget(target);
McdfApplyToTarget(apply.TargetName);
}
}
@@ -733,7 +741,7 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
_dalamudUtilService.GposeTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)newActor.Address;
}
McdfApplyToGposeTarget();
await McdfApplyToGposeTarget().ConfigureAwait(false);
});
}
@@ -750,10 +758,11 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
{
UiBlockingComputation = Task.Run(async () =>
{
if (CanApplyInGpose(out var gposeTarget))
var apply = await CanApplyInGpose().ConfigureAwait(false);
if (apply.CanApply)
{
await ApplyPoseData(value, gposeTarget).ConfigureAwait(false);
await ApplyWorldDataToTarget(value, gposeTarget).ConfigureAwait(false);
await ApplyPoseData(value, apply.TargetName).ConfigureAwait(false);
await ApplyWorldDataToTarget(value, apply.TargetName).ConfigureAwait(false);
}
});
}

View File

@@ -13,6 +13,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using Lumina.Excel.Sheets;
using MareSynchronos.API.Dto.CharaData;
using MareSynchronos.Interop;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Utils;
@@ -38,6 +39,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
private readonly ILogger<DalamudUtilService> _logger;
private readonly IObjectTable _objectTable;
private readonly PerformanceCollectorService _performanceCollector;
private readonly MareConfigService _configService;
private uint? _classJobId = 0;
private DateTime _delayedFrameworkUpdateCheck = DateTime.UtcNow;
private string _lastGlobalBlockPlayer = string.Empty;
@@ -46,13 +48,12 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
private readonly Dictionary<string, (string Name, nint Address)> _playerCharas = new(StringComparer.Ordinal);
private readonly List<string> _notUpdatedCharas = [];
private bool _sentBetweenAreas = false;
private readonly Dictionary<ulong, string> _aidCache = [];
private readonly Lazy<uint> _aid;
private int _aidCounter = 0;
private Lazy<ulong> _cid;
public DalamudUtilService(ILogger<DalamudUtilService> logger, IClientState clientState, IObjectTable objectTable, IFramework framework,
IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, IGameConfig gameConfig, ISigScanner sigScanner,
BlockedCharacterHandler blockedCharacterHandler, MareMediator mediator, PerformanceCollectorService performanceCollector)
IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, IGameConfig gameConfig,
BlockedCharacterHandler blockedCharacterHandler, MareMediator mediator, PerformanceCollectorService performanceCollector,
MareConfigService configService)
{
_logger = logger;
_clientState = clientState;
@@ -65,6 +66,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
_blockedCharacterHandler = blockedCharacterHandler;
Mediator = mediator;
_performanceCollector = performanceCollector;
_configService = configService;
WorldData = new(() =>
{
return gameData.GetExcelSheet<Lumina.Excel.Sheets.World>(Dalamud.Game.ClientLanguage.English)!
@@ -120,22 +122,20 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
if (string.IsNullOrEmpty(name)) return;
var addr = _playerCharas.FirstOrDefault(f => string.Equals(f.Value.Name, name, StringComparison.Ordinal)).Value.Address;
if (addr == nint.Zero) return;
var useFocusTarget = _configService.Current.UseFocusTarget;
_ = RunOnFrameworkThread(() =>
{
if (useFocusTarget)
targetManager.FocusTarget = CreateGameObject(addr);
else
targetManager.Target = CreateGameObject(addr);
}).ConfigureAwait(false);
});
IsWine = Util.IsWine();
_cid = RebuildCID();
}
_aid = new(() =>
{
unsafe
{
var address = sigScanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 4C 8B CA");
return (uint)(address != nint.Zero ? (*(ulong**)address)[1] : 0u);
}
});
}
private Lazy<ulong> RebuildCID() => new(GetCID);
public bool IsWine { get; init; }
@@ -144,7 +144,17 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
get => TargetSystem.Instance()->GPoseTarget;
set => TargetSystem.Instance()->GPoseTarget = value;
}
public unsafe IGameObject? GposeTargetGameObject => GposeTarget == null ? null : _objectTable[GposeTarget->ObjectIndex];
private unsafe bool HasGposeTarget => GposeTarget != null;
private unsafe int GPoseTargetIdx => !HasGposeTarget ? -1 : GposeTarget->ObjectIndex;
public async Task<IGameObject?> GetGposeTargetGameObjectAsync()
{
if (!HasGposeTarget)
return null;
return await _framework.RunOnFrameworkThread(() => _objectTable[GPoseTargetIdx]).ConfigureAwait(true);
}
public bool IsAnythingDrawing { get; private set; } = false;
public bool IsInCutscene { get; private set; } = false;
public bool IsInGpose { get; private set; } = false;
@@ -159,7 +169,6 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
public Lazy<Dictionary<uint, string>> TerritoryData { get; private set; }
public Lazy<Dictionary<uint, (Map Map, string MapName)>> MapData { get; private set; }
public bool IsLodEnabled { get; private set; }
public MareMediator Mediator { get; }
public IGameObject? CreateGameObject(IntPtr reference)
@@ -298,20 +307,12 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
public async Task<string> GetPlayerNameHashedAsync()
{
return await RunOnFrameworkThread(() => _aid.Value.ToString().GetHash256()).ConfigureAwait(false);
return await RunOnFrameworkThread(() => _cid.Value.ToString().GetHash256()).ConfigureAwait(false);
}
private unsafe string GetHashedAccIdFromPlayerPointer(nint ptr)
private unsafe static string GetHashedCIDFromPlayerPointer(nint ptr)
{
if (ptr == nint.Zero) return "UNK" + _aidCounter++;
var aid = ((BattleChara*)ptr)->Character.AccountId;
if (!_aidCache.TryGetValue(aid, out string? hash))
{
var player = GetPlayerCharacter();
if (player == null) return "UNK" + _aidCounter++;
_aidCache[aid] = hash = unchecked((uint)(((((BattleChara*)player.Address)->Character.AccountId ^ aid) >> 31) ^ _aid.Value)).ToString().GetHash256();
}
return hash;
return ((BattleChara*)ptr)->Character.ContentId.ToString().GetHash256();
}
public IntPtr GetPlayerPtr()
@@ -604,7 +605,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
private unsafe void FrameworkOnUpdateInternal()
{
if (_clientState.LocalPlayer?.IsDead ?? false)
if ((_clientState.LocalPlayer?.IsDead ?? false) && _condition[ConditionFlag.BoundByDuty])
{
return;
}
@@ -632,7 +633,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
}
var charaName = ((GameObject*)chara.Address)->NameString;
var hash = GetHashedAccIdFromPlayerPointer(chara.Address);
var hash = GetHashedCIDFromPlayerPointer(chara.Address);
if (!IsAnythingDrawing)
CheckCharacterForDrawing(chara.Address, charaName);
_notUpdatedCharas.Remove(hash);
@@ -748,6 +749,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
_logger.LogDebug("Logged in");
IsLoggedIn = true;
_lastZone = _clientState.TerritoryType;
_cid = RebuildCID();
Mediator.Publish(new DalamudLoginMessage());
}
else if (localPlayer == null && IsLoggedIn)

View File

@@ -43,8 +43,8 @@ public sealed class XivDataAnalyzer
if ((nint)handle == nint.Zero) continue;
var curBones = handle->BoneCount;
// this is unrealistic, the filename shouldn't ever be that long
if (handle->ResourceHandle.FileName.Length > 1024) continue;
var skeletonName = handle->ResourceHandle.FileName.ToString();
if (handle->FileName.Length > 1024) continue;
var skeletonName = handle->FileName.ToString();
if (string.IsNullOrEmpty(skeletonName)) continue;
outputIndices[skeletonName] = new();
for (ushort boneIdx = 0; boneIdx < curBones; boneIdx++)

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.Services.CharaData.Models;
namespace MareSynchronos.UI;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Utility;
using Dalamud.Interface;
using ImGuiNET;
using MareSynchronos.API.Dto.CharaData;
using MareSynchronos.Services.CharaData.Models;
using System.Numerics;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Utility;
using Dalamud.Interface;
using ImGuiNET;
using System.Numerics;
namespace MareSynchronos.UI;

View File

@@ -1,9 +1,9 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Dto.CharaData;
using MareSynchronos.MareConfiguration;
using MareSynchronos.MareConfiguration.Models;
@@ -165,7 +165,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
UpdateFilteredFavorites();
}
_hasValidGposeTarget = _charaDataManager.CanApplyInGpose(out _gposeTarget);
(_hasValidGposeTarget, _gposeTarget) = _charaDataManager.CanApplyInGpose().GetAwaiter().GetResult();
if (!_charaDataManager.BrioAvailable)
{
@@ -383,7 +383,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
UiSharedService.AttachToolTip($"Target the GPose Character {CharaName(actor.Name.TextValue)}");
ImGui.AlignTextToFramePadding();
var pos = ImGui.GetCursorPosX();
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, actor.Address == (_dalamudUtilService.GposeTargetGameObject?.Address ?? nint.Zero)))
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, actor.Address == (_dalamudUtilService.GetGposeTargetGameObjectAsync().GetAwaiter().GetResult()?.Address ?? nint.Zero)))
{
ImGui.TextUnformatted(CharaName(actor.Name.TextValue));
}
@@ -832,7 +832,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
{
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ArrowRight, "Apply"))
{
_charaDataManager.McdfApplyToGposeTarget();
_ = _charaDataManager.McdfApplyToGposeTarget();
}
UiSharedService.AttachToolTip($"Apply to {_gposeTarget}");
ImGui.SameLine();

View File

@@ -1,9 +1,9 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.Interop.Ipc;
@@ -242,35 +242,6 @@ public class CompactUi : WindowMediatorSubscriberBase
}
}
private void DrawAddCharacter()
{
ImGuiHelpers.ScaledDummy(10f);
var keys = _serverManager.CurrentServer!.SecretKeys;
if (keys.Any())
{
if (_secretKeyIdx == -1) _secretKeyIdx = keys.First().Key;
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add current character with secret key"))
{
_serverManager.CurrentServer!.Authentications.Add(new MareConfiguration.Models.Authentication()
{
CharacterName = _uiSharedService.PlayerName,
WorldId = _uiSharedService.WorldId,
SecretKeyIdx = _secretKeyIdx
});
_serverManager.Save();
_ = _apiController.CreateConnectionsAsync();
}
_uiSharedService.DrawCombo("Secret Key##addCharacterSecretKey", keys, (f) => f.Value.FriendlyName, (f) => _secretKeyIdx = f.Key);
}
else
{
UiSharedService.ColorTextWrapped("No secret keys are configured for the current server.", ImGuiColors.DalamudYellow);
}
}
private void DrawPairs()
{
var ySize = _transferPartHeight == 0
@@ -452,21 +423,7 @@ public class CompactUi : WindowMediatorSubscriberBase
else
{
UiSharedService.ColorTextWrapped(GetServerError(), GetUidColor());
if (_apiController.ServerState is ServerState.NoSecretKey)
{
DrawAddCharacter();
}
if (_apiController.ServerState is ServerState.OAuthLoginTokenStale)
{
DrawRenewOAuth2();
}
}
}
private void DrawRenewOAuth2()
{
ImGuiHelpers.ScaledDummy(10f);
// add some text and a button to restart discord authentication
}
private IEnumerable<IDrawFolder> GetDrawFolders()
@@ -617,7 +574,7 @@ public class CompactUi : WindowMediatorSubscriberBase
"Your plugin or the server you are connecting to is out of date. Please update your plugin now. If you already did so, contact the server provider to update their server to the latest version.",
ServerState.RateLimited => "You are rate limited for (re)connecting too often. Disconnect, wait 10 minutes and try again.",
ServerState.Connected => string.Empty,
ServerState.NoSecretKey => "You have no secret key set for this current character. Use the button below or open the settings and set a secret key for the current character. You can reuse the same secret key for multiple characters.",
ServerState.NoSecretKey => "You have no secret key set for this current character. Open Settings -> Service Settings and set a secret key for the current character. You can reuse the same secret key for multiple characters.",
ServerState.MultiChara => "Your Character Configuration has multiple characters configured with same name and world. You will not be able to connect until you fix this issue. Remove the duplicates from the configuration in Settings -> Service Settings -> Character Management and reconnect manually after.",
ServerState.OAuthMisconfigured => "OAuth2 is enabled but not fully configured, verify in the Settings -> Service Settings that you have OAuth2 connected and, importantly, a UID assigned to your current character.",
ServerState.OAuthLoginTokenStale => "Your OAuth2 login token is stale and cannot be used to renew. Go to the Settings -> Service Settings and unlink then relink your OAuth2 configuration.",

View File

@@ -1,6 +1,6 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.UI.Handlers;
using System.Collections.Immutable;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.PlayerData.Pairs;

View File

@@ -1,6 +1,6 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.UI.Handlers;

View File

@@ -1,6 +1,6 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.UI.Handlers;
using System.Collections.Immutable;
using System.Numerics;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.API.Dto.User;

View File

@@ -1,5 +1,5 @@
using Dalamud.Interface;
using ImGuiNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services.Mediator;

View File

@@ -1,5 +1,5 @@
using Dalamud.Interface.Utility;
using ImGuiNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
using MareSynchronos.Services.ServerConfiguration;
using System.Numerics;

View File

@@ -1,7 +1,7 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using Microsoft.Extensions.Logging;

View File

@@ -1,5 +1,5 @@
using Dalamud.Interface.Utility;
using ImGuiNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.UI.Handlers;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.UI.Handlers;

View File

@@ -1,6 +1,6 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.Services;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.FileCache;
using MareSynchronos.Interop.Ipc;

View File

@@ -1,5 +1,5 @@
using Dalamud.Interface.Colors;
using ImGuiNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.Services;

View File

@@ -89,7 +89,7 @@ public sealed class DtrEntry : IDisposable, IHostedService
{
_logger.LogTrace("Creating new DtrBar entry");
var entry = _dtrBar.Get("Mare Synchronos");
entry.OnClick = () => _mareMediator.Publish(new UiToggleMessage(typeof(CompactUi)));
entry.OnClick = _ => _mareMediator.Publish(new UiToggleMessage(typeof(CompactUi)));
return entry;
}

View File

@@ -1,9 +1,9 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.ImGuiFileDialog;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using ImGuiNET;
using MareSynchronos.API.Data;
using MareSynchronos.API.Dto.User;
using MareSynchronos.Services;
@@ -86,14 +86,14 @@ public class EditProfileUi : WindowMediatorSubscriberBase
if (_pfpTextureWrap != null)
{
ImGui.Image(_pfpTextureWrap.ImGuiHandle, ImGuiHelpers.ScaledVector2(_pfpTextureWrap.Width, _pfpTextureWrap.Height));
ImGui.Image(_pfpTextureWrap.Handle, ImGuiHelpers.ScaledVector2(_pfpTextureWrap.Width, _pfpTextureWrap.Height));
}
var spacing = ImGui.GetStyle().ItemSpacing.X;
ImGuiHelpers.ScaledRelativeSameLine(256, spacing);
using (_uiSharedService.GameFont.Push())
{
var descriptionTextSize = ImGui.CalcTextSize(profile.Description, 256f);
var descriptionTextSize = ImGui.CalcTextSize(profile.Description, wrapWidth: 256f);
var childFrame = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 256);
if (descriptionTextSize.Y > childFrame.Y)
{
@@ -191,7 +191,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
using (_uiSharedService.GameFont.Push())
{
var descriptionTextSizeLocal = ImGui.CalcTextSize(_descriptionText, 256f);
var descriptionTextSizeLocal = ImGui.CalcTextSize(_descriptionText, wrapWidth: 256f);
var childFrameLocal = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 200);
if (descriptionTextSizeLocal.Y > childFrameLocal.Y)
{

View File

@@ -1,7 +1,7 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.Services;
using MareSynchronos.Services.Events;
using MareSynchronos.Services.Mediator;

View File

@@ -1,7 +1,6 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using ImGuiScene;
using MareSynchronos.API.Dto.Group;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Pairs;
@@ -22,7 +21,6 @@ public class IdDisplayHandler
private string _lastMouseOverUid = string.Empty;
private bool _popupShown = false;
private DateTime? _popupTime;
private TextureWrap? _textureWrap;
public IdDisplayHandler(MareMediator mediator, ServerConfigurationManager serverManager, MareConfigService mareConfigService)
{
@@ -125,8 +123,6 @@ public class IdDisplayHandler
_mediator.Publish(new ProfilePopoutToggle(Pair: null));
_lastMouseOverUid = string.Empty;
_popupShown = false;
_textureWrap?.Dispose();
_textureWrap = null;
}
}

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.FileCache;
using MareSynchronos.Localization;
using MareSynchronos.MareConfiguration;

View File

@@ -1,7 +1,7 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto;

View File

@@ -1,6 +1,6 @@
using Dalamud.Interface.Utility;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.PlayerData.Pairs;

View File

@@ -1,7 +1,7 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.MareConfiguration;
using MareSynchronos.PlayerData.Pairs;
@@ -159,12 +159,12 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
var font = _uiSharedService.GameFont.Push();
var remaining = ImGui.GetWindowContentRegionMax().Y - ImGui.GetCursorPosY();
var descText = mareProfile.Description;
var textSize = ImGui.CalcTextSize(descText, 256f * ImGuiHelpers.GlobalScale);
var textSize = ImGui.CalcTextSize(descText, wrapWidth: 256f * ImGuiHelpers.GlobalScale);
bool trimmed = textSize.Y > remaining;
while (textSize.Y > remaining && descText.Contains(' '))
{
descText = descText[..descText.LastIndexOf(' ')].TrimEnd();
textSize = ImGui.CalcTextSize(descText + $"...{Environment.NewLine}[Open Full Profile for complete description]", 256f * ImGuiHelpers.GlobalScale);
textSize = ImGui.CalcTextSize(descText + $"...{Environment.NewLine}[Open Full Profile for complete description]", wrapWidth: 256f * ImGuiHelpers.GlobalScale);
}
UiSharedService.TextWrapped(trimmed ? descText + $"...{Environment.NewLine}[Open Full Profile for complete description]" : mareProfile.Description);
font.Dispose();
@@ -176,12 +176,12 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
var newHeight = _textureWrap.Height * stretchFactor;
var remainingWidth = (256f * ImGuiHelpers.GlobalScale - newWidth) / 2f;
var remainingHeight = (256f * ImGuiHelpers.GlobalScale - newHeight) / 2f;
drawList.AddImage(_textureWrap.ImGuiHandle, new Vector2(rectMin.X + padding + remainingWidth, rectMin.Y + spacing.Y + imagePos.Y + remainingHeight),
drawList.AddImage(_textureWrap.Handle, new Vector2(rectMin.X + padding + remainingWidth, rectMin.Y + spacing.Y + imagePos.Y + remainingHeight),
new Vector2(rectMin.X + padding + remainingWidth + newWidth, rectMin.Y + spacing.Y + imagePos.Y + remainingHeight + newHeight));
if (_supporterTextureWrap != null)
{
const float iconSize = 38;
drawList.AddImage(_supporterTextureWrap.ImGuiHandle,
drawList.AddImage(_supporterTextureWrap.Handle,
new Vector2(rectMax.X - iconSize - spacing.X, rectMin.Y + (textPos / 2) - (iconSize / 2)),
new Vector2(rectMax.X - spacing.X, rectMin.Y + iconSize + (textPos / 2) - (iconSize / 2)));
}

View File

@@ -1,9 +1,9 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Comparer;
using MareSynchronos.API.Routes;
@@ -895,6 +895,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
var dtrColorsNotConnected = _configService.Current.DtrColorsNotConnected;
var dtrColorsPairsInRange = _configService.Current.DtrColorsPairsInRange;
var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible;
var useFocusTarget = _configService.Current.UseFocusTarget;
var groupUpSyncshells = _configService.Current.GroupUpSyncshells;
var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible;
var syncshellOfflineSeparate = _configService.Current.ShowSyncshellOfflineUsersSeparately;
@@ -1025,6 +1026,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled();
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))
{
Mediator.Publish(new ClearProfileDataMessage());
@@ -1729,9 +1736,15 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (useOauth)
{
_uiShared.DrawOAuth(selectedServer);
if (string.IsNullOrEmpty(_serverConfigurationManager.GetDiscordUserFromToken(selectedServer)))
{
ImGuiHelpers.ScaledDummy(10f);
UiSharedService.ColorTextWrapped("You have enabled OAuth2 but it is not linked. Press the buttons Check, then Authenticate to link properly.", ImGuiColors.DalamudRed);
}
if (!string.IsNullOrEmpty(_serverConfigurationManager.GetDiscordUserFromToken(selectedServer))
&& selectedServer.Authentications.TrueForAll(u => string.IsNullOrEmpty(u.UID)))
{
ImGuiHelpers.ScaledDummy(10f);
UiSharedService.ColorTextWrapped("You have enabled OAuth2 but no characters configured. Set the correct UIDs for your characters in \"Character Management\".",
ImGuiColors.DalamudRed);
}

View File

@@ -1,7 +1,7 @@
using Dalamud.Interface.Colors;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services;
@@ -86,7 +86,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
ImGuiHelpers.ScaledDummy(new Vector2(256, 256 + spacing.Y));
var postDummy = ImGui.GetCursorPosY();
ImGui.SameLine();
var descriptionTextSize = ImGui.CalcTextSize(mareProfile.Description, 256f);
var descriptionTextSize = ImGui.CalcTextSize(mareProfile.Description, wrapWidth: 256f);
var descriptionChildHeight = rectMax.Y - pos.Y - rectMin.Y - spacing.Y * 2;
if (descriptionTextSize.Y > descriptionChildHeight && !_adjustedForScrollBars)
{
@@ -158,12 +158,12 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
var newHeight = _textureWrap.Height * stretchFactor;
var remainingWidth = (256f * ImGuiHelpers.GlobalScale - newWidth) / 2f;
var remainingHeight = (256f * ImGuiHelpers.GlobalScale - newHeight) / 2f;
drawList.AddImage(_textureWrap.ImGuiHandle, new Vector2(rectMin.X + padding + remainingWidth, rectMin.Y + spacing.Y + pos.Y + remainingHeight),
drawList.AddImage(_textureWrap.Handle, new Vector2(rectMin.X + padding + remainingWidth, rectMin.Y + spacing.Y + pos.Y + remainingHeight),
new Vector2(rectMin.X + padding + remainingWidth + newWidth, rectMin.Y + spacing.Y + pos.Y + remainingHeight + newHeight));
if (_supporterTextureWrap != null)
{
const float iconSize = 38;
drawList.AddImage(_supporterTextureWrap.ImGuiHandle,
drawList.AddImage(_supporterTextureWrap.Handle,
new Vector2(rectMax.X - iconSize - spacing.X, rectMin.Y + (textPos / 2) - (iconSize / 2)),
new Vector2(rectMax.X - spacing.X, rectMin.Y + iconSize + (textPos / 2) - (iconSize / 2)));
}

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using ImGuiNET;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.API.Dto.Group;

View File

@@ -1,8 +1,8 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Enum;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.PlayerData.Pairs;

View File

@@ -1,4 +1,5 @@
using Dalamud.Interface;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.GameFonts;
using Dalamud.Interface.ImGuiFileDialog;
@@ -9,7 +10,6 @@ using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.FileCache;
using MareSynchronos.Interop.Ipc;
using MareSynchronos.Localization;
@@ -231,7 +231,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
public static void DrawGroupedCenteredColorText(string text, Vector4 color, float? maxWidth = null)
{
var availWidth = ImGui.GetContentRegionAvail().X;
var textWidth = ImGui.CalcTextSize(text, availWidth).X;
var textWidth = ImGui.CalcTextSize(text, wrapWidth: availWidth).X;
if (maxWidth != null && textWidth > maxWidth * ImGuiHelpers.GlobalScale) textWidth = maxWidth.Value * ImGuiHelpers.GlobalScale;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (availWidth / 2f) - (textWidth / 2f));
DrawGrouped(() =>
@@ -982,7 +982,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
}
if (string.IsNullOrEmpty(selectedServer.OAuthToken) || tokenExpiry < DateTime.UtcNow)
{
ColorTextWrapped("You have no OAuth token or the OAuth token is expired. Please use the Service Settings to (re)link your OAuth account.", ImGuiColors.DalamudRed);
ColorTextWrapped("You have no OAuth token or the OAuth token is expired. Please use the Service Configuration to link your OAuth2 account or refresh the token.", ImGuiColors.DalamudRed);
}
}

View File

@@ -4,9 +4,9 @@
"net9.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[12.0.0, )",
"resolved": "12.0.0",
"contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
"requested": "[13.0.0, )",
"resolved": "13.0.0",
"contentHash": "Mb3cUDSK/vDPQ8gQIeuCw03EMYrej1B4J44a1AvIJ9C759p9XeqdU9Hg4WgOmlnlPe0G7ILTD32PKSUpkQNa8w=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",