from toee import *
from utilities import *
from InventoryRespawn import *

def san_dialog( attachee, triggerer ):
	triggerer.begin_dialog( attachee, 1 )
	return SKIP_DEFAULT

def san_first_heartbeat(attachee, triggerer):
	game.timevent_add(respawn, (attachee), 86400000 ) #86400000ms is 24 hours
	game.new_sid = 0
	return RUN_DEFAULT

def san_dying( attachee, triggerer ):
	game.global_flags[297] = 1
	if game.global_flags[294] == 1:
		game.party[0].reputation_add( 24 )
		return RUN_DEFAULT
	game.global_vars[23] = game.global_vars[23] + 1
	if (game.global_vars[23] >= 2):
		game.party[0].reputation_add( 1 )
	return RUN_DEFAULT

def masterwork_timer(npc, pc):
	game.global_vars[33] = 3
	game.timevent_add(masterwork, (npc), 604800000) #604800000ms is one week
	return

def masterwork(attachee):
	box = find_container_near(attachee,1001)
	box.obj_set_int( obj_f_container_inventory_source, 358 )
	game.global_vars[33] = 4
	RespawnInventory(box)
	return

def respawn(attachee):
	box = find_container_near(attachee,1001)
	RespawnInventory(box)
	game.timevent_add(respawn, (attachee), 86400000 ) #86400000ms is 24 hours
	return

