Skip to content

Commit 5d62cb6

Browse files
committed
Adding extra functionality to AgentAchievement
1 parent a328c12 commit 5d62cb6

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

RemoteAgents/AgentAchievement.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
using System;
2+
using System.Collections.Generic;
23
using ff14bot;
34
using ff14bot.Managers;
4-
using LlamaLibrary.Memory.Attributes;
55
using LlamaLibrary.Memory;
66

77
namespace LlamaLibrary.RemoteAgents
88
{
99
public class AgentAchievement : AgentInterface<AgentAchievement>, IAgent
1010
{
1111
public IntPtr RegisteredVtable => AgentAchievementOffsets.VTable;
12-
1312

1413
protected AgentAchievement(IntPtr pointer) : base(pointer)
1514
{
1615
}
1716

1817
public byte Status => Core.Memory.NoCacheRead<byte>(Pointer + AgentAchievementOffsets.Status);
18+
19+
private static readonly Dictionary<string, int> VFunctionIds = new()
20+
{
21+
{ "Show", 3 },
22+
{ "Hide", 5 },
23+
{ "IsAgentActive", 6 },
24+
{ "GetAddonId", 9 },
25+
};
26+
27+
private bool IsAgentActive => Core.Memory.CallInjected64<byte>(VFunctionAddress("IsAgentActive"), Pointer) == 1;
28+
29+
public bool IsOpen => IsAgentActive;
30+
31+
private IntPtr VFunctionAddress(string function)
32+
{
33+
var index = VFunctionIds[function];
34+
35+
return Core.Memory.Read<IntPtr>(Core.Memory.Read<IntPtr>(Pointer) + 0x8 * index);
36+
}
37+
38+
1939
}
2040
}

0 commit comments

Comments
 (0)