"use strict";

DATA_SDS_DIALOGUE["Brill_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: "Beryll",
		script: [
			{command:"buffer", text:"Good gracious- a fishgirl?!  Are you lost?  Did something happen??\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Gar, hon, is there anything we can do for this poor dear?\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c2_leaving_1"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Go talk to my hubby by the bar- he'll have you sorted out in no time!\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_c2_treasure_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: "Beryll",
		script: [
			{command:"buffer", text:"Welcome, welcome!  Apologies for the benches, we don't get many fishfolk actually up in town here.\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I hope you can still make yourself comfortable.  Go ahead and talk to Gar over there if you want to order anything.\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c2_treasure_1"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Are you a friend of Melody's?  I know that's the Goddess necklace she's always wearing.\n"},			//0
			{command:"wait"},
			{command:"buffer", text:"Little Gracie would be, what, 5 years old now?  6?  Old enough to be a handful, at any rate.  I don't blame Mel passing the torch early!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c2_treasure_2"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"What?  O'course I know Melody!\n"},			//0
			{command:"wait"},
			{command:"buffer", text:"She's still been comin' by in her \"official\" capacity with the shrine every now and again.\n"},
			{command:"wait"},
			{command:"buffer", text:"When she first took over from Rinda, tho, she certainly didn't waste the opportunity to just get out and about!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c2_treasure_3"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Great spot for meetin' people, the Frog is; just a shame most of the boys are only ever passin' through...\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_c3_treasure_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: "Beryll",
		script: [
			{command:"buffer", text:"Well, well!  And now you have Yorick's belt!  I guess the situation must be something serious?\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"How is the lad, anyway?  I know he doesn't get out much; would rather have his head in a book any day.  He and that contraption of a shrine were made for each other!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c3_treasure_1"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Oh, but you have better things to do yourself, I'll wager.  That's ok.  I'll just go pay him a visit myself next holiday.\n"},
			{command:"wait"},
			{command:"buffer", text:"Think he'd prefer a basket of bread, or a meat pie?  Or perhaps he's getting old enough to appreciate our ale?\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c3_treasure_2"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"What?  You don't think I should bother?  Oh, honey, sharing is never a difficulty!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_c4_treasure_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: "Beryll",
		script: [
			{command:"buffer", text:"Re-SPLEN-dent!  Positively resplendent!  Why, I don't believe all four Treasures have been seen together in my lifetime!\n"},
			{command:"wait"},
			{command:"buffer", text:"You should get your portrait done, just to preserve the memory!\n"},
			{command:"wait"},
			{command:"buffer", text:"Wouldn't be a bad time to track down Mr. Right either, eh?  First impressions and all that!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c4_treasure_1"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Oh, but of course that isn't why you have them.  I know that.\n"},
			{command:"wait"},
			{command:"buffer", text:"Living here, though, you can't take Malfose's presence too seriously or you'd never get out of bed in the morning.\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c4_treasure_2"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"May the Goddess' blessings be with you, whatever task you have ahead!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"That said, I suppose we should prepare for a visit from old Ezekiel, if he doesn't have any treasure to keep for the moment.\n"},
			{command:"wait"},
			{command:"buffer", text:"He isn't above taking things less seriously himself, and I know he does love our ale!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c4_treasure_3"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"By the by, have you met our new neighbors?\n"},
			{command:"wait"},
			{command:"buffer", text:"I was really starting to worry nobody would ever move back in here, but those kids are born adventurers!\n"},
			{command:"wait"},
			{command:"buffer", text:"Why, I wouldn't be surprised if they have it in them to light up the whole world, not just our little corner of it!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_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:"(Throwing myself a pity party is bad enough.  Having Bryll throw one for me would be an all-time low.)\n"},
			{command:"wait"},
			{command:"buffer", text:"(I'm better off not telling her anything, or just avoiding her outright...)\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_c5_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: "Beryll",
		script: [
			{command:"buffer", text:"Malfose?!\n"},
			{command:"wait"},
			{command:"buffer", text:"Why if you aren't the second person this week to come trying to dig up that boneyard!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Goddess, but you're just as serious as she was, aren't you?\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Alright, yes, this is where that damned Gargoyle came up out of the earth.  Not as if folk don't know that already.\n"},
			{command:"wait"},
			{command:"buffer", text:"Came right up out the town well, I'm told.\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_c5_boss_1"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Of COURSE we rebuilt the well after.  Can't have a town without a town square!\n"},
			{command:"wait"},
			{command:"buffer", text:"I'd be worried about the water, but there's a big old holy stone down there that seems to keep things pure enough.\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Brill_ham_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: "Beryll",
		script: [
			{command:"buffer", text:"Sky's sakes!  How long have you been carrying around the better part of a stone-tenderized wild mountain boar?\n"},
			{command:"wait"},
			{command:"buffer", text:"Very much longer and it's like to spoil!\nCome now- I know the perfect recipe!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_ham_1"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_NOTIFICATION.x,
		y: DEFINE_DIALOGUE_BOX_NOTIFICATION.y,
		width: DEFINE_DIALOGUE_BOX_NOTIFICATION.width,
		height: DEFINE_DIALOGUE_BOX_NOTIFICATION.height,
		pauses: false,
		blocks: true,
		script: [
			{command:"buffer", text:"      [Ground Ham] was taken."},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_ham_2"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"There we are!  The Frog's signature giant ham loaf!  It's been some time since we've been able to put it on the menu.\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"You brought home the bacon, it's only fair I send you off with a slice on the house!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_ham_3"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_LOWER.x,
		y: DEFINE_DIALOGUE_BOX_LOWER.y,
		width: DEFINE_DIALOGUE_BOX_LOWER.width,
		height: DEFINE_DIALOGUE_BOX_LOWER.height,
		pauses: false,
		blocks: true,
		script: [
			{command:"buffer", text:"Received the "},
			{command:"pause", frames: 2},
			{command:"buffer", text:"["},
			{command:"pause", frames: 2},
			{command:"buffer", text:"H"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"a"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"m"},
			{command:"pause", frames: 2},
			{command:"buffer", text:" "},
			{command:"pause", frames: 2},
			{command:"buffer", text:"L"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"o"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"a"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"f"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"]"},
			{command:"pause", frames: 2},
			{command:"buffer", text:"!\n"},
			{command:"wait"},
			{command:"buffer", text:"(Your eyes are beginning to water just holding it...  What ingredients did Beryll use, and who's crazy enough to stomach them??)\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Brill_ham_4"]=
	{ 
		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: "Beryll",
		script: [
			{command:"buffer", text:"Go on, have a taste!\n"},
			{command:"wait"},
			{command:"buffer", text:"Garlic-maple glazed with sauteed onion, ginger, pepper, and seventeen different chilis... PLUS the Frog's secret spice blend!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Ol' Zeke says there's nothing like it on land, sea or sky!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

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

		// special events
		if (GLOBAL_DIARY.check(4,"CRETACEOUS_HAM_LOAF",true) && !GLOBAL_DIARY.check(4,"LIFE_RING",true)){
			line = Math.max(line,4);
			retval = "GD_Brill_ham_"+line;
			line = Math.min(line+1,4);
		}
		else if (GLOBAL_DIARY.check(4,"CRETACEOUS_HAM",true) && !GLOBAL_DIARY.check(4,"LIFE_RING",true)){
			retval = "Ham_Loaf";
			//line = Math.min(line+3,4);
		}
		// normal plot
		else if (GLOBAL_DIARY.check(5,"BOSS",true)){
			retval = "GD_Brill_c5_boss_"+line;
			line = Math.min(line+1,1);
		}
		else if (GLOBAL_DIARY.check(5,"AWAKE")){
			retval = "GD_Brill_c5_advice_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(4,"TREASURE")){
			retval = "GD_Brill_c4_treasure_"+line;
			line = Math.min(line+1,3);
		}
		else if (GLOBAL_DIARY.check(3,"TREASURE")){
			retval = "GD_Brill_c3_treasure_"+line;
			line = Math.min(line+1,2);
		}
		else if (GLOBAL_DIARY.check(2,"TREASURE")){
			retval = "GD_Brill_c2_treasure_"+line;
			line = Math.min(line+1,3);
		}
		else if (GLOBAL_DIARY.check(2,"LEAVING_HOME")){
			retval = "GD_Brill_c2_leaving_"+line;
			line = Math.min(line+1,1);
		}
		else{ // nothing to say
			retval = "GD_Brill_c2_leaving_"+line;
			line = Math.min(line+1,1);
		}
		GLOBAL_SCRATCHPAD.note("Dlg_Brill_Line",line);
		return retval;
	};
	
	