Battledale_PRC8/_module/nss/mod_entering.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

423 lines
9.9 KiB
Plaintext

//Hardcore Client Entering
///Archaegeo 2002 Jun 24
// This script goes in OnClientEnter in Module Properties - Events
// It checks to see if they have a Death Amulet on them, and if so
// It sets thier player state to Dead and rekills them.
#include "database_inc"
#include "rpo_inc"
// removes every instance of items with string sString from object oPC
void RemoveObject (object oPC, string sString);
// Checks if we have a record of the incoming PC's hit points, and if so it
// resets their HP back to what it was when they logged off
void Hitpoints(object oPC);
// Check every item owned by the PC for temporary effects and remove those effects if they exist
void TempEffects (object oPC);
// Should remove any duped craft items
void RemoveDuped (object oPC);
// Should restore their spells correctly
void SetSpells (object oPC);
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC))
{
return;
}
object oHide=GetItemPossessedBy(oPC,"jw_craftfeat_giv");
if (GetIsObjectValid(oHide))
{
SetDroppableFlag(oHide,TRUE);
DestroyObject(oHide);
}
//Checks if player has visited IWD area.
if ((DBGetIWDPermission(oPC))== 0)
{
SetLocalInt(oPC, "IWD", 0);
}
else
{
SetLocalInt(oPC, "IWD", 1);
}
//Check if the PC has permission to play prestige classes. If not, ban them from playing
//the relavant class.
if (DBGetPrestigePermission (oPC,CLASS_TYPE_ASSASSIN))
{
SetLocalInt(oPC, "X1_AllowAsasin", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowAsasin", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_ARCANE_ARCHER))
{
SetLocalInt(oPC, "X1_AllowArcher", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowArcher", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_BLACKGUARD))
{
SetLocalInt(oPC, "X1_AllowBlkGrd", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowBlkGrd", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_HARPER))
{
SetLocalInt(oPC, "X1_AllowHarper", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowHarper", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_SHADOWDANCER))
{
SetLocalInt(oPC, "X1_AllowShadow", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowShadow", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_DWARVENDEFENDER))
{
SetLocalInt(oPC, "X1_AllowDwDef", 0);
}
else
{
SetLocalInt(oPC, "X1_AllowDwDef", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_SHIFTER))
{
SetLocalInt(oPC, "X2_AllowShiftr", 0);
}
else
{
SetLocalInt(oPC, "X2_AllowShiftr", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_WEAPON_MASTER))
{
SetLocalInt(oPC, "X2_AllowWM", 0);
}
else
{
SetLocalInt(oPC, "X2_AllowWM", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_DIVINECHAMPION))
{
SetLocalInt(oPC, "X2_AllowDivcha", 0);
}
else
{
SetLocalInt(oPC, "X2_AllowDivcha", 1);
}
if (DBGetPrestigePermission (oPC, CLASS_TYPE_PALEMASTER))
{
SetLocalInt(oPC, "X2_AllowPalema", 0);
}
else
{
SetLocalInt(oPC, "X2_AllowPalema", 1);
}
// simply dissalow dragon disciple for everone
{
SetLocalInt(oPC, "X1_AllowDrDis", 1);
}
//ENDS THE PART DEALING WITH PRESTIGE CLASSES. I haven't touched this script beyond
//this point.
if ((GetLevelByClass(CLASS_TYPE_BARD,oPC)>4)&&(!GetIsObjectValid(GetItemPossessedBy(oPC,"ah_songbird_call"))))
{
CreateItemOnObject("ah_songbird_call",oPC,1);
SendMessageToPC(oPC,"You have acquired a tiny flute, which may be used to summon your familiar");
}
AddJournalQuestEntry("fr_journal_rp03",1,oPC);
AddJournalQuestEntry("fr_journal_rp",1,oPC);
AddJournalQuestEntry("fr_journal_rp02",1,oPC);
AddJournalQuestEntry("fr_journal_rp04",1,oPC);
AddJournalQuestEntry("jw_journ_hand",1,oPC);
//AddJournalQuestEntry("jw_journ_time",1,oPC);
//AddJournalQuestEntry("jw_journ_time",2,oPC);
AddJournalQuestEntry("jw_druids_journ",1,oPC);
//AddJournalQuestEntry("jw_hotu_journ",1,oPC);
//AddJournalQuestEntry("jw_feats_journ",1,oPC);
//AddJournalQuestEntry("jw_craft_journ",1,oPC);
//AddJournalQuestEntry("jw_shields_journ",1,oPC);
//AddJournalQuestEntry("jw_dyes_journ",1,oPC);
//AddJournalQuestEntry("jw_dyes_journ_2",1,oPC);
//AddJournalQuestEntry("jw_trapsfix_journ",1,oPC);
//AddJournalQuestEntry("jw_crafts_journ",1,oPC);
//AddJournalQuestEntry("jw_newdye_journ",1,oPC);
AddJournalQuestEntry("jw_train_journ",1,oPC);
AddJournalQuestEntry("jw_exp_low",1,oPC);
AddJournalQuestEntry("jw_wings_journ",1,oPC);
AddJournalQuestEntry("jw_journal_fun",1,oPC);
//to move illegal item. Viconius
object oWaxe = GetItemPossessedBy(oPC,"fr_iwd_dwf_axe01");
if(GetIsObjectValid(oWaxe))
{
SetPlotFlag(oWaxe,0);
DestroyObject(oWaxe);
SendMessageToPC(oPC,"You had an illegal axe");
}
object oWring = GetItemPossessedBy(oPC,"fr_iwd_xring");
if(GetIsObjectValid(oWring))
{
SetPlotFlag(oWring,0);
DestroyObject(oWring);
SendMessageToPC(oPC,"You had a wrong ring");
}
/*
if(GetIsDM(oPC))
{
return;
}
*/
/*
if(!GetIsObjectValid(GetItemPossessedBy(oPC,"px_dm_book")))
{
CreateItemOnObject("px_dm_book", oPC);
SendMessageToPC(oPC,"You have recieved a message from the DMs in the form of a book.");
}
*/
// put every PC of level 20 on xp 10,000 below level 21
int nXp=GetXP(oPC);
if (nXp>209000)
{
SetXP(oPC,209000);
}
object oDeathAmulet;
effect eDeath = EffectDeath(FALSE, FALSE);
////
if(GetIsObjectValid(GetItemPossessedBy(oPC,"deathamulet")))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPC);
SetLocalInt(oPC, "PlayerState", PWS_PLAYER_STATE_DEAD);
SetLocalInt(GetModule(), "PWS_EverybodyAlive", FALSE);
}
////
object oTrans=GetItemPossessedBy(oPC,"Palmerstestring");
if (GetIsObjectValid(oTrans))
{
SendMessageToPC(oPC,"Removing Palmer's Very own test ring");
RemoveObject (oPC,"Palmerstestring");
}
// resets their HP
Hitpoints (oPC);
// remove any temporary item properties
TempEffects(oPC);
// remove duped items
RemoveDuped (oPC);
// Set their spells
//SetSpells(oPC);
if(BLEEDSYSTEM && GetLocalInt(oPC,"PlayerState")!=PWS_PLAYER_STATE_DEAD)
{
SetLocalInt(oPC,"PlayerState", PWS_PLAYER_STATE_ALIVE);
}
else if(BLEEDSYSTEM && GetLocalInt(oPC,"PlayerState")!=PWS_PLAYER_STATE_ALIVE)
{
SetLocalInt(oPC,"PlayerState", PWS_PLAYER_STATE_ALIVE);
}
//take imp stone from polymorphing in fire pit
object oPolymorphGem = GetItemPossessedBy(oPC, "NK_FP_POLY");
if (GetIsObjectValid(oPolymorphGem))
{
DestroyObject(oPolymorphGem);
SetStandardFactionReputation(STANDARD_FACTION_HOSTILE , 0, oPC);
}
SendMessageToPC(oPC, "Welcome to Battledale! (http://www.roleplaying-online.com)");
StopFade(oPC); //ensures PCs dont have a black screen
}
void RemoveObject (object oPC, string sString)
{
object oObject = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oObject))
{
if(GetTag(oObject) == sString)
{
SetPlotFlag(oObject,0);
DestroyObject(oObject);
}
oObject = GetNextItemInInventory(oPC);
}
}
void Hitpoints(object oPC)
{
int damage = GetLocalInt(GetModule(), "HP"+GetName(oPC));
if(damage > 0)
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(damage), oPC);
}
void TempEffects (object oPC)
{
itemproperty oProperty;
object oItem= GetFirstItemInInventory(oPC);
// do inventory
while (GetIsObjectValid(oItem))
{
oProperty=GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(oProperty))
{
if(GetItemPropertyDurationType(oProperty)==DURATION_TYPE_TEMPORARY)
{
RemoveItemProperty(oItem,oProperty);
}
oProperty=GetNextItemProperty(oItem);
}
oItem=GetNextItemInInventory(oPC);
}
// do equipped
int nIdx;
for (nIdx=0;nIdx<=18;nIdx++)
{
oItem=GetItemInSlot(nIdx,oPC);
oProperty=GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(oProperty))
{
if(GetItemPropertyDurationType(oProperty)==DURATION_TYPE_TEMPORARY)
{
RemoveItemProperty(oItem,oProperty);
}
oProperty=GetNextItemProperty(oItem);
}
}
}
void RemoveDuped (object oPC)
{
int nIdx;
object oItem;
object oStrip;
// GetLocalInt(oItem,"jw_craft_copy");
for (nIdx=0;nIdx<=18;nIdx++)
{
oItem=GetItemInSlot(nIdx,oPC);
if (GetLocalInt(oItem,"jw_craft_copy")==TRUE||GetLocalInt(oStrip,"STX_CR_TEMPITEM")==TRUE)
{
DestroyObject(oItem);
}
}
oItem=GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
oStrip=oItem;
if (GetLocalInt(oStrip,"jw_craft_copy")==TRUE||GetLocalInt(oStrip,"STX_CR_TEMPITEM")==TRUE)
{
DestroyObject(oStrip);
}
oItem=GetNextItemInInventory(oPC);
}
}
void SetSpells (object oPC)
{
int nSpellCount;
int nSpellCycle=0;
string sIntName;
int nProperAmount;
int nReduceCycle;
object oModule = GetModule();
// Sets a local int on the module called Spell+nameofPC+spellnumber
// Which equals the count of spells the PC should have
while (nSpellCycle <= 599)
{
nSpellCount= GetHasSpell(nSpellCycle, oPC);
if (nSpellCount > 0)
{
sIntName="Spell"+GetName(oPC)+IntToString(nSpellCycle);
nProperAmount=GetLocalInt(oModule,sIntName);
// At this stage nProperAmount is how many they should have and nSpellCycle is how many they
// DO have
// SendMessageToPC(oPC,"DEBUG, checking spell "+IntToString(nSpellCycle)+" of which you have "+IntToString(nSpellCount)+" uses, and the propper amount you should have is "+IntToString(nProperAmount));
while (nProperAmount<nSpellCount)
{
DecrementRemainingSpellUses(oPC,nSpellCycle);
nSpellCount=nSpellCount-1;
}
}
nSpellCycle=nSpellCycle+1;
DeleteLocalInt(oModule,sIntName);
}
}