I'm assuming the MaxRock funcs is the windows port of acaos' linux plugin, so I'm not sure if you have access to all the functionality of the linux version, but if you do, you definitely do not need to record slots on rest. Here's our listing mechanism from our chat command, by way of example:
string ListSpellsMemorized (object oTarget, object oPC, int nclass=-1, int nLevel=-1) {
string sMessage = "";
if (nclass < 0) {
if (GetLevelByclass(class_TYPE_ASSASSIN, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_ASSASSIN, -1) + "\\n";
if (GetLevelByclass(class_TYPE_BLACKGUARD, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_BLACKGUARD, -1) + "\\n";
if (GetLevelByclass(class_TYPE_CLERIC, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_CLERIC, -1) + "\\n";
if (GetLevelByclass(class_TYPE_DRUID, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_DRUID, -1) + "\\n";
if (GetLevelByclass(class_TYPE_PALADIN, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_PALADIN, -1) + "\\n";
if (GetLevelByclass(class_TYPE_RANGER, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_RANGER, -1) + "\\n";
if (GetLevelByclass(class_TYPE_WIZARD, oTarget) > 0)
sMessage += ListSpellsMemorized(oTarget, oPC, class_TYPE_WIZARD, -1) + "\\n";
if (oTarget == oPC)
sMessage = COLOR_WHITE + "Your memorized spells:\\n" + sMessage;
else
sMessage = COLOR_WHITE + "Memorized spells for " + GetName(oTarget) + ":\\n" + sMessage;
SendChatLogMessage(oPC, sMessage + COLOR_END, oPC, 5);
return "";
}
if (nLevel < 0) {
int i, nMax = GetclassSpellLevels(nclass, TRUE);
for (i = (nMax > 4 ? 0 : 1); i <= nMax; i++)
sMessage += ListSpellsMemorized(oTarget, oPC, nclass, i);
return sMessage;
}
string sSpell, sLeft, sTotal, sServer = GetLocalString(GetModule(), "ServerNumber");
SQLExecDirect("DELETE FROM sort_" + sServer);
string sSQL = "INSERT INTO sort_" + sServer + " VALUES (?, ?)";
sMessage = COLOR_ORANGE + GetclassTypeName(nclass) + " level " + IntToString(nLevel) + ":\\n";
int i, nSpells = GetMaxSpellSlots(oTarget, nclass, nLevel);
struct MemorizedSpellSlot mss;
for (i = 0; i < nSpells; i++) {
mss = GetMemorizedSpell(oTarget, nclass, nLevel, i);
if (mss.id < 0)
sSpell = "(empty)";
else
sSpell = SFGetSpellName(mss.id);
if (mss.meta != 0) {
switch (mss.meta) {
case METAMAGIC_EMPOWER: sSpell = "[Empower] " + sSpell; break;
case METAMAGIC_EXTEND: sSpell = "[Extend] " + sSpell; break;
case METAMAGIC_MAXIMIZE: sSpell = "[Maximize] " + sSpell; break;
case METAMAGIC_QUICKEN: sSpell = "[Quicken] " + sSpell; break;
case METAMAGIC_SILENT: sSpell = "[Silent] " + sSpell; break;
case METAMAGIC_STILL: sSpell = "[Still] " + sSpell; break;
}
}
SQLExecStatement(sSQL, sSpell, IntToString(mss.ready));
}
SQLExecDirect("SELECT sort_key, SUM(sort_val), COUNT(*) FROM sort_" + sServer + " GROUP BY sort_key ORDER BY sort_key");
while (SQLFetch() != SQL_ERROR) {
sSpell = SQLDecodeSpecialChars(SQLGetData(1));
sLeft = SQLGetData(2);
sTotal = SQLGetData(3);
if (GetSubString(sSpell, 0, 1) == "[")
sMessage += COLOR_GOLD + " ";
else
sMessage += COLOR_LT_YELLOW + " ";
sMessage += sSpell + " " + COLOR_WHITE + " [" + sLeft + "/" + sTotal + "]\\n";
}
return sMessage;
}
The core functionality for looping memorized spells is in this loop:
for (i = 0; i < nSpells; i++) {
mss = GetMemorizedSpell(oTarget, nclass, nLevel, i);
Here's the chunk of functions the plugin in questoin has relating to spells, by way of comparison. The only one you need for this is GetMemorizedSpell.
/* Check if oCreature knows the specified spell (this will only work for arcane casters) */
int GetKnowsSpell (int nSpellId, object oCreature, int nclass=class_TYPE_INVALID);
/* Get the spell at nIndex in nSpellLevel in oCreature's spellbook from nclass. */
int GetKnownSpell (object oCreature, int nclass, int nSpellLevel, int nIndex);
/* Set the spell at nIndex in nSpellLevel in oCreature's spellbook from nclass. */
int SetKnownSpell (object oCreature, int nclass, int nSpellLevel, int nIndex, int nSpellId);
/* Get the total number of known spells for oCreature's spellbook in nclass at nSpellLevel. */
int GetTotalKnownSpells (object oCreature, int nclass, int nSpellLevel);
/* Add a new spell to oCreature's spellbook for nclass. */
int AddKnownSpell (object oCreature, int nclass, int nSpellLevel, int nSpellId);
/* Remove a spell from oCreature's spellbook for nclass. */
int RemoveKnownSpell (object oCreature, int nclass, int nSpellLevel, int nSpellId);
/* Replace a spell in oCreature's spellbook for nclass. */
int ReplaceKnownSpell (object oCreature, int nclass, int nOldSpell, int nNewSpell);
/* Get information about one of oCreature's memorized spells. */
struct MemorizedSpellSlot GetMemorizedSpell (object oCreature, int nclass, int nLevel, int nIndex);
/* Set information about oCreature's memorized spells. */
int SetMemorizedSpell (object oCreature, int nclass, int nLevel, int nIndex, struct MemorizedSpellSlot mss);
/* Clear one of oCreature's memorized spells. */
int ClearMemorizedSpell (object oCreature, int nclass, int nLevel, int nIndex);
/* Get the maximum number of oCreature's spell slots at nclass and nSpellLevel. */
int GetMaxSpellSlots (object oCreature, int nclass, int nSpellLevel);
/* Get the number of bonus spell slots oCreature has at nclass and nSpellLevel.
* This value only includes bonus slots from equipment and effects, not from
* having a high ability score. */
int GetBonusSpellSlots (object oCreature, int nclass, int nSpellLevel);
/* Get the number of remaining spell slots oCreature has at nclass and
* nSpellLevel (only applies for bards and sorcerers) */
int GetRemainingSpellSlots (object oCreature, int nclass, int nSpellLevel);
/* Set the number of remaining spell slots oCreature has at nclass and
* nSpellLevel (only applies for bards and sorcerers) */
int SetRemainingSpellSlots (object oCreature, int nclass, int nSpellLevel, int nSlots);
/* Get a string containing all remaining spell uses for oCreature. */
string GetAllMemorizedSpells (object oCreature);
/* Restore the remaining spell uses for oCreature from the given string. */
int RestoreReadySpells (object oCreature, string sSpells);
/* Gets one of oCreature's cleric domains (either 1 or 2). */
int GetClericDomain (object oCreature, int nIndex);
/* Sets one of oCreature's cleric domains. */
int SetClericDomain (object oCreature, int nIndex, int nDomain);
/* Gets whether or not oCreature has a specialist school of wizardry. */
int GetWizardSpecialization (object oCreature);
/* Sets oCreature's wizard specialist school. */
int SetWizardSpecialization (object oCreature, int nSchool);
Funky