111 lines
2.3 KiB
Plaintext
111 lines
2.3 KiB
Plaintext
#include "nw_i0_tool"
|
|
#include "rd_treasure"
|
|
|
|
void GivePartyMagicItem(object oPC);
|
|
void GivePartyQuestPoints(object oPC, int iQuestPoints);
|
|
|
|
void main()
|
|
{
|
|
object oHench;
|
|
object oPC;
|
|
int iReward;
|
|
int iGold;
|
|
int iXP;
|
|
int iChance;
|
|
int iMod;
|
|
int iLevel;
|
|
int iRandom;
|
|
int iPrisoners;
|
|
|
|
oPC=GetPCSpeaker();
|
|
iReward = 0;
|
|
|
|
//Go in opposite order because of removal
|
|
oHench = GetHenchman(oPC,4);
|
|
if (GetLocalInt(oHench,"Freed") == 1)
|
|
{
|
|
SetLocalInt(oHench,"Freed",2);
|
|
RemoveHenchman(oPC,oHench);
|
|
iReward++;
|
|
}
|
|
|
|
oHench = GetHenchman(oPC,3);
|
|
if (GetLocalInt(oHench,"Freed") == 1)
|
|
{
|
|
SetLocalInt(oHench,"Freed",2);
|
|
RemoveHenchman(oPC,oHench);
|
|
iReward++;
|
|
}
|
|
|
|
oHench = GetHenchman(oPC,2);
|
|
if (GetLocalInt(oHench,"Freed") == 1)
|
|
{
|
|
SetLocalInt(oHench,"Freed",2);
|
|
RemoveHenchman(oPC,oHench);
|
|
iReward++;
|
|
}
|
|
|
|
oHench = GetHenchman(oPC,1);
|
|
if (GetLocalInt(oHench,"Freed") == 1)
|
|
{
|
|
SetLocalInt(oHench,"Freed",2);
|
|
RemoveHenchman(oPC,oHench);
|
|
iReward++;
|
|
}
|
|
|
|
|
|
iLevel = GetHitDice(oPC);
|
|
if (iLevel < 20)
|
|
iMod = iLevel/5 + 1;
|
|
else
|
|
iMod = (iLevel-20)/8 + 5;
|
|
|
|
iGold = 50 * iReward * iMod;
|
|
iXP = 100 * iReward * iMod;
|
|
iChance = iLevel/4 + iReward;
|
|
|
|
RewardPartyXP(iXP, GetPCSpeaker());
|
|
RewardPartyGP(iGold, GetPCSpeaker());
|
|
|
|
iRandom = Random(100);
|
|
|
|
iPrisoners = GetLocalInt(oPC,"Prisoners");
|
|
iPrisoners = iPrisoners + iReward;
|
|
SetLocalInt(oPC,"Prisoners",iReward);
|
|
|
|
if (iRandom < iChance)
|
|
GivePartyMagicItem(GetPCSpeaker());
|
|
|
|
GivePartyQuestPoints(oPC,iReward);
|
|
|
|
}
|
|
|
|
void GivePartyMagicItem(object oPC)
|
|
{
|
|
|
|
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
|
|
while (GetIsObjectValid(oPartyMember) == TRUE)
|
|
{
|
|
GetMagicItem(oPartyMember,TRUE,TRUE);
|
|
oPartyMember = GetNextFactionMember(oPC, TRUE);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void GivePartyQuestPoints(object oPC, int iQuestPoints)
|
|
{
|
|
int iQuest;
|
|
|
|
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
|
|
while (GetIsObjectValid(oPartyMember) == TRUE)
|
|
{
|
|
iQuest = GetLocalInt(oPartyMember,"QuestPoints");
|
|
iQuest = iQuest + iQuestPoints;
|
|
AdjustAlignment(oPartyMember,ALIGNMENT_GOOD,iQuestPoints);
|
|
SetLocalInt(oPartyMember,"QuestPoints",iQuest);
|
|
SendMessageToPC(oPartyMember,"You have been given " + IntToString(iQuestPoints) + " quest points. You now have " + IntToString(iQuest) + ".");
|
|
oPartyMember = GetNextFactionMember(oPC, TRUE);
|
|
}
|
|
}
|