mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-15 15:19:57 +00:00
@@ -12,6 +12,16 @@ public readonly unsafe struct GuildWarsArray<T> : IEnumerable<T>
|
||||
public readonly uint Size;
|
||||
public readonly uint Param;
|
||||
|
||||
public T this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(index);
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual((uint)index, this.Size);
|
||||
return this.Buffer[index];
|
||||
}
|
||||
}
|
||||
|
||||
public Enumerator GetEnumerator() => new(this.Buffer, this.Size);
|
||||
|
||||
IEnumerator<T> IEnumerable<T>.GetEnumerator() => this.GetEnumerator();
|
||||
|
||||
@@ -9,7 +9,7 @@ public enum PlayerContextFlags : uint
|
||||
PvP = 0x800
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 0x4C)]
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 0x50)]
|
||||
public readonly unsafe struct PlayerContext
|
||||
{
|
||||
[FieldOffset(0x0000)]
|
||||
@@ -37,8 +37,11 @@ public readonly unsafe struct PlayerContext
|
||||
public readonly uint ActiveTitleTier;
|
||||
|
||||
[FieldOffset(0x0034)]
|
||||
public readonly uint PlayerNumber;
|
||||
public readonly uint ReforgedOrDhuumsFlags;
|
||||
|
||||
[FieldOffset(0x0038)]
|
||||
public readonly uint PlayerNumber;
|
||||
|
||||
[FieldOffset(0x003C)]
|
||||
public readonly uint PartySize;
|
||||
}
|
||||
|
||||
@@ -11,16 +11,24 @@ public enum TitleProps : uint
|
||||
// Note: The HasTiers check uses (props & 3) == 2, which means bit 1 is set but bit 0 is not
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 40)]
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 0x2C)]
|
||||
public readonly struct TitleContext
|
||||
{
|
||||
[FieldOffset(0x0000)]
|
||||
public readonly TitleProps Props;
|
||||
[FieldOffset(0x0004)]
|
||||
public readonly uint CurrentPoints;
|
||||
[FieldOffset(0x0008)]
|
||||
public readonly uint CurrentTitleTierIndex;
|
||||
[FieldOffset(0x000C)]
|
||||
public readonly uint PointsNeededForCurrentRank;
|
||||
[FieldOffset(0x0014)]
|
||||
public readonly uint NextTitleTierIndex;
|
||||
[FieldOffset(0x0018)]
|
||||
public readonly uint PointsNeededForNextRank;
|
||||
[FieldOffset(0x001C)]
|
||||
public readonly uint MaxTitleRank;
|
||||
[FieldOffset(0x0020)]
|
||||
public readonly uint MaxTitleTierIndex;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public sealed class GameThreadService
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate void LeaveGameThread(nint ctx);
|
||||
private delegate void LeaveGameThread(nint arg1, nint arg2);
|
||||
|
||||
private readonly MemoryScanningService memoryScanningService;
|
||||
private readonly GWHook<LeaveGameThread> leaveGameThreadHook;
|
||||
@@ -103,7 +103,7 @@ public sealed class GameThreadService
|
||||
scopedLogger.LogInformation("Hooks initialized");
|
||||
}
|
||||
|
||||
private void OnLeaveGameThread(nint ctx)
|
||||
private void OnLeaveGameThread(nint arg1, nint arg2)
|
||||
{
|
||||
var scopedLogger = this.logger.CreateScopedLogger();
|
||||
while(this.queuedItems.TryDequeue(out var item))
|
||||
@@ -137,6 +137,6 @@ public sealed class GameThreadService
|
||||
}
|
||||
}
|
||||
|
||||
this.leaveGameThreadHook.Continue(ctx);
|
||||
this.leaveGameThreadHook.Continue(arg1, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,19 +392,15 @@ public sealed class MainPlayerService : IDisposable
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!gameContext.TryGetPlayerId(out var playerId))
|
||||
var playerIndex = gameContext.Pointer->CharContext->PlayerNumber;
|
||||
var players = gameContext.Pointer->WorldContext->Players;
|
||||
if (playerIndex < 0 || playerIndex >= players.Size)
|
||||
{
|
||||
scopedLogger.LogError("Failed to get player id");
|
||||
return default;
|
||||
}
|
||||
|
||||
var player = gameContext.Pointer->WorldContext->Players.AsValueEnumerable().FirstOrDefault(p => p.AgentId == playerId);
|
||||
if (player.AgentId != playerId)
|
||||
{
|
||||
scopedLogger.LogError("Failed to find player with id {playerId}", playerId);
|
||||
scopedLogger.LogError("Failed to get player id. Got {playerNumber}", playerIndex);
|
||||
return default;
|
||||
}
|
||||
|
||||
var player = gameContext.Pointer->WorldContext->Players[(int)playerIndex];
|
||||
var currentTier = player.ActiveTitleTier;
|
||||
TitleContext? currentTitle = default;
|
||||
int? id = -1;
|
||||
|
||||
@@ -653,6 +653,7 @@ public sealed class Map : IWikiEntity
|
||||
public static readonly Map TheElusiveGolemancerMission = new() { Id = 769, Name = "The Elusive Golemancer Mission", WikiUrl = "https://wiki.guildwars.com/wiki/The_Elusive_Golemancer" };
|
||||
public static readonly Map SecretLairOftheSnowmen2 = new() { Id = 770, Name = "Secret Lair of the Snowmen2", WikiUrl = "https://wiki.guildwars.com/wiki/Secret_Lair_of_the_Snowmen" };
|
||||
public static readonly Map SecretLairOftheSnowmen3 = new() { Id = 782, Name = "Secret Lair of the Snowmen3", WikiUrl = "https://wiki.guildwars.com/wiki/Secret_Lair_of_the_Snowmen" };
|
||||
public static readonly Map PikenSquarePreSearingOutpost = new() { Id = 779, Name = "Piken Square", WikiUrl = "https://wiki.guildwars.com/wiki/Piken_Square_(pre-Searing)" };
|
||||
public static readonly Map DroknarsForgeCinematic = new() { Id = 783, Name = "Droknars Forge (cinematic)", WikiUrl = "https://wiki.guildwars.com/wiki/Droknar's_Forge" };
|
||||
public static readonly Map IsleOfTheNamelessPvP = new() { Id = 784, Name = "Isle of the Nameless PvP", WikiUrl = "https://wiki.guildwars.com/wiki/Isle_of_the_Nameless_(PvP)" };
|
||||
public static readonly Map TempleOfTheAgesROX = new() { Id = 785, Name = "Temple of the Ages ROX", WikiUrl = "https://wiki.guildwars.com/wiki/Deactivating_R.O.X." };
|
||||
@@ -1357,6 +1358,7 @@ public sealed class Map : IWikiEntity
|
||||
TheElusiveGolemancerMission,
|
||||
SecretLairOftheSnowmen2,
|
||||
SecretLairOftheSnowmen3,
|
||||
PikenSquarePreSearingOutpost,
|
||||
DroknarsForgeCinematic,
|
||||
IsleOfTheNamelessPvP,
|
||||
TempleOfTheAgesROX,
|
||||
|
||||
Reference in New Issue
Block a user