Fixed GP rewards

Fixed GP rewards.  Full compile.  Updated release archive.
This commit is contained in:
Jaysyn904 2024-03-16 21:07:38 -04:00
parent 2c45423f42
commit 6c49e71ecc
3 changed files with 104 additions and 10 deletions

Binary file not shown.

View File

@ -3,11 +3,12 @@
/*
PRC's OnDeath event handler for NPCs.
Just hands out XP
Hands out GP & Loot
*/
//:://////////////////////////////////////////////////
#include "x0_i0_partywide"
#include "prc_inc_racial"
#include "inc_debug"
void RndDropGear(object oSelf, object oKiller);
@ -17,23 +18,40 @@ void RndDropGold(object oSelf, object oKiller)
{
//:: Declare major variables
int iHD = GetHitDice(oKiller);
int iInt = GetAbilityScore(oKiller, ABILITY_INTELLIGENCE, TRUE);
int iIntB = GetAbilityModifier(ABILITY_INTELLIGENCE, oKiller);
int iRacial = GetRacialType(oKiller);
int iHD = GetHitDice(oSelf);
int iInt = GetAbilityScore(oSelf, ABILITY_INTELLIGENCE, TRUE);
int iIntB = GetAbilityModifier(ABILITY_INTELLIGENCE, oSelf);
int iRacial = GetRacialType(oSelf);
int iBaseGP = 1;
int iRewardGP;
int iPartyGP;
if(DEBUG)
{
FloatingTextStringOnCreature("RndDropGold: Dead Mob is "+GetName(oSelf), oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGold: oKiller is "+GetName(oKiller), oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGold: Dead Mob had "+IntToString(iHD)+" Hit Dice.", oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGold: Dead Mob had "+IntToString(iInt)+" INT.", oKiller, FALSE);
}
//:: Take one off GetNumberPartyMembers(), see known bugs
int nMembers = GetNumberPartyMembers(oKiller) - 1;
int nMembers = GetNumberPartyMembers(oKiller); //- 1;
if (iIntB < 0) { iIntB = 0;}
if (iIntB < 0) { iIntB = 1;}
iRewardGP = (iBaseGP * d4(1)) + (iIntB * d4(1)) + (iHD * 5);
iPartyGP = iRewardGP * nMembers;
if(DEBUG)
{
FloatingTextStringOnCreature("RndDropGold: Party has "+IntToString(nMembers)+" Members.", oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGold: iRewardGP equals "+IntToString(iRewardGP)+" GP.", oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGold: iPartyGP equals "+IntToString(iPartyGP)+" GP.", oKiller, FALSE);
}
if (iRacial == RACIAL_TYPE_ANIMAL ||
iRacial == RACIAL_TYPE_BEAST ||
iRacial == RACIAL_TYPE_MAGICAL_BEAST ||
@ -42,18 +60,21 @@ void RndDropGold(object oSelf, object oKiller)
iRacial == RACIAL_TYPE_PLANT ||
iRacial == RACIAL_TYPE_VERMIN)
{
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure", oKiller, FALSE);}
iPartyGP = 0;
}
if (iInt <= 5 &&
if (iInt < 4 &&
iRacial == RACIAL_TYPE_UNDEAD ||
iRacial == RACIAL_TYPE_ELEMENTAL)
{
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure [LOWINT]", oKiller, FALSE);}
iPartyGP = 0;
}
if (iPartyGP > 1)
{
{
if(DEBUG) {FloatingTextStringOnCreature("Reward gold "+IntToString(iPartyGP), oKiller, FALSE);}
GiveGoldToAll(oKiller, iPartyGP);
}
}
@ -92,6 +113,73 @@ void RndDropGear(object oSelf, object oKiller)
int bDropLeftRing = d100() > 97;
int bDropRightRing = d100() > 97;
if (!GetIsObjectValid(oArmor))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping armor", oKiller, FALSE);}
bDropArmor = 0;
}
if (!GetIsObjectValid(oWeapon))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping weapon", oKiller, FALSE);}
bDropWeapon = 0;
}
if (!GetIsObjectValid(oShield))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping shield", oKiller, FALSE);}
bDropShield = 0;
}
if (!GetIsObjectValid(oHelm))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping helmet", oKiller, FALSE);}
bDropHelm = 0;
}
if (!GetIsObjectValid(oNecklace))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping necklace", oKiller, FALSE);}
bDropNecklace = 0;
}
if (!GetIsObjectValid(oArrows))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping arrows", oKiller, FALSE);}
bDropArrows = 0;
}
if (!GetIsObjectValid(oBelt))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping belt", oKiller, FALSE);}
bDropBelt = 0;
}
if (!GetIsObjectValid(oBolts))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping bolts", oKiller, FALSE);}
bDropBolts = 0;
}
if (!GetIsObjectValid(oBoots))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping boots", oKiller, FALSE);}
bDropBoots = 0;
}
if (!GetIsObjectValid(oBullets))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping bullets", oKiller, FALSE);}
bDropBullets = 0;
}
if (!GetIsObjectValid(oCloak))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping cloak", oKiller, FALSE);}
bDropCloak = 0;
}
if (!GetIsObjectValid(oLeftRing))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping left ring", oKiller, FALSE);}
bDropLeftRing = 0;
}
if (!GetIsObjectValid(oRightRing))
{
if(DEBUG) {FloatingTextStringOnCreature("Not dropping right ring", oKiller, FALSE);}
bDropRightRing = 0;
}
//:: Set Droppable Flag as determined above.
SetDroppableFlag(oArmor, bDropArmor);
SetDroppableFlag(oWeapon, bDropWeapon);
@ -112,10 +200,10 @@ void RndDropGear(object oSelf, object oKiller)
!bDropArrows && !bDropBelt && !bDropBolts && !bDropBoots && !bDropBullets && !bDropCloak &&
!bDropLeftRing && !bDropRightRing)
{
if(DEBUG) {FloatingTextStringOnCreature("No loot, running RndDropGold", oKiller, FALSE);}
RndDropGold(oSelf, oKiller);
}
}
void main()
{
@ -123,5 +211,11 @@ void main()
object oKiller = GetLastKiller();
object oSelf = OBJECT_SELF;
if(DEBUG)
{
FloatingTextStringOnCreature("RndDropGear: Dead Mob is "+GetName(oSelf), oKiller, FALSE);
FloatingTextStringOnCreature("RndDropGear: oKiller is "+GetName(oKiller), oKiller, FALSE);
}
RndDropGear(oSelf, oKiller);
}