Changed XP system over to PnP XP system

Changed XP system over to PnP XP system.  Updated NWNxEE scripts.  Full compile.  Updated public release archive.
This commit is contained in:
Jaysyn904
2024-03-13 21:52:56 -04:00
parent 786c640862
commit f5a98c2d22
85 changed files with 3041 additions and 673 deletions

View File

@@ -62,6 +62,10 @@ int NWNX_Util_Hash(string str);
/// @return The mtime of the module file.
int NWNX_Util_GetModuleMtime();
/// @brief Gets the module short file name.
/// @return The module file as a string.
string NWNX_Util_GetModuleFile();
/// @brief Gets the value of customTokenNumber.
/// @param customTokenNumber The token number to query.
/// @return The string representation of the token value.
@@ -72,7 +76,6 @@ string NWNX_Util_GetCustomToken(int customTokenNumber);
/// @return The converted itemproperty.
itemproperty NWNX_Util_EffectToItemProperty(effect e);
///
/// @brief Convert an itemproperty type to an effect type.
/// @param ip The itemproperty to convert to an effect.
/// @return The converted effect.
@@ -83,12 +86,6 @@ effect NWNX_Util_ItemPropertyToEffect(itemproperty ip);
/// @return The new string without any color codes.
string NWNX_Util_StripColors(string str);
/// @brief Determines if the supplied resref exists.
/// @param resref The resref to check.
/// @param type The @ref resref_types "Resref Type".
/// @return TRUE/FALSE
int NWNX_Util_IsValidResRef(string resref, int type = NWNX_UTIL_RESREF_TYPE_CREATURE);
/// @brief Retrieves an environment variable.
/// @param sVarname The environment variable to query.
/// @return The value of the environment variable.
@@ -108,12 +105,6 @@ void NWNX_Util_SetMinutesPerHour(int minutes);
/// @return The url encoded string.
string NWNX_Util_EncodeStringForURL(string str);
/// @anchor twoda_row_count
/// @brief Gets the row count for a 2da.
/// @param str The 2da to check (do not include the .2da).
/// @return The amount of rows in the 2da.
int NWNX_Util_Get2DARowCount(string str);
/// @brief Get the first resref of nType.
/// @param nType A @ref resref_types "Resref Type".
/// @param sRegexFilter Lets you filter out resrefs using a regexfilter.
@@ -127,11 +118,6 @@ string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModule
/// @return The next resref found or "" if none is found.
string NWNX_Util_GetNextResRef();
/// @brief Get the ticks per second of the server.
/// @remark Useful to dynamically detect lag and adjust behavior accordingly.
/// @return The ticks per second.
int NWNX_Util_GetServerTicksPerSecond();
/// @brief Get the last created object.
/// @param nObjectType Does not take the NWScript OBJECT_TYPE_* constants.
/// Use NWNX_Consts_TranslateNWScriptObjectType() to get their NWNX equivalent.
@@ -148,12 +134,6 @@ object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1);
/// @return "" on success, or the compilation error.
string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain = FALSE, string sAlias = "NWNX");
/// @brief Gets the contents of a .nss script file as a string.
/// @param sScriptName The name of the script to get the contents of.
/// @param nMaxLength The max length of the return string, -1 to get everything
/// @return The script file contents or "" on error.
string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1);
/// @brief Adds a nss file to the UserDirectory/nwnx folder, or to the location of sAlias.
/// @note Will override existing nss files that are in the module
/// @param sFileName The script filename without extension, 16 or less characters.
@@ -262,6 +242,23 @@ string NWNX_Util_GetTTY();
/// @param nEventID The ID of the event.
void NWNX_Util_SetCurrentlyRunningEvent(int nEventID);
/// @brief Calculate the levenshtein distance of two strings
/// @param sString The string to compare with.
/// @param sCompareTo The string to compare sString to.
/// @return The number of characters different between the compared strings.
int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo);
/// @brief Sends a full object update of oObjectToUpdate to all clients
/// @param oObjectToUpdate The object to update
/// @param oPlayer The player for which the objects needs to update, OBJECT_INVALID for all players
void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer = OBJECT_INVALID);
/// @brief Clean a resource directory, deleting all files of nResType.
/// @param sAlias A resource directory alias, NWNX or one defined in the custom resource directory file.
/// @param nResType The type of file to delete or 0xFFFF for all types.
/// @return TRUE if successful, FALSE on error.
int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType = 0xFFFF);
/// @}
string NWNX_Util_GetCurrentScriptName(int depth = 0)
@@ -293,6 +290,12 @@ int NWNX_Util_GetModuleMtime()
return NWNX_GetReturnValueInt();
}
string NWNX_Util_GetModuleFile()
{
NWNX_CallFunction(NWNX_Util, "GetModuleFile");
return NWNX_GetReturnValueString();
}
string NWNX_Util_GetCustomToken(int customTokenNumber)
{
string sFunc = "GetCustomToken";
@@ -325,15 +328,6 @@ string NWNX_Util_StripColors(string str)
return NWNX_GetReturnValueString();
}
int NWNX_Util_IsValidResRef(string resref, int type = NWNX_UTIL_RESREF_TYPE_CREATURE)
{
string sFunc = "IsValidResRef";
NWNX_PushArgumentInt(type);
NWNX_PushArgumentString(resref);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
}
string NWNX_Util_GetEnvironmentVariable(string sVarname)
{
string sFunc = "GetEnvironmentVariable";
@@ -366,14 +360,6 @@ string NWNX_Util_EncodeStringForURL(string sURL)
return NWNX_GetReturnValueString();
}
int NWNX_Util_Get2DARowCount(string str)
{
string sFunc = "Get2DARowCount";
NWNX_PushArgumentString(str);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
}
string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter = "", int bModuleResourcesOnly = TRUE)
{
string sFunc = "GetFirstResRef";
@@ -395,15 +381,6 @@ string NWNX_Util_GetNextResRef()
return NWNX_GetReturnValueString();
}
int NWNX_Util_GetServerTicksPerSecond()
{
string sFunc = "GetServerTicksPerSecond";
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
}
object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast = 1)
{
string sFunc = "GetLastCreatedObject";
@@ -428,17 +405,6 @@ string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMa
return NWNX_GetReturnValueString();
}
string NWNX_Util_GetNSSContents(string sScriptName, int nMaxLength = -1)
{
string sFunc = "GetNSSContents";
NWNX_PushArgumentInt(nMaxLength);
NWNX_PushArgumentString(sScriptName);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueString();
}
int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias = "NWNX")
{
string sFunc = "AddNSSFile";
@@ -518,10 +484,8 @@ void NWNX_Util_UnregisterServerConsoleCommand(string sCommand)
int NWNX_Util_PluginExists(string sPlugin)
{
string sFunc = "PluginExists";
NWNX_PushArgumentString(sPlugin);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
WriteTimestampedLogEntry("WARNING: NWNX_Util_PluginExists is deprecated. You should migrate to NWNX_PluginExists.");
return NWNX_PluginExists(sPlugin);
}
string NWNX_Util_GetUserDirectory()
@@ -654,3 +618,31 @@ void NWNX_Util_SetCurrentlyRunningEvent(int nEventID)
NWNX_PushArgumentInt(nEventID);
NWNX_CallFunction(NWNX_Util, sFunc);
}
int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo)
{
string sFunc = "LevenshteinDistance";
NWNX_PushArgumentString(sCompareTo);
NWNX_PushArgumentString(sString);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
}
void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer = OBJECT_INVALID)
{
string sFunc = "UpdateClientObject";
NWNX_PushArgumentObject(oPlayer);
NWNX_PushArgumentObject(oObjectToUpdate);
NWNX_CallFunction(NWNX_Util, sFunc);
}
int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType = 0xFFFF)
{
string sFunc = "CleanResourceDirectory";
NWNX_PushArgumentInt(nResType);
NWNX_PushArgumentString(sAlias);
NWNX_CallFunction(NWNX_Util, sFunc);
return NWNX_GetReturnValueInt();
}