feat: add achievement links

This commit is contained in:
Anna
2022-02-03 19:19:27 -05:00
parent 077053f4e1
commit d0c3cbc2ab
4 changed files with 41 additions and 0 deletions
+14
View File
@@ -29,6 +29,9 @@ internal unsafe class GameFunctions : IDisposable {
[Signature("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9", Fallibility = Fallibility.Fallible)]
private readonly delegate* unmanaged<AgentInterface*, ulong, byte> _openPartyFinder = null!;
[Signature("E8 ?? ?? ?? ?? EB 42 48 8B 47 30", Fallibility = Fallibility.Fallible)]
private readonly delegate* unmanaged<AgentInterface*, uint, void> _openAchievement = null!;
#endregion
#region Hooks
@@ -240,6 +243,17 @@ internal unsafe class GameFunctions : IDisposable {
}
}
internal void OpenAchievement(uint id) {
if (this._openAchievement == null) {
return;
}
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Achievement);
if (agent != null) {
this._openAchievement(agent, id);
}
}
private readonly IntPtr _placeholderNamePtr = Marshal.AllocHGlobal(128);
private readonly string _placeholder = $"<{Guid.NewGuid():N}>";
private string? _replacementName;