"use strict";

DATA_SDS_DIALOGUE["Ned_c1_advice_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Ned",
		script: [
			{command:"buffer", text:"Looking for Fred?  He's up fixing the gate.  It's about time he did something useful.\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Ned_c1_quake_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Ned",
		script: [
			{command:"buffer", text:"After all that hard work I did to fix the gate, now it's stuck again!  Maybe if Fred had helped me at all, it would have held up better...\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Ned_c1_hurry_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Ned",
		script: [
			{command:"buffer", text:"Guy's possessed!  He's gone crazy!  He keeps chucking huge rocks around and shouting about you!  I'd stay away if I were you...\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Ned_c1_boss_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Ned",
		script: [
			{command:"buffer", text:"Good greif!  You've completely dislodged the gate!  If it weren't so heavy, someone could just yank it out!\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Ned_c2_leaving_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Ned",
		script: [
			{command:"buffer", text:"We've both got to stand guard until Fred gets his act together and builds a new gate.\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Ned_c5_advice_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Meli",
		script: [
			{command:"buffer", text:"(I accomplish less than he does, and that's saying something.  I should just leave.)\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

Dialogue_getCurrentEvent["Ned"] = function(){
		var retval = null;
		var line = 0;
		if (GLOBAL_SCRATCHPAD.check("Dlg_Ned_Line")){
			line = GLOBAL_SCRATCHPAD.check("Dlg_Ned_Line");
		}

		if (GLOBAL_DIARY.check(5,"BOSS",true)){
			retval = "GD_Ned_c2_leaving_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(5,"AWAKE")){
			retval = "GD_Ned_c5_advice_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(2,"LEAVING_HOME")){
			retval = "GD_Ned_c2_leaving_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(1,"BOSS")){
			retval = "GD_Ned_c1_boss_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(1,"HURRY")){
			retval = "GD_Ned_c1_hurry_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(1,"SHRINEQUAKE")){
			retval = "GD_Ned_c1_quake_"+line;
			line = Math.min(line+1,0);
		}
		else{ // nothing to say
			retval = "GD_Ned_c1_advice_"+line;
			line = Math.min(line+1,0);
		}
		GLOBAL_SCRATCHPAD.note("Dlg_Ned_Line",line);
		return retval;
	};
	
	