HoS_PRC8/_mod/_module/nss/wazoo_leochest.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

47 lines
1.6 KiB
Plaintext

// wazoo_leochest - Leomund's Secret Chest Spell
// By Deva Bryson Winblood. 04/06/2005
#include "wazoo_h_lschest"
void main()
{
object oPC=OBJECT_SELF;
object oTarget=GetLocalObject(oPC,"oTarget");
location lLoc=GetLocalLocation(oPC,"lLoc");
int nN;
string sPID=GetLSCPID(oPC);
object oMod=GetModule();
object oChest;
DeleteLocalObject(oPC,"oTarget");
DeleteLocalLocation(oPC,"lLoc");
if (oTarget!=OBJECT_INVALID&&oTarget==oPC)
{ // object was selected
oTarget=GetItemPossessedBy(oPC,"wazoo_it_lsc");
if (GetTag(oTarget)=="wazoo_it_lsc")
{ // fancy box selected
nN=GetLocalInt(oMod,"nWZLSC_Count_"+sPID);
if (nN==0)
{ // safe to create
PreserveContents(oTarget,oPC);
} // safe to create
else
{ // already exists
SendMessageToPC(oPC,"You already have a leomund's chest stored in the ethereal plane! Try casting the spell at the ground to retrieve it. You are only permitted 1 leomund's chest per PC.");
} // already exists
} // fancy box selected
} // object was selected
else
{ // location
nN=GetLocalInt(oMod,"nWZLSC_Count_"+sPID);
if (nN>0)
{ // chest exists
oChest=CreateObject(OBJECT_TYPE_PLACEABLE,"wazoo_pl_sc",lLoc);
DelayCommand(0.5,RestoreContents(oChest,oPC));
} // chest exists
else
{ // empty
SendMessageToPC(oPC,"No Leomund's Chest was found in the ethereal plane or you sent one back empty. Try casting the spell on a fancy chest which is an inventory item which can be found or purchased.");
} // empty
} // location
}