from utilities import *
from toee import *
import _include
from co8Util.TimedEvent import *


def san_dialog( attachee, triggerer ):
	if (game.global_flags[127] == 0):
		triggerer.begin_dialog( attachee, 1 )
	else:
		triggerer.begin_dialog( attachee, 140 )
	return SKIP_DEFAULT

def run_off( attachee, triggerer ):
	attachee.runoff(attachee.location-3)
	return RUN_DEFAULT

def set_reward( attachee, triggerer ):
	attachee.runoff(attachee.location-3)
	timedEventAdd(give_reward, (), 336)
	return RUN_DEFAULT

def give_reward():
	game.encounter_queue.append(3002)
	return RUN_DEFAULT

def get_rep( attachee, triggerer ):
	if triggerer.reputation_has( 16 ) == 0:
		triggerer.reputation_add( 16 )
	game.global_vars[26] = game.global_vars[26] + 1
	if ( game.global_vars[26] >= 3 and triggerer.reputation_has( 17 ) == 0):
		triggerer.reputation_add( 17 )
	return RUN_DEFAULT