Aantioch_Infernum/_module/nss/_oncliententer.nss
2023-09-03 21:12:26 -05:00

95 lines
2.4 KiB
Plaintext

void Login(object oPC)
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
string sPrint;
sPrint = "Player Name: "+ GetName(oPC)+"\n";
sPrint =sPrint + "Player IP Address: "+ GetPCIPAddress(oPC)+"\n";
sPrint =sPrint + "Player Logon: "+ GetPCPlayerName(oPC)+"\n";
sPrint =sPrint + "Player CDKEY: "+ GetPCPublicCDKey(oPC)+"\n";
sPrint =sPrint + "\n";
PrintString(sPrint);
SendMessageToPC(oPC,"User Details Recorded");
if (GetCurrentHitPoints(oPC)<=0)
{
effect eKill = EffectDeath(TRUE);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eKill,oPC);
}
//xp loss quest
int nInt = GetCampaignInt("deathquest","exp_loss",oPC);
if(nInt==1)
{
ExecuteScript("lose_xp_quest_oc",oPC);
//DelayCommand(1.75, PopUpDeathGUIPanel(oPC, FALSE, TRUE));
}
}
string sLevels;
int FindPreviousLevel( string sVar )
{
string sTmp;
int iPos = FindSubString( sLevels, sVar );
if ( iPos > -1 )
{
iPos += GetStringLength( sVar);
while ( GetSubString( sLevels, iPos, 1 ) != ";" )
sTmp += GetSubString( sLevels, iPos++, 1 );
if ( sTmp != "" )
{
return StringToInt( sTmp );
}
}
return -100;
}
void main()
{
int index, iLev, iCurLev;
object oPC = GetEnteringObject();
sLevels = GetCampaignString( "mycampaign", GetName( oPC ) + "Levels" );
if ( sLevels != "" )
{
iCurLev = GetCurrentHitPoints( oPC );
iLev = FindPreviousLevel( "HP=" );
if ( iLev > -100 && iCurLev > iLev )
{
effect eDamage = EffectDamage( iCurLev - iLev, DAMAGE_TYPE_DIVINE, DAMAGE_POWER_ENERGY );
ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC );
}
for( index = 0; index < 622; index++ )
{
iCurLev = GetHasSpell( index, oPC );
if ( iCurLev > 0 )
{
iLev = FindPreviousLevel( "S" + IntToString( index ) + "=" );
if ( iLev == -100 )
iLev = 0;
while ( iLev < iCurLev )
{
DecrementRemainingSpellUses( oPC, index );
iLev++;
}
}
}
for( index = 0; index < 480; index++ )
{
iCurLev = GetHasFeat( index, oPC );
if ( iCurLev > 0 )
{
iLev = FindPreviousLevel( "F" + IntToString( index ) + "=" );
if ( iLev == -100 )
iLev = 0;
while ( iLev < iCurLev )
{
DecrementRemainingFeatUses( oPC, index );
iLev++;
}
}
}
}
Login(oPC);
}