from toee import *

def san_dialog( attachee, triggerer ):
	if (game.global_flags[835] == 1 and game.global_flags[37] == 0 and game.global_flags[842] == 0 and game.global_flags[839] == 0):
		triggerer.begin_dialog(attachee,300)
	elif (game.party[0].reputation_has( 27 ) == 1): 
		triggerer.begin_dialog( attachee,120)
	elif (attachee.has_met(triggerer)):
		triggerer.begin_dialog( attachee,130)
	else:
		triggerer.begin_dialog(attachee,1)
	return SKIP_DEFAULT

def san_heartbeat( attachee, triggerer ):
	if (attachee.map == 5014 or attachee.map == 5015 or attachee.map == 5016 or attachee.map == 5017 or attachee.map == 5018 or attachee.map == 5019):
		for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
			if (obj.name == 14614 and attachee.can_see(obj)):
				attachee.attack(obj)
				return RUN_DEFAULT
	if (attachee.map == 5015 and game.global_flags[845] == 0 and game.global_flags[846] == 0):
		if (attachee.can_see(game.party[0])):
			game.party[0].begin_dialog( attachee, 200 )
		for obj in game.obj_list_vicinity(attachee.location,OLC_PC):
			if (attachee.can_see(obj)):
				obj.begin_dialog( attachee, 200 )
				
	return RUN_DEFAULT

