HiddenTradition_PRC8/_module/nss/ro_m_onenterprc.nss
2024-06-20 15:47:42 -04:00

211 lines
5.7 KiB
Plaintext

#include "nw_i0_plot"
//Bladesinger include
//#include "blsg_h"
//PC Werewolf include
//#include "cotw_include"
//PrC restrictions
//#include "jx_prestige_inc"
// -----------------------------------------------
// This code goes in the Module OnClientEnter script.
// When a PC joins the game this code looks for the item "death".
//
// If the item is not found no penalty is applied.
// If the item is found, a Gold and XP penalty is applied.
//Penalty applied for having a Death Amulet
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
// The XP penalty is currently set to the PC's level x 100 - it is
// a harsh penalty, but they were trying to cheat so... :)
//
// If you wish to reduce the amount taken, reduce the 100 in the line below.
// Note that this script will never cause a PC to lose a level.
int nPenalty = 100 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);
// The gold penalty is currently set to 20% of their gold - it is
// a very harsh penalty, but they were trying to cheat so... :)
//
// If you wish to reduce the amount taken, reduce the .20 in the line below.
// Note that this script will never take more then 10,000 gold.
int nGoldToTake = FloatToInt(0.20 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 20000)
{
nGoldToTake = 20000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}
//Use this in your OnClientEnter.
//It rebuilds the prestige resctrictions on oPC.
void JXRebuildPrestige(object oPC);
//Ordinary: Use this in the OnEnter event handler of your module.
//- oPC: The PC in question.
//- bAllow: Allow or disallow.
//
// TRUE = Restricts the classes.
// FALSE = Un-restricts the classes.
//
//- bPermanent: Saves to database, therefore restricting permanently until removed.
//
// TRUE = Restricts even through server restart.
// FALSE = Restricts only until PC leaves and re-enters.
//
//- bSendMessage: Sends a message to the PC letting them know all prestige classes have been restricted or un-restricted.
//
// TRUE = Sends the message.
// FALSE = Does NOT send the message
//
//- bOverride: Whether or not it will be restricted if the PC already has a level in said class.
//
// TRUE = Overrides even if they have the class.
// FALSE = Does not override if the PC has a level in the class.
//
//Function: Restricts prestige classes until the PC earns it.
void RestrictAllPrestigeClasses(object oPC, int bAllow=TRUE, int bPermanent=TRUE, int bSendMessage=TRUE, int bOverride = FALSE);
//Ordinary: Use this in the OnEnter event handler of your module.
//- oPC: The PC in question.
//- nClassType: The class you want to restrict(Must be prestige).
//- bAllow: Allow or disallow.
//
// TRUE = Restricts the class.
// FALSE = Un-restricts the class.
//
//- bPermanent: Saves to database, therefore restricting permanently until removed.
//
// TRUE = Restricts even through server restart.
// FALSE = Restricts only until PC leaves and re-enters.
//
//- bSendMessage: Sends a message to the PC letting them know the class has been restricted or un-restricted.
//
// TRUE = Sends the message.
// FALSE = Does NOT send the message
//
//- bOverride: Whether or not it will be restricted if the PC already has a level in said class.
//
// TRUE = Overrides even if they have the class.
// FALSE = Does not override if the PC has a level in the class.
//
//Function: Restricts prestige class until the PC earns it.
void RestrictPrestigeClass(object oPC, int nClassType, int bAllow=FALSE, int bPermanent=FALSE, int bSendMessage=TRUE, int bOverride = FALSE);
// Main Module OnClientEnter Script
void main()
{
//Bladesinger Setup
//BladeSingerModuleOnEnter();
// Death Amulet Activities
object oPC = GetEnteringObject();
if(HasItem(oPC, "Death"))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
RemoveEffects(oPC);
object oItemToTake;
oItemToTake = GetItemPossessedBy(oPC, "Death");
if(GetIsObjectValid(oItemToTake) != 0)
DestroyObject(oItemToTake);
ApplyPenalty(oPC);
}
//Illegal items removal
// Boots of Speed
object oBoots;
oBoots = GetItemPossessedBy(oPC, "NW_IT_MBOOTS005");
if(GetIsObjectValid(oBoots) != 0)
DestroyObject(oBoots);
// Lesser Ring of Power
object oRing;
oRing = GetItemPossessedBy(oPC, "NW_IT_MRING029");
if(GetIsObjectValid(oRing) != 0)
DestroyObject(oRing);
// Ring of Regeneration
object oRing2;
oRing2 = GetItemPossessedBy(oPC, "NW_IT_MRING004");
if(GetIsObjectValid(oRing2) != 0)
DestroyObject(oRing2);
// Belt of Guiding Light
object oGuidingLight;
oGuidingLight = GetItemPossessedBy(oPC, "nw_it_mbelt016");
if(GetIsObjectValid(oGuidingLight) != 0)
DestroyObject(oGuidingLight);
// Holy Grail
object oGrail;
oGrail = GetItemPossessedBy(oPC, "it_HolyGrail");
if(GetIsObjectValid(oGrail) != 0)
DestroyObject(oGrail);
// Graceblood Bow
object oGraceblood;
oGraceblood = GetItemPossessedBy(oPC, "NW_WBWMXH006");
if(GetIsObjectValid(oGraceblood) != 0)
DestroyObject(oGraceblood);
//Werewolf setup
//DelayCommand (6.0, COTWOnClientEnter (GetEnteringObject()));
}