api11 changes

This commit is contained in:
Stanley Dimant
2024-11-16 01:23:00 +01:00
parent 1b83e7b361
commit 514d254386
4 changed files with 17 additions and 33 deletions

View File

@@ -1,5 +1,4 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.UI.Info;
using Microsoft.Extensions.Logging;
@@ -11,19 +10,8 @@ public unsafe class BlockedCharacterHandler
private sealed record CharaData(ulong AccId, ulong ContentId);
private readonly Dictionary<CharaData, bool> _blockedCharacterCache = new();
private enum BlockResultType
{
NotBlocked = 1,
BlockedByAccountId = 2,
BlockedByContentId = 3,
}
[Signature("48 83 EC 48 F6 81 ?? ?? ?? ?? ?? 75 ?? 33 C0 48 83 C4 48")]
private readonly GetBlockResultTypeDelegate? _getBlockResultType = null;
private readonly ILogger<BlockedCharacterHandler> _logger;
private unsafe delegate BlockResultType GetBlockResultTypeDelegate(InfoProxyBlacklist* thisPtr, ulong accountId, ulong contentId);
public BlockedCharacterHandler(ILogger<BlockedCharacterHandler> logger, IGameInteropProvider gameInteropProvider)
{
gameInteropProvider.InitializeFromAttributes(this);
@@ -44,13 +32,9 @@ public unsafe class BlockedCharacterHandler
if (_blockedCharacterCache.TryGetValue(combined, out var isBlocked))
return isBlocked;
if (_getBlockResultType == null)
return _blockedCharacterCache[combined] = false;
firstTime = true;
var infoProxy = InfoProxyBlacklist.Instance();
var blockStatus = _getBlockResultType(infoProxy, combined.AccId, combined.ContentId);
var blockStatus = InfoProxyBlacklist.Instance()->GetBlockResultType(combined.AccId, combined.ContentId);
_logger.LogTrace("CharaPtr {ptr} is BlockStatus: {status}", ptr, blockStatus);
return _blockedCharacterCache[combined] = blockStatus != BlockResultType.NotBlocked;
return _blockedCharacterCache[combined] = blockStatus != InfoProxyBlacklist.BlockResultType.NotBlocked;
}
}