Amon_PRC8/_module/nss/client_enter_csx.nss
Jaysyn904 c5cffc37af Initial Commit
Initial Commit [v1.01]
2025-04-03 19:00:46 -04:00

80 lines
1.7 KiB
Plaintext

/*********************************
** Table Top Variant ruleset
**
** On Client Enter event
**
** This is used with the death-code and the
** rest code.
**
** Written by Jay Barnson, 2002
**
*************************************/
#include "horse_include"
#include "enterinc"
#include "pqj_inc"
void main()
{
object oPC = GetEnteringObject();
GPA_HorseOCL(oPC);
SetLocalInt(oPC,"stables",1);
object oAmulet;
object oCorpse;
int hp;
int hpOffset;
int inCombat = 0;
location oPCLoc = GetLocation(oPC);
//KillSpells (oPC,oPCLoc);
RebuildJournalQuestEntries(GetEnteringObject());
if (GetIsPC(oPC))
{
// if hitpoints < 1, bring them up to 1, and kick them back down again
// to fire off their "on dying" script.
// I THINK this only occurs with server-vault characters.
hp = GetCurrentHitPoints(oPC);
if (hp<1)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,
EffectHeal(1-hp),oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT,
EffectDamage(-(hp-1)),oPC);
}
else
{
hpOffset = GetLocalInt(GetModule(),"HPOff_"+GetName(oPC));
if (hpOffset>0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(hpOffset),oPC);
}
}
// If they were in-combat, do some ADDITIONAL damage to them
// (1d4 damage per level of the character).
inCombat = GetLocalInt(GetModule(),"CMBT_"+GetName(oPC));
if (inCombat)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(d4(GetHitDice(oPC))),oPC);
}
}
// Set LastTimeRested = current time - 9 minutes
// (give them 1 minute of "wait time", to limit the exploits
// with exiting & returning...)
if (!inCombat)
SetLocalInt(oPC,"LastTimeRested",GetLocalInt(GetModule(),"SecondCount")-540);
else // They have to wait the full amount if they left in mid-combat.
SetLocalInt(oPC,"LastTimeRested",GetLocalInt(GetModule(),"SecondCount"));
}