Code:
[StructLayout(LayoutKind.Sequential)] internal struct KnownSpell
{
public uint KnownType;
public int SpellId;
public uint Level;
public uint Unk_TabType;
public byte Unk1;
public byte Unk2;
public override string ToString()
{
return string.Format("KnownType: {0}, SpellId: {1}, Level: {2}, UnkTabType: {3}, Unk1: {4}, Unk2: {5}",
KnownType, SpellId, Level, Unk_TabType, Unk1, Unk2);
}
}
Code:
public static IEnumerable<int> GetKnownSpells()
{
var numSpells = memory.Read<int>(LocalPlayerNumKnownSpells);
var spellBookInfoPtr = memory.Read<IntPtr>(LocalPlayerKnownSpells);
for (int i = numSpells - 1; i >= 0; i--)
{
var spellPtr = memory.Read<IntPtr>(spellBookInfoPtr + (i * 4));
var info = memory.Read<LocalPlayer.KnownSpell>(spellPtr);
if (info.KnownType == 1 && info.Unk2 == 0)
yield return info.SpellId;
}
}
Minor edits. But there you go.
KnownType hasn't changed. (Check Ryuk's post)