Skip to content

Commit

Permalink
Update APIs (NWNX: 93d8edd, NWN: 8193.36-10).
Browse files Browse the repository at this point in the history
  • Loading branch information
jhett12321 committed Feb 14, 2024
1 parent 1936b4d commit bdf7890
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/NWN/NWScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6279,6 +6279,8 @@ public static partial class NWScript
public const string PLAYER_DEVICE_PROPERTY_UI_RADIAL_SPELLCASTING_ALWAYS_SUBRADIAL = "ui.radial.spellcasting.always-show-as-subradial";
public const string PLAYER_DEVICE_PROPERTY_UI_RADIAL_CLASS_ABILITIES_ALWAYS_SUBRADIAL = "ui.radial.class-abilities.always-show-as-subradial";
public const string PLAYER_DEVICE_PROPERTY_UI_DISPLAY_LOADSCREEN_HINTS_IN_CHATLOG = "ui.display-loadscreen-hints-in-chatlog";
public const string PLAYER_DEVICE_PROPERTY_UI_MOUSE_SCALE = "ui.mouse.scale.enabled";
public const string PLAYER_DEVICE_PROPERTY_UI_MOUSE_SCALE_VALUE = "ui.mouse.scale.value";
public const string PLAYER_DEVICE_PROPERTY_CAMERA_MODE = "camera.mode";
public const string PLAYER_DEVICE_PROPERTY_CAMERA_EDGE_TURNING = "camera.edge-turning";
public const string PLAYER_DEVICE_PROPERTY_CAMERA_DIALOG_ZOOM = "camera.dialog-zoom";
Expand Down Expand Up @@ -7478,11 +7480,14 @@ public static System.IntPtr EffectSummonCreature(string sCreatureResref, int nVi
return VM.StackPopStruct(ENGINE_STRUCTURE_EFFECT);
}

/// Get the level at which this creature cast it&amp;apos;s last spell (or spell-like ability)<br/>
/// * Return value on error, or if oCreature has not yet cast a spell: 0;
public static int GetCasterLevel(uint oCreature)
/// Get the caster level of an object. This is consistent with the caster level used when applying effects if OBJECT_SELF is used.<br/>
/// - oObject: A creature will return the caster level of their currently cast spell or ability, or the item&amp;apos;s caster level if an item was used<br/>
/// A placeable will return an automatic caster level: floor(10, (spell innate level * 2) - 1)<br/>
/// An Area of Effect object will return the caster level that was used to create the Area of Effect.<br/>
/// * Return value on error, or if oObject has not yet cast a spell: 0;
public static int GetCasterLevel(uint oObject)
{
VM.StackPush(oCreature);
VM.StackPush(oObject);
VM.Call(84);
return VM.StackPopInt();
}
Expand Down Expand Up @@ -9322,8 +9327,9 @@ public static int GetUserDefinedEventNumber()
return VM.StackPopInt();
}

/// This is for use in a Spell script, it gets the ID of the spell that is being<br/>
/// cast (SPELL_*).
/// This is for use in a Spell script, it gets the ID of the spell that is being cast.<br/>
/// If used in an Area of Effect script it will return the ID of the spell that generated the AOE effect.<br/>
/// * Returns the spell ID (SPELL_*) or -1 if no spell was cast or on error
public static int GetSpellId()
{
VM.Call(248);
Expand Down
14 changes: 14 additions & 0 deletions src/NWNX/Plugins/UtilPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,20 @@ public static void UpdateClientObject(uint oObjectToUpdate, uint oPlayer = OBJEC
VM.NWNX.Call();
}

/// Clean a resource directory, deleting all files of nResType.
/// <param name="sAlias">A resource directory alias, NWNX or one defined in the custom resource directory file.</param>
/// <param name="nResType">The type of file to delete or 0xFFFF for all types.</param>
/// <returns>TRUE if successful, FALSE on error.</returns>
public static int CleanResourceDirectory(string sAlias, int nResType = 65535)
{
const string sFunc = "CleanResourceDirectory";
VM.NWNX.SetFunction(NWNX_Util, sFunc);
VM.NWNX.StackPush(nResType);
VM.NWNX.StackPush(sAlias);
VM.NWNX.Call();
return VM.NWNX.StackPopInt();
}

// @}
}

Expand Down

0 comments on commit bdf7890

Please sign in to comment.