Skip to content

Commit

Permalink
refactor: use CS blocklist funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Blooym committed Nov 5, 2024
1 parent c5b51c5 commit bb42d15
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions Wholist/Game/BlockedCharacterHandler.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
using System;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.UI.Info;
using Wholist.Common;

namespace Wholist.Game
{
public sealed unsafe class BlockedCharacterHandler
{
[Signature("48 83 EC 48 F6 81 ?? ?? ?? ?? ?? 75 ?? 33 C0 48 83 C4 48")]
private readonly GetBlockResultTypeDelegate? getBlockResultType = null!;
private delegate BlockResultType GetBlockResultTypeDelegate(InfoProxyBlacklist* thisPtr, ulong accountId, ulong contentId);

private enum BlockResultType
{
NotBlocked = 1,
BlockedByAccountId = 2,
BlockedByContentId = 3,
}

public BlockedCharacterHandler() => Services.GameInteropProvider.InitializeFromAttributes(this);

/// <summary>
/// Whether a character or service account has been blocked by the local player.
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
public bool IsCharacterBlocked(BattleChara* chara)
{
if (this.getBlockResultType == null)
{
throw new InvalidOperationException("GetBlockResultType signature wasn't found!");
}

var infoProxyBlacklist = InfoProxyBlacklist.Instance();
return this.getBlockResultType(infoProxyBlacklist, chara->Character.AccountId, chara->Character.ContentId) != BlockResultType.NotBlocked;
return InfoProxyBlacklist.Instance()->GetBlockResultType(chara->Character.AccountId, chara->Character.ContentId) != InfoProxyBlacklist.BlockResultType.NotBlocked;

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Release, release)

'InfoProxyBlacklist' does not contain a definition for 'GetBlockResultType' and no accessible extension method 'GetBlockResultType' accepting a first argument of type 'InfoProxyBlacklist' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Release, release)

'InfoProxyBlacklist' does not contain a definition for 'BlockResultType'

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Release, release)

'InfoProxyBlacklist' does not contain a definition for 'GetBlockResultType' and no accessible extension method 'GetBlockResultType' accepting a first argument of type 'InfoProxyBlacklist' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Release, release)

'InfoProxyBlacklist' does not contain a definition for 'BlockResultType'

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Debug, release)

'InfoProxyBlacklist' does not contain a definition for 'GetBlockResultType' and no accessible extension method 'GetBlockResultType' accepting a first argument of type 'InfoProxyBlacklist' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Debug, release)

'InfoProxyBlacklist' does not contain a definition for 'BlockResultType'

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Debug, release)

'InfoProxyBlacklist' does not contain a definition for 'GetBlockResultType' and no accessible extension method 'GetBlockResultType' accepting a first argument of type 'InfoProxyBlacklist' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in Wholist/Game/BlockedCharacterHandler.cs

View workflow job for this annotation

GitHub Actions / Build (Debug, release)

'InfoProxyBlacklist' does not contain a definition for 'BlockResultType'
}
}
}

0 comments on commit bb42d15

Please sign in to comment.