Skip to content

Commit 68eed40

Browse files
authored
Merge pull request #94 from nt153133/scribe/document-remote-agents-17785156986049334752
📝 Scribe: Add XML documentation for RemoteAgents (DawnStory, HWDScore, Meld)
2 parents 0bf82f7 + 70ff30e commit 68eed40

3 files changed

Lines changed: 102 additions & 7 deletions

File tree

RemoteAgents/AgentDawnStory.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,23 @@
77

88
namespace LlamaLibrary.RemoteAgents
99
{
10+
/// <summary>
11+
/// Remote agent for the "Dawn Story" (Duty Support Story Mode) interface.
12+
/// Manages the list of available duties and the selection of a specific duty for story progression.
13+
/// </summary>
1014
public class AgentDawnStory : AgentInterface<AgentDawnStory>, IAgent
1115
{
16+
/// <inheritdoc/>
1217
public IntPtr RegisteredVtable => AgentDawnStoryOffsets.Vtable;
1318

14-
15-
19+
/// <summary>
20+
/// Gets a value indicating whether the duty list has been successfully loaded from the game's data.
21+
/// </summary>
1622
public bool IsLoaded => Core.Memory.Read<byte>(Pointer + AgentDawnStoryOffsets.Loaded) != 0;
1723

24+
/// <summary>
25+
/// Gets the memory pointer to the beginning of the duty information array.
26+
/// </summary>
1827
public IntPtr DutyArrayPtr
1928
{
2029
get
@@ -25,12 +34,22 @@ public IntPtr DutyArrayPtr
2534
}
2635
}
2736

37+
/// <summary>
38+
/// Gets an array of <see cref="DutyInfo"/> structures representing the duties available in the story mode.
39+
/// </summary>
2840
public DutyInfo[] Duties => Core.Memory.ReadArray<DutyInfo>(DutyArrayPtr, AgentDawnStoryOffsets.DutyCount);
2941

42+
/// <summary>
43+
/// Initializes a new instance of the <see cref="AgentDawnStory"/> class.
44+
/// </summary>
45+
/// <param name="pointer">The memory address of the agent.</param>
3046
protected AgentDawnStory(IntPtr pointer) : base(pointer)
3147
{
3248
}
3349

50+
/// <summary>
51+
/// Gets the index of the currently selected duty in the interface.
52+
/// </summary>
3453
public byte SelectedDuty => Core.Memory.Read<byte>(Pointer + 0x28);
3554
}
3655
}

RemoteAgents/AgentHWDScore.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@
66

77
namespace LlamaLibrary.RemoteAgents
88
{
9+
/// <summary>
10+
/// Remote agent for the Ishgardian Restoration (Holy Works of Development) score tracking.
11+
/// Manages the display of rankings and total scores for the various crafting and gathering classes.
12+
/// </summary>
913
//TODO This agent has hardcoded memory offsets
1014
public class AgentHWDScore : AgentInterface<AgentHWDScore>, IAgent
1115
{
16+
/// <inheritdoc/>
1217
public IntPtr RegisteredVtable => AgentHWDScoreOffsets.VTable;
1318

14-
15-
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="AgentHWDScore"/> class.
21+
/// </summary>
22+
/// <param name="pointer">The memory address of the agent.</param>
1623
protected AgentHWDScore(IntPtr pointer) : base(pointer)
1724
{
1825
}
1926

27+
/// <summary>
28+
/// Reads the total scores for the 11 crafting and gathering classes from game memory.
29+
/// </summary>
30+
/// <returns>An array of 11 integers representing the scores for each class.</returns>
2031
public int[] ReadTotalScores()
2132
{
2233
return Core.Memory.ReadArray<int>(Pointer + 0x90, 11);

RemoteAgents/AgentMeld.cs

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,97 +11,160 @@
1111

1212
namespace LlamaLibrary.RemoteAgents
1313
{
14+
/// <summary>
15+
/// Remote agent for the Materia Melding interface.
16+
/// Manages the process of affixing materia to equipment, including tracking eligible items and current materia status.
17+
/// </summary>
1418
public class AgentMeld : AgentInterface<AgentMeld>, IAgent
1519
{
20+
/// <inheritdoc/>
1621
public IntPtr RegisteredVtable => AgentMeldOffsets.VTable;
1722

18-
19-
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="AgentMeld"/> class.
25+
/// </summary>
26+
/// <param name="pointer">The memory address of the agent.</param>
2027
protected AgentMeld(IntPtr pointer) : base(pointer)
2128
{
2229
}
2330

31+
/// <summary>
32+
/// Gets a value indicating whether the player is currently able to meld (e.g., has the required level/quest).
33+
/// </summary>
2434
public bool CanMeld => Core.Memory.NoCacheRead<byte>(Pointer + AgentMeldOffsets.CanMeld) == 1;
2535

36+
/// <summary>
37+
/// Gets a value indicating whether the meld interface is ready for the next action.
38+
/// </summary>
2639
public bool Ready => Core.Memory.NoCacheRead<byte>(Offsets.Conditions + 7) == 0;
2740

41+
/// <summary>
42+
/// Gets the total number of items eligible for melding in the currently selected inventory category.
43+
/// </summary>
2844
public byte ItemsToMeldCount => Core.Memory.NoCacheRead<byte>(Pointer + AgentMeldOffsets.ItemsToMeldCount);
2945

46+
/// <summary>
47+
/// Gets the index of the currently selected item within the melding list.
48+
/// </summary>
3049
public byte IndexOfSelectedItem => Core.Memory.NoCacheRead<byte>(Pointer + AgentMeldOffsets.IndexOfSelectedItem);
3150

51+
/// <summary>
52+
/// Gets the number of materia pieces affixed to the currently selected item.
53+
/// </summary>
3254
public byte MateriaCount => Core.Memory.NoCacheRead<byte>(Pointer + AgentMeldOffsets.MateriaCount);
3355

56+
/// <summary>
57+
/// Gets the memory pointer to the start of the melding data structure.
58+
/// </summary>
3459
public IntPtr StructStart => Core.Memory.Read<IntPtr>(Pointer + AgentMeldOffsets.StructStart);
3560

61+
/// <summary>
62+
/// Gets the memory pointer to the list of items available for melding.
63+
/// </summary>
3664
public IntPtr ListPtr => Core.Memory.Read<IntPtr>(StructStart + AgentMeldOffsets.ListPtr);
3765

66+
/// <summary>
67+
/// Gets an array of memory pointers to the individual items in the melding list.
68+
/// </summary>
3869
public IntPtr[] MeldList => Core.Memory.ReadArray<IntPtr>(ListPtr, ItemsToMeldCount).Select(i => Core.Memory.Read<IntPtr>(i)).ToArray();
3970

71+
/// <summary>
72+
/// Gets an array of <see cref="MeldItem"/> structures for all items currently in the melding list.
73+
/// </summary>
4074
public MeldItem[] MeldItems => MeldList.Select(i => Core.Memory.Read<MeldItem>(i)).ToArray();
4175

76+
/// <summary>
77+
/// Gets the identifier for the currently selected inventory category (e.g., Equipment, Armoury Chest).
78+
/// </summary>
4279
public byte SelectedCategory => Core.Memory.NoCacheRead<byte>(Pointer + AgentMeldOffsets.SelectedCategory);
4380

81+
/// <summary>
82+
/// Finds the index of a specific <see cref="BagSlot"/> within the melding list.
83+
/// </summary>
84+
/// <param name="slot">The bag slot to find.</param>
85+
/// <returns>The zero-based index of the item, or -1 if not found.</returns>
4486
public int ItemIndex(BagSlot slot)
4587
{
4688
return MeldItems.ToList().FindIndex(i => i.BagId == slot.BagId && i.BagSlot == slot.Slot);
4789
}
4890
}
4991
}
5092

93+
/// <summary>
94+
/// Represents an item and its current materia state within the melding interface.
95+
/// </summary>
5196
[StructLayout(LayoutKind.Explicit, Size = 0x48)]
5297
public struct MeldItem
5398
{
99+
/// <summary>The memory address of this item's data.</summary>
54100
[FieldOffset(0x0)]
55101
public IntPtr Pointer;
56102

103+
/// <summary>The inventory bag containing this item.</summary>
57104
[FieldOffset(0x8)]
58105
public InventoryBagId BagId;
59106

107+
/// <summary>The slot index within the inventory bag.</summary>
60108
[FieldOffset(0xC)]
61109
public ushort BagSlot;
62110

111+
/// <summary>The unique item identifier.</summary>
63112
[FieldOffset(0x10)]
64113
public uint ItemId;
65114

66115
[FieldOffset(0x1C)]
67116
private byte _CanOvermeld;
68117

118+
/// <summary>Gets a value indicating whether this item can have more materia affixed than it has slots for (Advanced Melding).</summary>
69119
public bool CanOvermeld => _CanOvermeld == 1;
70120

121+
/// <summary>The type identifier for the first materia slot.</summary>
71122
[FieldOffset(0x28)]
72123
public ushort MateriaType1;
73124

125+
/// <summary>The type identifier for the second materia slot.</summary>
74126
[FieldOffset(0x2A)]
75127
public ushort MateriaType2;
76128

129+
/// <summary>The type identifier for the third materia slot.</summary>
77130
[FieldOffset(0x2C)]
78131
public ushort MateriaType3;
79132

133+
/// <summary>The type identifier for the fourth materia slot.</summary>
80134
[FieldOffset(0x2E)]
81135
public ushort MateriaType4;
82136

137+
/// <summary>The type identifier for the fifth materia slot.</summary>
83138
[FieldOffset(0x30)]
84139
public ushort MateriaType5;
85140

141+
/// <summary>The grade (tier) of the materia in the first slot.</summary>
86142
[FieldOffset(0x32)]
87143
public byte MateriaGrade1;
88144

145+
/// <summary>The grade (tier) of the materia in the second slot.</summary>
89146
[FieldOffset(0x33)]
90147
public byte MateriaGrade2;
91148

149+
/// <summary>The grade (tier) of the materia in the third slot.</summary>
92150
[FieldOffset(0x34)]
93151
public byte MateriaGrade3;
94152

153+
/// <summary>The grade (tier) of the materia in the fourth slot.</summary>
95154
[FieldOffset(0x35)]
96155
public byte MateriaGrade4;
97156

157+
/// <summary>The grade (tier) of the materia in the fifth slot.</summary>
98158
[FieldOffset(0x36)]
99159
public byte MateriaGrade5;
100160

161+
/// <summary>Gets the item metadata from the game's data manager.</summary>
101162
public Item? Item => DataManager.GetItem(ItemId);
102163

164+
/// <summary>Gets the total number of materia pieces currently affixed to this item.</summary>
103165
public int MateriaCount => new[] { MateriaType1, MateriaType2, MateriaType3, MateriaType4, MateriaType5 }.Count(i => i != 0);
104166

167+
/// <summary>Gets an array of <see cref="MateriaItem"/> objects representing the materia currently affixed to this item.</summary>
105168
public MateriaItem[] Materia
106169
{
107170
get
@@ -118,9 +181,11 @@ public MateriaItem[] Materia
118181
}
119182
}
120183

184+
/// <summary>Gets a value indicating whether more materia can be affixed to this item.</summary>
121185
public bool CanMeld => CanOvermeld ? MateriaCount < 5 : Item?.MateriaSlots > MateriaCount;
122186

123-
//ToString() method
187+
/// <summary>Returns a string representation of the item and its materia state.</summary>
188+
/// <returns>A string containing the item name, materia count, and details of each affixed materia.</returns>
124189
public override string ToString()
125190
{
126191
return $"{Item?.CurrentLocaleName} {MateriaCount} {CanMeld} {string.Join(',', Materia.Select(i => i.ToString()))}";

0 commit comments

Comments
 (0)