2026/02/08 Update

Archived Spellman's Project content.
Added missing Diamond Dragon stat feats.
Hospitaler's should be able to take Extra Turning.
Dodge proxies should allow entry into Champion of Corellon.
Mounted Combat is a prereq for Champion of Corellon.
Only Clerics have Domain reqs to enter Morninglord.
Verdant Lord was missing BAB 4 entry requirement.
Diamond Dragons don't get spellcraft.
Re-added Korobokuru race.
Added .ltr tables for Korobokuru.
Capped Blood in the Water at +20.
Capped Pearl of Black Doubt at +20.
Added json_GetFirstKnownSpell() and json_GetNextKnownSpell().
Updated all old NWNx functions to work with NWNxEE.
Added new switch to enable optional PRCX / NWNxEE shims.
Commented out ConvoCC switches on inc_switch_setup.nss
Diamond Dragon's stat increases are intrinsic when using NWNxEE.
Forsaker's stat increases are intrinsic when using NWNxEE.
Vow of Poverty's stat increases are intrinsic when using NWNxEE.
Cloud Dragon summon should be Neutral Good.
Fixed Verdant Lord's regen.
Fixed Forest Master's regen.
Morninglord's Creative Fire should affect Alchemy.
Added yes/no dialog when choosing Vow of Poverty bonus Exalted Feats.
Racial natural AC should be intrinsic when NWNxEE is enabled.
Transcendent Vitality's CON bonus is intrinsic when NWNxEE is enabled.
This commit is contained in:
Jaysyn904
2026-02-08 00:44:28 -05:00
parent 875f00c88f
commit 4026b6af2c
899 changed files with 2189 additions and 83980 deletions

View File

@@ -2,21 +2,23 @@
/* Combined wrappers for both Win32 and Linux NWNX funcs */
////////////////////////////////////////////////////////////////////////////////////
#include "inc_debug"
//////////////////////////////////////////////////
/* Function prototypes */
//////////////////////////////////////////////////
// Used in OnModuleLoad event to auto-detect if NWNX_Funcs plugin is enabled
// Used in OnModuleLoad event to auto-detect if NWNX_Funcs plugin is enabled (DEFUNCT)
void PRC_Funcs_Init(object oModule);
// Sets the amount of hitpoints oObject has currently to nHP
void PRC_Funcs_SetCurrentHitPoints(object oCreature, int nHP);
// Sets the amount of hitpoints oObject can maximally have to nHP
void PRC_Funcs_SetMaxHitPoints(object oCreature, int nHP);
void PRC_Funcs_SetMaxHitPoints(object oCreature, int nHP, int nLevel = 0);
// Changes the skill ranks for nSkill on oObject by iValue
void PRC_Funcs_ModSkill(object oCreature, int nSkill, int nValue);
void PRC_Funcs_ModSkill(object oCreature, int nSkill, int nValue, int nLevel = 0);
// Sets a base ability score nAbility (ABILITY_STRENGTH, ABILITY_DEXTERITY, etc) to nValue
// The range of nValue is 3 to 255
@@ -44,17 +46,17 @@ void PRC_Funcs_SetBaseNaturalAC(object oCreature, int nValue);
int PRC_Funcs_GetBaseNaturalAC(object oCreature);
// Sets the specialist spell school of a Wizard
void PRC_Funcs_SetWizardSpecialization(object oCreature, int iSpecialization);
void PRC_Funcs_SetWizardSpecialization(object oCreature, int iSpecialization, int nClass = CLASS_TYPE_WIZARD);
// Returns the specialist spell school of a Wizard
int PRC_Funcs_GetWizardSpecialization(object oCreature);
int PRC_Funcs_GetWizardSpecialization(object oCreature, int nClass = CLASS_TYPE_WIZARD);
//////////////////////////////////////////////////
/* Function definitions */
//////////////////////////////////////////////////
int _PRC_NWNXFuncsZero(object oObject, string sFunc) {
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
SetLocalString(oObject, sFunc, "-");
else if (nVersion == 2)
@@ -65,7 +67,7 @@ int _PRC_NWNXFuncsZero(object oObject, string sFunc) {
}
int _PRC_NWNXFuncsOne(object oObject, string sFunc, int nVal1) {
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
SetLocalString(oObject, sFunc, IntToString(nVal1));
else if (nVersion == 2)
@@ -76,7 +78,7 @@ int _PRC_NWNXFuncsOne(object oObject, string sFunc, int nVal1) {
}
int _PRC_NWNXFuncsTwo(object oObject, string sFunc, int nVal1, int nVal2) {
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
SetLocalString(oObject, sFunc, IntToString(nVal1) + " " + IntToString(nVal2));
else if (nVersion == 2)
@@ -87,7 +89,7 @@ int _PRC_NWNXFuncsTwo(object oObject, string sFunc, int nVal1, int nVal2) {
}
int _PRC_NWNXFuncsThree(object oObject, string sFunc, int nVal1, int nVal2, int nVal3) {
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
SetLocalString(oObject, sFunc, IntToString(nVal1) + " " + IntToString(nVal2) + " " + IntToString(nVal3));
else if (nVersion == 2)
@@ -98,7 +100,7 @@ int _PRC_NWNXFuncsThree(object oObject, string sFunc, int nVal1, int nVal2, int
}
int _PRC_NWNXFuncsFour(object oObject, string sFunc, int nVal1, int nVal2, int nVal3, int nVal4) {
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
SetLocalString(oObject, sFunc, IntToString(nVal1) + " " + IntToString(nVal2) + " " + IntToString(nVal3) + " " + IntToString(nVal4));
else if (nVersion == 2)
@@ -114,13 +116,13 @@ void PRC_Funcs_Init(object oModule)
string sTestVariable = "PRC_TEST_NWNX_FUNCS";
SetLocalString(oModule, sTestVariable, "1");
SetLocalString(oModule, "NWNX!FUNCS!GETHASLOCALVARIABLE", sTestVariable + " 3"); //3 is the variable type
//NOTE: don't use _PRC_NWNXFuncsX functions here; they depend on the PRC_NWNX_FUNCS that we haven't set yet
//NOTE: don't use _PRC_NWNXFuncsX functions here; they depend on the PRC_NWNXEE_ENABLED that we haven't set yet
int iTest = StringToInt(GetLocalString(oModule, "NWNX!FUNCS!GETHASLOCALVARIABLE"));
DeleteLocalString(oModule, "NWNX!FUNCS!GETHASLOCALVARIABLE");
DeleteLocalString(oModule, sTestVariable);
if (iTest)
SetLocalInt(oModule, "PRC_NWNX_FUNCS", 1); //1 == win32
SetLocalInt(oModule, "PRC_NWNXEE_ENABLED", 1); //1 == win32
else
{
//NWNX GetLocalVariableCount behaves differently for win32 and linux,
@@ -132,7 +134,7 @@ void PRC_Funcs_Init(object oModule)
//the call failed because NWNX funcs is not present.
string sFunc = "NWNX!FUNCS!GETLOCALVARIABLECOUNT";
SetLocalString(oModule, sFunc, " ");
//NOTE: don't use _PRC_NWNXFuncsX functions here; they depend on the PRC_NWNX_FUNCS that we haven't set yet
//NOTE: don't use _PRC_NWNXFuncsX functions here; they depend on the PRC_NWNXEE_ENABLED that we haven't set yet
//NOTE: the number being returned by GetLocalVariableCount() on Linux seems bogus to me (it's huge, e.g. 294,654,504),
//but it does seem to be reliably zero when NWNX funcs is not present, and so far has been reliably non-zero
//when it is present. That's all we need here.
@@ -140,50 +142,116 @@ void PRC_Funcs_Init(object oModule)
int nVariables = StringToInt(GetLocalString(oModule, sFunc));
DeleteLocalString(oModule, sFunc);
if (nVariables)
SetLocalInt(oModule, "PRC_NWNX_FUNCS", 2); //2 == linux
SetLocalInt(oModule, "PRC_NWNXEE_ENABLED", 2); //2 == linux
}
}
void PRC_Funcs_SetMaxHitPoints(object oCreature, int nHP)
void PRC_Funcs_SetMaxHitPoints(object oCreature, int nHP, int nLevel = 0)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Default to total hit dice if not provided
if (nLevel <= 0)
nLevel = GetHitDice(oCreature);
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_MAXHP", nHP);
SetLocalInt(oCreature, "PRC_EE_MAXHP_LEVEL", nLevel);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_maxhp", oCreature);
}
/* void PRC_Funcs_SetMaxHitPoints(object oCreature, int nHP)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1 || nVersion == 2)
{
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETMAXHITPOINTS", nHP);
DeleteLocalString(oCreature, "NWNX!FUNCS!SETMAXHITPOINTS");
}
} */
void PRC_Funcs_ModSkill(object oCreature, int nSkill, int nValue, int nLevel = 0)
{
//:: Default to current level if not provided
if (nLevel <= 0)
nLevel = GetHitDice(oCreature);
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_SKILL", nSkill);
SetLocalInt(oCreature, "PRC_EE_SKILL_DELTA", nValue);
SetLocalInt(oCreature, "PRC_EE_SKILL_LEVEL", nLevel);
//:: Fire NWNxEE shim
ExecuteScript("prcx_mod_skill", oCreature);
}
void PRC_Funcs_ModSkill(object oCreature, int nSkill, int nValue)
/* void PRC_Funcs_ModSkill(object oCreature, int nSkill, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsThree(oCreature, "NWNX!FUNCS!SETSKILL", nSkill, nValue, 1); //The 1 is a flag specifying modify instead of set
else if (nVersion == 2)
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!MODIFYSKILLRANK", nSkill, nValue);
}
} */
void PRC_Funcs_SetAbilityScore(object oCreature, int nAbility, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_ABILITY", nAbility);
SetLocalInt(oCreature, "PRC_EE_ABILITY_VALUE", nValue);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_ability", oCreature);
}
/* void PRC_Funcs_SetAbilityScore(object oCreature, int nAbility, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsFour(oCreature, "NWNX!FUNCS!SETABILITYSCORE", nAbility, nValue, 0, 0); //The first 0 is a flag specifying set instead of modify
else if (nVersion == 2)
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!SETABILITYSCORE", nAbility, nValue);
}
} */
void PRC_Funcs_ModAbilityScore(object oCreature, int nAbility, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
if(DEBUG) DoDebug("============================================");
if(DEBUG) DoDebug("PRC_Funcs_ModAbiltyScore: Starting function.");
if(DEBUG) DoDebug("============================================");
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_ABILITY", nAbility);
SetLocalInt(oCreature, "PRC_EE_ABILITY_DELTA", nValue);
if(DEBUG) DoDebug("PRC_Funcs_ModAbiltyScore: Variables Set");
//:: Fire NWNxEE shim
if(DEBUG) DoDebug("PRC_Funcs_ModAbiltyScore: Firing prc_mod_ability");
ExecuteScript("prcx_mod_ability", oCreature);
}
/* void PRC_Funcs_ModAbilityScore(object oCreature, int nAbility, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsFour(oCreature, "NWNX!FUNCS!SETABILITYSCORE", nAbility, nValue, 1, 0); //The 1 is a flag specifying modify instead of set
else if (nVersion == 2)
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!MODIFYABILITYSCORE", nAbility, nValue);
} */
void PRC_Funcs_AddFeat(object oCreature, int nFeat, int nLevel = 0)
{
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_FEAT", nFeat);
SetLocalInt(oCreature, "PRC_EE_FEAT_LEVEL", nLevel);
//:: Fire NWNxEE shim
ExecuteScript("prcx_add_feat", oCreature);
}
void PRC_Funcs_AddFeat(object oCreature, int nFeat, int nLevel=0)
/* void PRC_Funcs_AddFeat(object oCreature, int nFeat, int nLevel=0)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
{
if (!nLevel)
@@ -198,21 +266,88 @@ void PRC_Funcs_AddFeat(object oCreature, int nFeat, int nLevel=0)
else if(nLevel > 0)
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!ADDKNOWNFEATATLEVEL", nLevel, nFeat);
}
} */
/**
* @brief Determines whether a creature inherently knows a feat.
*
* This function returns TRUE only if the specified feat is an inherent
* (true) feat possessed by the creature. Bonus feats granted via
* EFFECT_TYPE_BONUS_FEAT effects are explicitly ignored.
*
* This allows reliable differentiation between permanent feats
* (e.g. class, racial, or template feats) and temporary or granted
* bonus feats applied through effects.
*
* No NWNxEE shim is required; this function operates entirely using
* stock NWScript functionality.
*
* @param oCreature The creature to check.
* @param nFeatIndex The feat constant to test.
*
* @return TRUE if the creature inherently knows the feat and does not
* possess it solely via a bonus feat effect; FALSE otherwise.
*/
int PRC_Funcs_GetFeatKnown(object oCreature, int nFeatIndex)
{
//:: Check for an EffectBonusFeat with this feat ID
effect eCheck = GetFirstEffect(oCreature);
int bHasBonusFeatEffect = FALSE;
while (GetIsEffectValid(eCheck))
{
if (GetEffectType(eCheck) == EFFECT_TYPE_BONUS_FEAT && GetEffectInteger(eCheck, 0) == nFeatIndex)
{
bHasBonusFeatEffect = TRUE;
break;
}
eCheck = GetNextEffect(oCreature);
}
//;: Return TRUE only if inherent and no matching bonus feat effect
return (!bHasBonusFeatEffect && GetHasFeat(nFeatIndex, oCreature));
}
int PRC_Funcs_GetFeatKnown(object oCreature, int nFeatIndex)
/* int PRC_Funcs_GetFeatKnown(object oCreature, int nFeatIndex)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_FEAT", nFeatIndex);
//:: Fire NWNxEE shim
ExecuteScript("prcx_knows_feat", oCreature);
//:: Read result
int nResult = GetLocalInt(oCreature, "PRC_EE_FEAT_RESULT");
//:: Clean up locals
DeleteLocalInt(oCreature, "PRC_EE_FEAT");
DeleteLocalInt(oCreature, "PRC_EE_FEAT_RESULT");
return nResult;
} */
/* int PRC_Funcs_GetFeatKnown(object oCreature, int nFeatIndex)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
return _PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!GETFEATKNOWN", nFeatIndex);
else if (nVersion == 2)
return _PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!GETKNOWNFEAT", nFeatIndex);
return 0;
}
} */
void PRC_Funcs_ModSavingThrowBonus(object oCreature, int nSavingThrow, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_STYPE", nSavingThrow);
SetLocalInt(oCreature, "PRC_EE_SDELTA", nValue);
//:: Fire NWNxEE shim
ExecuteScript("prcx_mod_save", oCreature);
}
/* void PRC_Funcs_ModSavingThrowBonus(object oCreature, int nSavingThrow, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsThree(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS", nSavingThrow, nValue, 1); //The 1 is a flag specifying modify instead of set
else if (nVersion == 2)
@@ -224,61 +359,133 @@ void PRC_Funcs_ModSavingThrowBonus(object oCreature, int nSavingThrow, int nValu
nNewValue = 127;
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS", nSavingThrow, nNewValue);
}
}
} */
void PRC_Funcs_SetBaseNaturalAC(object oCreature, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Payload for NWNxEE shim
SetLocalInt(oCreature, "PRC_EE_BASEAC", nValue);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_ac", oCreature);
}
/* void PRC_Funcs_SetBaseNaturalAC(object oCreature, int nValue)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsTwo(oCreature, "NWNX!FUNCS!SETBASEAC", nValue, AC_NATURAL_BONUS);
else if (nVersion == 2)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETACNATURALBASE", nValue);
}
} */
int PRC_Funcs_GetBaseNaturalAC(object oCreature)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
//:: Fire NWNxEE shim
ExecuteScript("prcx_get_ac", oCreature);
//:: Read result
int nAC = GetLocalInt(oCreature, "PRC_EE_BASEAC_RESULT");
//:: Clean up
DeleteLocalInt(oCreature, "PRC_EE_BASEAC_RESULT");
return nAC;
}
/* int PRC_Funcs_GetBaseNaturalAC(object oCreature)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
return _PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!GETBASEAC", AC_NATURAL_BONUS);
else if (nVersion == 2)
return _PRC_NWNXFuncsZero(oCreature, "NWNX!FUNCS!GETACNATURALBASE");
return 0;
} */
void PRC_Funcs_SetCurrentHitPoints(object oCreature, int nHP)
{
//:: Sanity check
if (nHP < 0)
nHP = 0;
//:: Set current hit points directly
//:: Was this not a native function in the past?
SetCurrentHitPoints(oCreature, nHP);
}
void PRC_Funcs_SetCurrentHitPoints(object oCreature, int nHP)
/* void PRC_Funcs_SetCurrentHitPoints(object oCreature, int nHP)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1 || nVersion == 2)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETCURRENTHITPOINTS", nHP);
} */
void PRC_Funcs_SetCreatureSize(object oCreature, int nSize)
{
//:: Pass parameters via locals
SetLocalInt(oCreature, "PRC_EE_CREATURESIZE", nSize);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_size", oCreature);
}
void PRC_Funcs_SetCreatureSize (object oCreature, int nSize)
/* void PRC_Funcs_SetCreatureSize (object oCreature, int nSize)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1 || nVersion == 2)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETCREATURESIZE", nSize);
} */
void PRC_Funcs_SetRace(object oCreature, int nRace)
{
//:: Pass parameters via locals
SetLocalInt(oCreature, "PRC_EE_RACETYPE", nRace);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_race", oCreature);
}
void PRC_Funcs_SetRace(object oCreature, int nRace)
/* void PRC_Funcs_SetRace(object oCreature, int nRace)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETRACE", nRace);
else if (nVersion == 2)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETRACIALTYPE", nRace);
} */
void PRC_Funcs_SetWizardSpecialization(object oCreature, int iSpecialization, int nClass = CLASS_TYPE_WIZARD)
{
//:: Pass parameters via locals
SetLocalInt(oCreature, "PRC_EE_WIZCLASS", nClass);
SetLocalInt(oCreature, "PRC_EE_WIZSCHOOL", iSpecialization);
//:: Fire NWNxEE shim
ExecuteScript("prcx_set_spec", oCreature);
}
void PRC_Funcs_SetWizardSpecialization(object oCreature, int iSpecialization)
/* void PRC_Funcs_SetWizardSpecialization(object oCreature, int iSpecialization)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1 || nVersion == 2)
_PRC_NWNXFuncsOne(oCreature, "NWNX!FUNCS!SETWIZARDSPECIALIZATION", iSpecialization);
} */
//:: This is a native function now.
int PRC_Funcs_GetWizardSpecialization(object oCreature, int nClass = CLASS_TYPE_WIZARD)
{
return GetSpecialization(oCreature, nClass);
}
int PRC_Funcs_GetWizardSpecialization(object oCreature)
/* int PRC_Funcs_GetWizardSpecialization(object oCreature)
{
int nVersion = GetLocalInt(GetModule(), "PRC_NWNX_FUNCS");
int nVersion = GetLocalInt(GetModule(), "PRC_NWNXEE_ENABLED");
if (nVersion == 1 || nVersion == 2)
return _PRC_NWNXFuncsZero(oCreature, "NWNX!FUNCS!GETWIZARDSPECIALIZATION");
return 0;
}
} */
//:: void main(){}

View File

@@ -867,6 +867,7 @@ void CreateSwitchNameArray()
//if you add more switches, add them to this list
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_DEBUG);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_COMBAT_DEBUG);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_PRCX_ENABLED);
//craft
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_DISABLE_CRAFT);
@@ -1116,7 +1117,8 @@ void CreateSwitchNameArray()
//general
//PW
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_ENABLE);
// ConvoCC is unneeded now.
/* array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_ENABLE);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_AVARIEL_WINGS);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_FEYRI_WINGS);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_AASIMAR_WINGS);
@@ -1146,7 +1148,7 @@ void CreateSwitchNameArray()
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_MAX_STAT);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_SKILL_MULTIPLIER);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_SKILL_BONUS);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_CUSTOM_EXIT_SCRIPT);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_CONVOCC_CUSTOM_EXIT_SCRIPT); */
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_TRUENAME_CR_MULTIPLIER);
array_set_string(oWP, "Switch_Name", array_get_size(oWP, "Switch_Name"), PRC_TRUENAME_LEVEL_BONUS);

View File

@@ -978,32 +978,35 @@ const int FEAT_KOB_DRAGONWROUGHT_SR = 3855;
const int FEAT_DRAGON_AUGMENT_STR_1 = 3857;
const int FEAT_DRAGON_AUGMENT_STR_2 = 3858;
const int FEAT_DRAGON_AUGMENT_STR_3 = 3859;
const int FEAT_DRAGON_AUGMENT_STR_4 = 26382;
const int FEAT_DRAGON_AUGMENT_STR_5 = 26383;
const int FEAT_DRAGON_AUGMENT_STR_6 = 26384;
const int FEAT_DRAGON_AUGMENT_STR_7 = 26385;
const int FEAT_DRAGON_AUGMENT_STR_8 = 26386;
const int FEAT_DRAGON_AUGMENT_STR_9 = 26387;
const int FEAT_DRAGON_AUGMENT_STR_4 = 25645;
const int FEAT_DRAGON_AUGMENT_STR_5 = 25646;
const int FEAT_DRAGON_AUGMENT_STR_6 = 25647;
const int FEAT_DRAGON_AUGMENT_STR_7 = 25648;
const int FEAT_DRAGON_AUGMENT_STR_8 = 25649;
const int FEAT_DRAGON_AUGMENT_STR_9 = 25650;
const int FEAT_DRAGON_AUGMENT_STR_10 = 25651;
const int FEAT_DRAGON_AUGMENT_DEX_1 = 3860;
const int FEAT_DRAGON_AUGMENT_DEX_2 = 3861;
const int FEAT_DRAGON_AUGMENT_DEX_3 = 3862;
const int FEAT_DRAGON_AUGMENT_DEX_4 = 26388;
const int FEAT_DRAGON_AUGMENT_DEX_5 = 26389;
const int FEAT_DRAGON_AUGMENT_DEX_6 = 26390;
const int FEAT_DRAGON_AUGMENT_DEX_7 = 26391;
const int FEAT_DRAGON_AUGMENT_DEX_8 = 26392;
const int FEAT_DRAGON_AUGMENT_DEX_9 = 26393;
const int FEAT_DRAGON_AUGMENT_DEX_4 = 25653;
const int FEAT_DRAGON_AUGMENT_DEX_5 = 25654;
const int FEAT_DRAGON_AUGMENT_DEX_6 = 25655;
const int FEAT_DRAGON_AUGMENT_DEX_7 = 25656;
const int FEAT_DRAGON_AUGMENT_DEX_8 = 25657;
const int FEAT_DRAGON_AUGMENT_DEX_9 = 25658;
const int FEAT_DRAGON_AUGMENT_DEX_10 = 25659;
const int FEAT_DRAGON_AUGMENT_CON_1 = 3863;
const int FEAT_DRAGON_AUGMENT_CON_2 = 3864;
const int FEAT_DRAGON_AUGMENT_CON_3 = 3865;
const int FEAT_DRAGON_AUGMENT_CON_4 = 26394;
const int FEAT_DRAGON_AUGMENT_CON_5 = 26395;
const int FEAT_DRAGON_AUGMENT_CON_6 = 26396;
const int FEAT_DRAGON_AUGMENT_CON_7 = 26397;
const int FEAT_DRAGON_AUGMENT_CON_8 = 26398;
const int FEAT_DRAGON_AUGMENT_CON_9 = 26399;
const int FEAT_DRAGON_AUGMENT_CON_4 = 25661;
const int FEAT_DRAGON_AUGMENT_CON_5 = 25662;
const int FEAT_DRAGON_AUGMENT_CON_6 = 25663;
const int FEAT_DRAGON_AUGMENT_CON_7 = 25664;
const int FEAT_DRAGON_AUGMENT_CON_8 = 25665;
const int FEAT_DRAGON_AUGMENT_CON_9 = 25666;
const int FEAT_DRAGON_AUGMENT_CON_10 = 25667;
const int FEAT_CHANNEL_DRACLAWS = 3866;
const int FEAT_PSIONIC_BREATH = 3867;

View File

@@ -244,7 +244,7 @@ void ApplyPseudonatural(object oFamiliar, object oFamSkin)
void ApplyIllmaster(object oCompanion, object oCompSkin)
{
//Give the companion permanent Str +4, Con +2, Wis -2, and Cha -2
if(GetPRCSwitch(PRC_NWNX_FUNCS))
if(GetPRCSwitch(PRC_NWNXEE_ENABLED))
{
PRC_Funcs_ModAbilityScore(oCompanion, ABILITY_STRENGTH, 4);
PRC_Funcs_ModAbilityScore(oCompanion, ABILITY_CONSTITUTION, 2);
@@ -305,7 +305,7 @@ void WinterWolfProperties(object oCompanion, int nLevel)
object oCreR = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oCompanion);
if(GetPRCSwitch(PRC_NWNX_FUNCS))
if(GetPRCSwitch(PRC_NWNXEE_ENABLED))
{
if(iStr > 0)
PRC_Funcs_ModAbilityScore(oCompanion, ABILITY_STRENGTH, iStr);
@@ -358,7 +358,10 @@ void WinterWolfProperties(object oCompanion, int nLevel)
void ApplyPnPFamiliarProperties(object oPC, object oFam)
{
int bFuncs = GetPRCSwitch(PRC_NWNX_FUNCS);
int nNWNxEE = GetPRCSwitch(PRC_NWNXEE_ENABLED);
int nPRCx = GetPRCSwitch(PRC_PRCX_ENABLED);
int bFuncs = (nNWNxEE && nPRCx);
effect eBonus;
//get familiar level

View File

@@ -480,7 +480,7 @@ int Debug_ProcessChatCommand(object oPC, string sCommand)
HelpText(oPC, "=== INT: " + IntToString(GetAbilityScore(oTarget, ABILITY_INTELLIGENCE, TRUE)) + " / " + IntToString(GetAbilityScore(oTarget, ABILITY_INTELLIGENCE, FALSE)));
HelpText(oPC, "=== WIS: " + IntToString(GetAbilityScore(oTarget, ABILITY_WISDOM, TRUE)) + " / " + IntToString(GetAbilityScore(oTarget, ABILITY_WISDOM, FALSE)));
HelpText(oPC, "=== CHA: " + IntToString(GetAbilityScore(oTarget, ABILITY_CHARISMA, TRUE)) + " / " + IntToString(GetAbilityScore(oTarget, ABILITY_CHARISMA, FALSE)));
if (GetPersistantLocalInt(oTarget, SHIFTER_ISSHIFTED_MARKER) && GetPRCSwitch(PRC_NWNX_FUNCS))
if (GetPersistantLocalInt(oTarget, SHIFTER_ISSHIFTED_MARKER) && GetPRCSwitch(PRC_NWNXEE_ENABLED))
{
int iSTR = GetPersistantLocalInt(oTarget, "Shifting_NWNXSTRAdjust");
int iDEX = GetPersistantLocalInt(oTarget, "Shifting_NWNXDEXAdjust");
@@ -664,7 +664,7 @@ int Debug_ProcessChatCommand(object oPC, string sCommand)
}
/* else if (GetStringMatchesAbbreviation(sChangeWhat, CMD_ABILITY))
{
if (!GetPRCSwitch(PRC_NWNX_FUNCS))
if (!GetPRCSwitch(PRC_NWNXEE_ENABLED))
HelpText(oPC, "This command only works if NWNX funcs is installed");
else
{

View File

@@ -367,7 +367,7 @@ void EvalPRCFeats(object oPC)
SetLocalInt(oPC, PRC_EvalPRCFeats_Generation, nGeneration);
//permanent ability changes
if(GetPRCSwitch(PRC_NWNX_FUNCS))
if(GetPRCSwitch(PRC_NWNXEE_ENABLED))
ExecuteScript("prc_nwnx_funcs", oPC);
//Add IP Feats to the hide

View File

@@ -582,8 +582,6 @@ effect CelestialTemplateEffects(int nHD)
return eEffects;
}
void ReallyEquipItemInSlot(object oNPC, object oItem, int nSlot)
{
if (GetItemInSlot(nSlot) != oItem)
@@ -688,6 +686,148 @@ void ApplyPseudonaturalEffects(object oCreature)
//:: JSON functions |
//::---------------------------------------------|
//:: Get the first spell ID that a creature knows (not memorized, but known)
//:: Returns -1 if no spells are found
int json_GetFirstKnownSpell(json jCreature)
{
// Store the creature JSON for later use by GetNext
SetLocalJson(GetModule(), "JSON_SPELL_CREATURE", jCreature);
SetLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX", 0);
SetLocalInt(GetModule(), "JSON_SPELL_LEVEL", 0);
SetLocalInt(GetModule(), "JSON_SPELL_INDEX", 0);
// Get the ClassList
json jClassList = GffGetList(jCreature, "ClassList");
if (jClassList == JsonNull())
{
if(DEBUG) DoDebug("json_GetFirstKnownSpell: No ClassList found");
return -1;
}
int nClassCount = JsonGetLength(jClassList);
int iClass, iSpellLevel, iSpell;
// Iterate through all classes
for (iClass = 0; iClass < nClassCount; iClass++)
{
json jClass = JsonArrayGet(jClassList, iClass);
if (jClass == JsonNull()) continue;
// Check all spell levels (0-9)
for (iSpellLevel = 0; iSpellLevel <= 9; iSpellLevel++)
{
string sKnownList = "KnownList" + IntToString(iSpellLevel);
json jKnownList = GffGetList(jClass, sKnownList);
if (jKnownList == JsonNull()) continue;
int nSpellCount = JsonGetLength(jKnownList);
// Look for the first spell
for (iSpell = 0; iSpell < nSpellCount; iSpell++)
{
json jSpell = JsonArrayGet(jKnownList, iSpell);
if (jSpell == JsonNull()) continue;
json jSpellID = GffGetWord(jSpell, "Spell");
if (jSpellID != JsonNull())
{
int nSpellID = JsonGetInt(jSpellID);
// Update tracking variables for next call
SetLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX", iClass);
SetLocalInt(GetModule(), "JSON_SPELL_LEVEL", iSpellLevel);
SetLocalInt(GetModule(), "JSON_SPELL_INDEX", iSpell + 1);
return nSpellID;
}
}
}
}
// Clean up when done
DeleteLocalJson(GetModule(), "JSON_SPELL_CREATURE");
DeleteLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX");
DeleteLocalInt(GetModule(), "JSON_SPELL_LEVEL");
DeleteLocalInt(GetModule(), "JSON_SPELL_INDEX");
return -1; // No more spells found
}
//:: Get the next spell ID from the creature's known spells
//:: Returns -1 if no more spells are found
int json_GetNextKnownSpell()
{
json jCreature = GetLocalJson(GetModule(), "JSON_SPELL_CREATURE");
if (jCreature == JsonNull())
return -1;
int nClassIndex = GetLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX");
int nSpellLevel = GetLocalInt(GetModule(), "JSON_SPELL_LEVEL");
int nSpellIndex = GetLocalInt(GetModule(), "JSON_SPELL_INDEX");
// Get the ClassList
json jClassList = GffGetList(jCreature, "ClassList");
if (jClassList == JsonNull())
return -1;
int nClassCount = JsonGetLength(jClassList);
int iClass, iSpellLevel, iSpell;
// Continue from where we left off
for (iClass = nClassIndex; iClass < nClassCount; iClass++)
{
json jClass = JsonArrayGet(jClassList, iClass);
if (jClass == JsonNull()) continue;
// Check all spell levels (0-9)
for (iSpellLevel = nSpellLevel; iSpellLevel <= 9; iSpellLevel++)
{
string sKnownList = "KnownList" + IntToString(iSpellLevel);
json jKnownList = GffGetList(jClass, sKnownList);
if (jKnownList == JsonNull()) continue;
int nSpellCount = JsonGetLength(jKnownList);
// Start from saved index if same class and level, otherwise start from 0
int nStartIndex = (iClass == nClassIndex && iSpellLevel == nSpellLevel) ? nSpellIndex : 0;
for (iSpell = nStartIndex; iSpell < nSpellCount; iSpell++)
{
json jSpell = JsonArrayGet(jKnownList, iSpell);
if (jSpell == JsonNull()) continue;
json jSpellID = GffGetWord(jSpell, "Spell");
if (jSpellID != JsonNull())
{
int nSpellID = JsonGetInt(jSpellID);
// Update tracking variables for next call
SetLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX", iClass);
SetLocalInt(GetModule(), "JSON_SPELL_LEVEL", iSpellLevel);
SetLocalInt(GetModule(), "JSON_SPELL_INDEX", iSpell + 1);
return nSpellID;
}
}
// Reset spell index for next spell level
nSpellIndex = 0;
}
// Reset spell level for next class
nSpellLevel = 0;
}
// Clean up when done
DeleteLocalJson(GetModule(), "JSON_SPELL_CREATURE");
DeleteLocalInt(GetModule(), "JSON_SPELL_CLASS_INDEX");
DeleteLocalInt(GetModule(), "JSON_SPELL_LEVEL");
DeleteLocalInt(GetModule(), "JSON_SPELL_INDEX");
return -1; // No more spells found
}
//:: Returns the Constitution value from a GFF creature UTC
int json_GetCONValue(json jCreature)
{

View File

@@ -249,7 +249,7 @@ void CancelGreatFeats(object oSpawn)
else if(GetHasFeat(FEAT_EPIC_GREAT_CHARISMA_1, oSpawn)) nGreatCha = 1;
//apply penalties to counter the GreatX feats
if(GetPRCSwitch(PRC_NWNX_FUNCS))
if(GetPRCSwitch(PRC_NWNXEE_ENABLED))
{
if(nGreatStr) PRC_Funcs_ModAbilityScore(oSpawn, ABILITY_STRENGTH, -nGreatStr);
if(nGreatDex) PRC_Funcs_ModAbilityScore(oSpawn, ABILITY_DEXTERITY, -nGreatDex);

View File

@@ -3098,7 +3098,7 @@ void HandleApplyShiftTemplate(object oPC)
int PnPShifterFeats()
{
if(GetPRCSwitch(PRC_NWNX_FUNCS))
if(GetPRCSwitch(PRC_NWNXEE_ENABLED))
{
//If any stats have been changed by NWNX, this could qualify the PC for feats they should
//not actually qualify for, so force unshifting before levelling up.

View File

@@ -2393,7 +2393,15 @@ const string PRC_XP_MAX_LEVEL_DIFF = "PRC_XP_MAX_LEVEL_DIFF";
*/
const string PRC_XP_GIVE_XP_TO_NON_PC_FACTIONS = "PRC_XP_GIVE_XP_TO_NON_PC_FACTIONS";
/******************************************************************************\
* NWNxEE switches *
\******************************************************************************/
//:: This switch enables the PRC8 -> NWNxEE shims. Don't use without NWNxEE
const string PRC_PRCX_ENABLED = "PRC_PRCX_ENABLED";
//:: This switch is set automatically after prc_onmodload detects NWNxEE.
const string PRC_NWNXEE_ENABLED = "PRC_NWNXEE_ENABLED";
/******************************************************************************\
@@ -2517,10 +2525,6 @@ const string PRC_LETOSCRIPT_PORTAL_PASSWORD = "PRC_LETOSCRIPT_PORTAL_PA
*/
const string PRC_LETOSCRIPT_GETNEWESTBIC = "PRC_LETOSCRIPT_GETNEWESTBIC";
//This switch is set automatically after prc_onmodload detects NWNX_Funcs plugin
const string PRC_NWNX_FUNCS = "PRC_NWNX_FUNCS";
/******************************************************************************\
* ConvoCC switches [DEFUNCT] *
\******************************************************************************/

View File

@@ -93,7 +93,9 @@ struct _prc_inc_ability_info_struct _prc_inc_CountItemAbilities(object oCreature
struct _prc_inc_ability_info_struct _prc_inc_shifter_GetAbilityInfo(object oTemplate, object oShifter)
{
int bFuncs = GetPRCSwitch(PRC_NWNX_FUNCS);
int nNWNxEE = GetPRCSwitch(PRC_NWNXEE_ENABLED);
int nPRCx = GetPRCSwitch(PRC_PRCX_ENABLED);
int bFuncs = (nNWNxEE && nPRCx);
//Initialize with item ability bonuses