Not entirely sure whats going on then.
I have a subrace, called Fae, and when they cast a spell, the spellhook system restores the spells using nwnx_funcs.
It is designed to set their remaining spell casts back to their remaining.
Based on what I can see I think it might be part engine bug, and part of my system.
This code from nwnx_funcs grabs the 'max' casts per day from the bic file (character) for a specific spell level,
then it checks to see if the Slots parameter (provided by the user / script) is higher than the value for the max per day.
if it is larger than the max per day, then it changes slots to be that maximum value.
The question however, is this.
Where/Why is level 41 for this players character wiping out her max per day spell casts.
I don't think there is anywhere in my framework that modifies the max per day casts, all I do is change the remaining slots, which doesnt affect the max per day fields.
Odd
/* iterate their class list, matching the requested class, then set the slots */
for (i = 0; i < cre->cre_stats->cs_classes_len; i++) {
if (cre->cre_stats->cs_classes[i].cl_class != Class)
continue;
if (Slots > cre->cre_stats->cs_classes[i].cl_spells_max[SpellLevel])
Slots = cre->cre_stats->cs_classes[i].cl_spells_max[SpellLevel];
cre->cre_stats->cs_classes[i].cl_spells_left[SpellLevel] = Slots;
break;
}