Update for PRC8 parity

Update for PRC8 parity.  Full compile.
This commit is contained in:
Jaysyn904
2025-02-08 14:10:00 -05:00
parent 445bed95fa
commit 00d2c183e8
25 changed files with 25 additions and 25 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -56,7 +56,7 @@ void main()
int nAmount = nBaseAmount + FloatToInt(fExtraPerLevel * nLevel); int nAmount = nBaseAmount + FloatToInt(fExtraPerLevel * nLevel);
object oTmpItem = CreateItemOnObject(sResRef, OBJECT_SELF); object oTmpItem = CreateItemOnObject(sResRef, OBJECT_SELF);
int nPrice = max(GetGoldPieceValue(oTmpItem), 1) * nAmount; int nPrice = PRCMax(GetGoldPieceValue(oTmpItem), 1) * nAmount;
if (sResRef == "GOLD") if (sResRef == "GOLD")
nPrice = 10*nAmount; nPrice = 10*nAmount;

View File

@@ -425,7 +425,7 @@ void chr_OnRest(object oPC, int nRestEvent)
} }
NWNX_Object_SetCurrentHitPoints(oPC, NWNX_Object_SetCurrentHitPoints(oPC,
min(GetMaxHitPoints(oPC), GetLocalInt(oPC, CHR_REST_VAR_HITPOINTS_BEFORE_REST) + 5 + GetHitDice(oPC))); PRCMin(GetMaxHitPoints(oPC), GetLocalInt(oPC, CHR_REST_VAR_HITPOINTS_BEFORE_REST) + 5 + GetHitDice(oPC)));
RemoveBlackScreen(oPC); RemoveBlackScreen(oPC);
DeleteLocalInt(oPC, CHR_REST_VAR_REST_CANCELLED_BY_SCRIPT); DeleteLocalInt(oPC, CHR_REST_VAR_REST_CANCELLED_BY_SCRIPT);

View File

@@ -112,7 +112,7 @@ void main()
} }
else if ((sParams = ParseCommand(sMessage, "#gainitem")) != BADPARSE) else if ((sParams = ParseCommand(sMessage, "#gainitem")) != BADPARSE)
{ {
CreateItemOnObject(sParams, oDM, max(1, StringToInt(sParams))); CreateItemOnObject(sParams, oDM, PRCMax(1, StringToInt(sParams)));
} }
else if ((sParams = ParseCommand(sMessage, "#pat")) != BADPARSE) else if ((sParams = ParseCommand(sMessage, "#pat")) != BADPARSE)
{ {

View File

@@ -161,7 +161,7 @@ void fctn_UpdateReputation(object creature)
int relation = StringToInt(NWNX_SQL_ReadDataInActiveRow(1)); int relation = StringToInt(NWNX_SQL_ReadDataInActiveRow(1));
if (GetLocalInt(creature, "FACTION_SPARRING_MODE")) if (GetLocalInt(creature, "FACTION_SPARRING_MODE"))
relation = min(50, relation); relation = PRCMin(50, relation);
object rep = fctn_GetRepresentative(other); object rep = fctn_GetRepresentative(other);

View File

@@ -306,7 +306,7 @@ int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID)
// Just create it before trying to select in case it doesn't exist yet. // Just create it before trying to select in case it doesn't exist yet.
CreateArrayTable(tag, obj); CreateArrayTable(tag, obj);
stmt = "SELECT IFNULL(MIN(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; stmt = "SELECT IFNULL(PRCMin(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element";
sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX); SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX);

View File

@@ -65,7 +65,7 @@ void main()
int nLevel = util_GetLevel(oPC); int nLevel = util_GetLevel(oPC);
int nINT = GetAbilityScore(oPC, ABILITY_INTELLIGENCE, TRUE); int nINT = GetAbilityScore(oPC, ABILITY_INTELLIGENCE, TRUE);
int nMaxBankedSkillPoints = max(1, 1+(nINT - 10)/2); int nMaxBankedSkillPoints = PRCMax(1, 1+(nINT - 10)/2);
if (NWNX_Creature_GetSkillPointsRemaining(oPC) > nMaxBankedSkillPoints) if (NWNX_Creature_GetSkillPointsRemaining(oPC) > nMaxBankedSkillPoints)
{ {
int nXP = GetXP(oPC); int nXP = GetXP(oPC);

View File

@@ -300,7 +300,7 @@ void Array_Erase(string tag, int index, object obj=OBJECT_INVALID)
// if not found, return INVALID_INDEX // if not found, return INVALID_INDEX
int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID) int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID)
{ {
string stmt = "SELECT IFNULL(MIN(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element"; string stmt = "SELECT IFNULL(PRCMin(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element";
sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt); sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX); SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX);
SqlBindString(sqlQuery, "@element", element); SqlBindString(sqlQuery, "@element", element);

View File

@@ -184,7 +184,7 @@ int NWNX_Redis_BRPOPLPUSH(
* Time complexity: O(log(N)) with N being the number of elements in the sorted set. * Time complexity: O(log(N)) with N being the number of elements in the sorted set.
* Annotated return value: array * Annotated return value: array
*/ */
int NWNX_Redis_BZPOPMIN( int NWNX_Redis_BZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int timeout int timeout
@@ -2615,7 +2615,7 @@ int NWNX_Redis_ZPOPMAX(
* being the number of elements popped. * being the number of elements popped.
* Annotated return value: array * Annotated return value: array
*/ */
int NWNX_Redis_ZPOPMIN( int NWNX_Redis_ZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int count = 0 int count = 0
@@ -3382,7 +3382,7 @@ int NWNX_Redis_BRPOPLPUSH(
return NWNXPopInt(); return NWNXPopInt();
} }
int NWNX_Redis_BZPOPMIN( int NWNX_Redis_BZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int timeout int timeout
@@ -5342,7 +5342,7 @@ int NWNX_Redis_ZPOPMAX(
return NWNXPopInt(); return NWNXPopInt();
} }
int NWNX_Redis_ZPOPMIN( int NWNX_Redis_ZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int count = 0 int count = 0

View File

@@ -179,7 +179,7 @@ int BRPOPLPUSH(
* Time complexity: O(log(N)) with N being the number of elements in the sorted set. * Time complexity: O(log(N)) with N being the number of elements in the sorted set.
* Annotated return value: array * Annotated return value: array
*/ */
int BZPOPMIN( int BZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int timeout int timeout
@@ -2610,7 +2610,7 @@ int ZPOPMAX(
* being the number of elements popped. * being the number of elements popped.
* Annotated return value: array * Annotated return value: array
*/ */
int ZPOPMIN( int ZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int count = 0 int count = 0
@@ -3377,7 +3377,7 @@ int BRPOPLPUSH(
return NWNXPopInt(); return NWNXPopInt();
} }
int BZPOPMIN( int BZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int timeout int timeout
@@ -5337,7 +5337,7 @@ int ZPOPMAX(
return NWNXPopInt(); return NWNXPopInt();
} }
int ZPOPMIN( int ZPOPPRCMin(
string key, string key,
// Redis type: integer // Redis type: integer
int count = 0 int count = 0

View File

@@ -54,7 +54,7 @@ void main()
if (nExtra > 0) if (nExtra > 0)
{ {
int nPercent = (nExtra*100) / nHeavyEnc; int nPercent = (nExtra*100) / nHeavyEnc;
nPercent = min(99, nPercent); nPercent = PRCMin(99, nPercent);
nFallChance += nPercent/2; nFallChance += nPercent/2;
if (bSidestep) if (bSidestep)

View File

@@ -50,7 +50,7 @@ struct missiles GetMissiles(int nSpellId, object oCaster, int nMetaMagic)
case SPELL_SHADOW_CONJURATION_MAGIC_MISSILE: case SPELL_SHADOW_CONJURATION_MAGIC_MISSILE:
m.vfx = VFX_IMP_MIRV; m.vfx = VFX_IMP_MIRV;
m.vfximpact = VFX_IMP_MAGBLUE; m.vfximpact = VFX_IMP_MAGBLUE;
m.count = min((1+nCasterLevel)/2, 5); m.count = PRCMin((1+nCasterLevel)/2, 5);
m.numdice = 1; m.numdice = 1;
m.whichdice = 4; m.whichdice = 4;
m.dmgmod = 1; m.dmgmod = 1;
@@ -60,7 +60,7 @@ struct missiles GetMissiles(int nSpellId, object oCaster, int nMetaMagic)
case SPELL_ISAACS_LESSER_MISSILE_STORM: case SPELL_ISAACS_LESSER_MISSILE_STORM:
m.vfx = VFX_IMP_MIRV; m.vfx = VFX_IMP_MIRV;
m.vfximpact = VFX_IMP_MAGBLUE; m.vfximpact = VFX_IMP_MAGBLUE;
m.count = min(nCasterLevel, 10); m.count = PRCMin(nCasterLevel, 10);
m.numdice = 1; m.numdice = 1;
m.whichdice = 6; m.whichdice = 6;
m.dmgmod = 0; m.dmgmod = 0;
@@ -70,7 +70,7 @@ struct missiles GetMissiles(int nSpellId, object oCaster, int nMetaMagic)
case SPELL_ISAACS_GREATER_MISSILE_STORM: case SPELL_ISAACS_GREATER_MISSILE_STORM:
m.vfx = VFX_IMP_MIRV; m.vfx = VFX_IMP_MIRV;
m.vfximpact = VFX_IMP_MAGBLUE; m.vfximpact = VFX_IMP_MAGBLUE;
m.count = min(nCasterLevel, 20); m.count = PRCMin(nCasterLevel, 20);
m.numdice = 2; m.numdice = 2;
m.whichdice = 6; m.whichdice = 6;
m.dmgmod = 0; m.dmgmod = 0;
@@ -80,7 +80,7 @@ struct missiles GetMissiles(int nSpellId, object oCaster, int nMetaMagic)
case SPELL_BALL_LIGHTNING: case SPELL_BALL_LIGHTNING:
m.vfx = VFX_IMP_MIRV_ELECTRIC; m.vfx = VFX_IMP_MIRV_ELECTRIC;
m.vfximpact = VFX_IMP_LIGHTNING_S; m.vfximpact = VFX_IMP_LIGHTNING_S;
m.count = min(nCasterLevel, 15); m.count = PRCMin(nCasterLevel, 15);
m.numdice = 1; m.numdice = 1;
m.whichdice = 6; m.whichdice = 6;
m.dmgmod = 0; m.dmgmod = 0;
@@ -100,7 +100,7 @@ struct missiles GetMissiles(int nSpellId, object oCaster, int nMetaMagic)
case SPELL_FIREBRAND: case SPELL_FIREBRAND:
m.vfx = VFX_IMP_MIRV_FLAME; m.vfx = VFX_IMP_MIRV_FLAME;
m.vfximpact = VFX_IMP_FLAME_M; m.vfximpact = VFX_IMP_FLAME_M;
m.count = min(nCasterLevel, 15); m.count = PRCMin(nCasterLevel, 15);
m.numdice = 1; m.numdice = 1;
m.whichdice = 6; m.whichdice = 6;
m.dmgmod = nCasterLevel; m.dmgmod = nCasterLevel;

View File

@@ -238,9 +238,9 @@ void main()
AddItemEnhancementEffect(oOffHand, fDuration, 1); AddItemEnhancementEffect(oOffHand, fDuration, 1);
break; break;
case SPELL_GREATER_MAGIC_WEAPON: case SPELL_GREATER_MAGIC_WEAPON:
AddItemEnhancementEffect(oWeapon, fDuration, min(nCasterLvl/3, 3)); AddItemEnhancementEffect(oWeapon, fDuration, PRCMin(nCasterLvl/3, 3));
if (nApplyToOffHand) if (nApplyToOffHand)
AddItemEnhancementEffect(oOffHand, fDuration, min(nCasterLvl/3, 3)); AddItemEnhancementEffect(oOffHand, fDuration, PRCMin(nCasterLvl/3, 3));
break; break;
case SPELL_KEEN_EDGE: case SPELL_KEEN_EDGE:
AddKeenEffectToWeapon(oWeapon, fDuration); AddKeenEffectToWeapon(oWeapon, fDuration);

View File

@@ -42,8 +42,8 @@ location util_DecodeLocation(string s);
int util_IsWeapon(object oItem); int util_IsWeapon(object oItem);
//int max(int a, int b) { return (a>b) ? a : b; } //:: Defined exactly the same in the PRC's //int PRCMax(int a, int b) { return (a>b) ? a : b; } //:: Defined exactly the same in the PRC's
//int min(int a, int b) { return (a<b) ? a : b; } //:: inc_utility.nss //int PRCMin(int a, int b) { return (a<b) ? a : b; } //:: inc_utility.nss
void util_ClearInventory(object o) void util_ClearInventory(object o)
{ {