// Treasure Chest
#include "NW_O2_CONINCLUDE"
void main()
{
object oItem = OBJECT_INVALID;
// Clear all contents of the chest
oItem = GetFirstItemInInventory();
while ( oItem != OBJECT_INVALID )
{
//Make sure people don't stuff chest with plot items and break it
SetPlotFlag(oItem, FALSE);
DestroyObject( oItem, 0.0 );
oItem = GetNextItemInInventory();
}
// Set respawntime float to the number of seconds.
float respawntime = 1800.00;
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
{
return;
}
object oLastOpener = GetLastOpener();
{
if(GetLevelByClass(CLASS_TYPE_DRUID, GetLastOpenedBy()) >= 1){
GenerateLowTreasure(oLastOpener, OBJECT_SELF);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 12);
CreateItemOnObject("NW_IT_MPOTION020", OBJECT_SELF, 2);
CreateItemOnObject("NW_IT_MPOTION012", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_TORCH001", OBJECT_SELF, 1);}
else if(GetLevelByClass(CLASS_TYPE_RANGER, GetLastOpenedBy()) >= 1){
GenerateLowTreasure(oLastOpener, OBJECT_SELF);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 12);
CreateItemOnObject("NW_IT_MPOTION020", OBJECT_SELF, 2);
CreateItemOnObject("NW_IT_MPOTION012", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_TORCH001", OBJECT_SELF, 1);}
else {}
//Do Nothing
}
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
ShoutDisturbed();
// Command added to delay the respawn
AssignCommand( OBJECT_SELF, DelayCommand (respawntime, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0) ) );
}