Initial Commit
Initial Commit [v1.32PRC8]
This commit is contained in:
94
_module/nss/mod_rest.nss
Normal file
94
_module/nss/mod_rest.nss
Normal file
@@ -0,0 +1,94 @@
|
||||
//#include "nw_i0_plot"
|
||||
#include "rd_treasure"
|
||||
#include "utl_i_sqluuid"
|
||||
#include "utl_i_sqlocals"
|
||||
|
||||
int HasHenchman(object oPC);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastPCRested();
|
||||
object oItem;
|
||||
|
||||
int iGold;
|
||||
int iGoldNow;
|
||||
int iGoldTake;
|
||||
|
||||
if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED)
|
||||
{
|
||||
SetLocalInt(oPC,"ArenaHasFought",0);
|
||||
if (HasHenchman(oPC))
|
||||
{
|
||||
iGold = SQLocalsUUID_GetInt(oPC,"RestGold");
|
||||
iGoldNow = GetGold(oPC);
|
||||
SQLocalsUUID_SetInt(oPC,"RestGold",iGoldNow);
|
||||
if (iGoldNow>iGold)
|
||||
{
|
||||
iGoldTake = (iGoldNow-iGold)/10;
|
||||
if (iGoldTake>0)
|
||||
{
|
||||
SendMessageToPC(oPC,"Your henchman takes " + IntToString(iGoldTake) + " gold pieces as his share of the spoils.");
|
||||
//DelayCommand(0.1f,TakeGold(iGoldTake,oPC));
|
||||
DelayCommand(0.1f,AssignCommand(oPC,TakeGoldFromCreature(iGoldTake,oPC,TRUE)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SQLocalsUUID_GetInt(oPC,"SpecialPowers") > 0)
|
||||
CreateSpecialPowers(oPC);
|
||||
if (SQLocalsUUID_GetInt(oPC,"SuperPowers") > 0)
|
||||
CreateSuperPowers(oPC);
|
||||
if (SQLocalsUUID_GetInt(oPC,"EvilPath") > 0)
|
||||
{
|
||||
CreateEvilPowers(oPC);
|
||||
object oEvil;
|
||||
oEvil = GetObjectByTag("en4_evil");
|
||||
if (!GetIsObjectValid(oEvil))
|
||||
SendMessageToPC(oPC,"Error: Unable to check faction.");
|
||||
if (GetIsEnemy(oPC,oEvil))
|
||||
{
|
||||
AdjustReputation(oPC,oEvil,50);
|
||||
if (GetIsEnemy(oPC,oEvil))
|
||||
SendMessageToPC(oPC,"Error: Unable to fix faction.");
|
||||
else
|
||||
SendMessageToPC(oPC,"Faction adjusted.");
|
||||
}
|
||||
}
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
||||
if (!GetIsObjectValid(oItem) && GetLevelByClass(CLASS_TYPE_MONK,oPC) > 0)
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);
|
||||
|
||||
if (GetIsObjectValid(oItem))
|
||||
GetSpecialWeaponBonus(oPC,oItem);
|
||||
|
||||
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
|
||||
if (GetIsObjectValid(oItem))
|
||||
GetSpecialWeaponBonus(oPC,oItem);
|
||||
}
|
||||
|
||||
ExportSingleCharacter(oPC);
|
||||
|
||||
}
|
||||
|
||||
int HasHenchman(object oPC)
|
||||
{
|
||||
int iResult;
|
||||
int iIndex;
|
||||
object oHench;
|
||||
|
||||
iResult = FALSE;
|
||||
|
||||
iIndex = 1;
|
||||
while (iIndex < 7)
|
||||
{
|
||||
oHench = GetHenchman(oPC,iIndex);
|
||||
if (GetIsObjectValid(oHench))
|
||||
{
|
||||
if (GetTag(oHench) == SQLocalsUUID_GetString(oPC,"Henchman"))
|
||||
iResult = TRUE;
|
||||
}
|
||||
iIndex++;
|
||||
}
|
||||
|
||||
return iResult;
|
||||
}
|
Reference in New Issue
Block a user