generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
42
_module/nss/trgs_onunlock_xp.nss
Normal file
42
_module/nss/trgs_onunlock_xp.nss
Normal file
@@ -0,0 +1,42 @@
|
||||
// Handles unlocking of a chest or door to give the player experience for
|
||||
// unlocking it. The formula by default is 5xp * the DC (minus 10) of the chest minus
|
||||
// 5 * the number of Rogue levels the PC has. Low-levels and non-rogues are
|
||||
// rewarded more for excelling in lock-picking because it is easier for real
|
||||
// rogues, who don't need to use potions or lockpicks to succeed.
|
||||
#include "trgs_i0_respawn"
|
||||
#include "prc_class_const"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPicked = OBJECT_SELF;
|
||||
object oPicker = GetLastUnlocked();
|
||||
string sOnce = "UNLOCK_DO_ONCE";
|
||||
if ( !GetLocalInt( oPicked, sOnce ) )
|
||||
{
|
||||
object oPC = GetLastUnlocked();
|
||||
int nThief = GetLevelByClass(CLASS_TYPE_ROGUE, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_SCOUT, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_BEGUILER, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_NINJA, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_FACTOTUM, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_ASSASSIN, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_ARCTRICK, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_HANDOTWM, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_NIGHTSHADE, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_NINJA_SPY, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_SHADOWLORD, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_SHADOW_SUN_NINJA, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_SHADOW_THIEF_AMN, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_UNSEEN_SEER, oPC)
|
||||
+ GetLevelByClass(CLASS_TYPE_PSYCHIC_ROGUE, oPC);
|
||||
|
||||
int nDC = ( GetLockUnlockDC( oPicked ) - 10 );
|
||||
if ( nDC < 10 )
|
||||
nDC = 10;
|
||||
int nXP = ( nDC * DEFAULT_UNLOCK_XP ) - ( nThief * DEFAULT_UNLOCK_XP );
|
||||
if ( nXP < DEFAULT_UNLOCK_XP )
|
||||
nXP = DEFAULT_UNLOCK_XP;
|
||||
GiveXPToCreature( oPicker, nXP );
|
||||
SetLocalInt( oPicked, sOnce, TRUE );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user