// Sets the memorized spell of the provided creature for the provided class, level, and index. // Index bounds: 0 <= index < GetMemorizedSpellCountByLevel(creature, class, level). public static void SetMemorizedSpell(uint creature, ClassType classId, int level, int index, MemorizedSpellSlot spell) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetMemorisedSpell"); Internal.NativeFunctions.nwnxPushInt(spell.ID); Internal.NativeFunctions.nwnxPushInt(spell.Ready); Internal.NativeFunctions.nwnxPushInt(spell.Meta); Internal.NativeFunctions.nwnxPushInt(spell.Domain); Internal.NativeFunctions.nwnxPushInt(index); Internal.NativeFunctions.nwnxPushInt(level); Internal.NativeFunctions.nwnxPushInt((int)classId); Internal.NativeFunctions.nwnxPushObject(creature); Internal.NativeFunctions.nwnxCallFunction(); }
// Gets the memorized spell of the provided creature for the provided class, level, and index. // Index bounds: 0 <= index < GetMemorizedSpellCountByLevel(creature, class, level). public static MemorizedSpellSlot GetMemorizedSpell(uint creature, ClassType classId, int level, int index) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "GetMemorisedSpell"); var spell = new MemorizedSpellSlot(); Internal.NativeFunctions.nwnxPushInt(index); Internal.NativeFunctions.nwnxPushInt(level); Internal.NativeFunctions.nwnxPushInt((int)classId); Internal.NativeFunctions.nwnxPushObject(creature); Internal.NativeFunctions.nwnxCallFunction(); spell.Domain = Internal.NativeFunctions.nwnxPopInt(); spell.Meta = Internal.NativeFunctions.nwnxPopInt(); spell.Ready = Internal.NativeFunctions.nwnxPopInt(); spell.ID = Internal.NativeFunctions.nwnxPopInt(); return(spell); }