mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 22:17:22 +01:00
simplify get ids
This commit is contained in:
parent
c671003bac
commit
f6df371339
1 changed files with 5 additions and 10 deletions
|
|
@ -29,21 +29,16 @@ public unsafe class BlockedCharacterHandler
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ulong GetAccIdFromPlayerPointer(nint ptr)
|
private static (ulong AccId, ulong ContentId) GetIdsFromPlayerPointer(nint ptr)
|
||||||
{
|
{
|
||||||
if (ptr == nint.Zero) return 0;
|
if (ptr == nint.Zero) return (0, 0);
|
||||||
return ((BattleChara*)ptr)->Character.AccountId;
|
var castChar = ((BattleChara*)ptr);
|
||||||
}
|
return (castChar->Character.AccountId, castChar->Character.ContentId);
|
||||||
|
|
||||||
private static ulong GetContentIdFromPlayerPointer(nint ptr)
|
|
||||||
{
|
|
||||||
if (ptr == nint.Zero) return 0;
|
|
||||||
return ((BattleChara*)ptr)->Character.ContentId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCharacterBlocked(nint ptr)
|
public bool IsCharacterBlocked(nint ptr)
|
||||||
{
|
{
|
||||||
(ulong AccId, ulong ContentId) combined = (GetAccIdFromPlayerPointer(ptr), GetContentIdFromPlayerPointer(ptr));
|
var combined = GetIdsFromPlayerPointer(ptr);
|
||||||
if (_blockedCharacterCache.TryGetValue(combined, out var isBlocked))
|
if (_blockedCharacterCache.TryGetValue(combined, out var isBlocked))
|
||||||
return isBlocked;
|
return isBlocked;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue