SpurgeMart_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

SpurgeMartATM:
	opentext
	special Special_SpurgeMartBank
	endtext

SpurgeMartShop1:
	faceplayer
	opentext
	pokemart 0, 2
	closetext
	end

SpurgeMartShop2:
	faceplayer
	opentext
	pokemart 0, 3
	closetext
	end

SpurgeMartShop3:
	faceplayer
	opentext
	pokemart 0, 4
	closetext
	end

SpurgeMartShop4:
	opentext
	pokemart 0, 5
	closetext
	end

SpurgeMartGoldTokenShop:
	faceplayer
	opentext
	writetext .intro_text
	loadmenudata .menu_header
	verticalmenu
	closewindow
	addvar -1
	sif >=, 3
		jumptext .denied_text
	anonjumptable
	dw .megaphone
	dw .protein
	dw .confuseguard

.menu_header
	db $40 ; flags
	db 02, 00 ; start coords
	db 11, 19 ; end coords
	dw .menu_items
	db 1 ; default option

.menu_items
	db $80 ; flags
	db 4 ; items
	db "Megaphone    (2)@"
	db "Protein      (2)@"
	db "ConfuseGuard (3)@"
	db "Cancel@"

.megaphone
	writebyte MEGAPHONE
	jump .two_token_item

.protein
	writebyte PROTEIN

.two_token_item
	copyvartobyte hScriptHalfwordVar ;we aren't using it, so why not
	writebyte 2
.go
	opentext
	writetext .that_will_be_tokens_text
	pushvar
	yesorno
	sif false, then
		popvar
		jumptext .denied_text
	sendif
	popvar
	takeitem GOLD_TOKEN, 0
	sif false
		jumptext .not_enough_tokens_text
	copybytetovar hScriptHalfwordVar
	verbosegiveitem ITEM_FROM_MEM, 1
	jumptext .thank_you_text

.confuseguard
	writebyte CONFUSEGUARD
	copyvartobyte hScriptHalfwordVar
	writebyte 3
	jump .go

.intro_text
	ctxt "Welcome!"

	para "You can exchange"
	line "Gold Tokens you"
	para "have found for"
	line "prizes."

	para "Which one do you"
	line "want?"
	done

.that_will_be_tokens_text
	ctxt "That'll be @"
	deciram hScriptVar, 1, 1
	ctxt ""
	line "tokens, you agree?"
	done

.denied_text
	ctxt "Alright then<...>"
	done

.thank_you_text
	ctxt "Thank you, come"
	line "again!"
	done

.not_enough_tokens_text
	ctxt "You need more"
	line "tokens than that."
	done

SpurgeMartNPC1:
	jumptextfaceplayer .text

.text
	ctxt "Come look around,"
	line "I have games 'o"
	cont "plenty here."

	para "If you see a game"
	line "you like, just"
	cont "let me know!"
	done

SpurgeMartNPC2:
	jumptextfaceplayer .text

.text
	ctxt "Soda pop isn't"
	line "very healthy, but"
	para "it costs less"
	line "than water."
	done

SpurgeMartNPC3:
	jumptextfaceplayer .text

.text
	ctxt "Some very shady"
	line "guy all dressed"

	para "in red came by"
	line "to buy a meal."

	para "And when I say red"
	line "I MEAN RED!"

	para "Helmet, jumpsuit."
	line "All of it red."

	para "He refused to take"
	line "the helmet off, so"

	para "he ordered his"
	line "food to go."
	done

SpurgeMartNPC4:
	jumptextfaceplayer .text

.text
	ctxt "This food court"
	line "never fails to"
	para "fill my big belly"
	line "up real good."
	done

SpurgeMartNPC5:
	jumptextfaceplayer .text

.text
	ctxt "My Snorlax loves"
	line "these burgers too."

	para "He can eat a lot"
	line "more than me."
	done

SpurgeMartNPC6:
	jumptextfaceplayer .text

.text
	ctxt "I hear the milk"
	line "they sell here is"
	para "made in a small"
	line "farm in Johto."
	done

SpurgeMartNPC7:
	jumptextfaceplayer .text

.text
	ctxt "I'm trying to get"
	line "a return on a"
	para "game I bought"
	line "for my son."

	para "Who is 'Frigo'"
	line "anyway? Seriously?"

	para "And #mon Quartz"
	line "had a lot of"
	cont "profanity in it!"

	para "It was rated E"
	line "for Everyone too!"
	done

SpurgeMartNPC8:
	jumptextfaceplayer .text

.text
	ctxt "I can't decide"
	line "what to buy!"
	done

SpurgeMart_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $23, $14, 8, SPURGE_CITY
	warp_def $23, $15, 8, SPURGE_CITY

	;xy triggers
	db 0

	;signposts
	db 2
	signpost 9, 10, SIGNPOST_RIGHT, SpurgeMartATM
	signpost 9, 11, SIGNPOST_LEFT, SpurgeMartATM

	;people-events
	db 14
	person_event SPRITE_CLERK, 8, 2, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, SpurgeMartShop1, -1
	person_event SPRITE_CLERK, 19, 3, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, SpurgeMartShop2, -1
	person_event SPRITE_CLERK, 10, 35, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, SpurgeMartShop3, -1
	person_event SPRITE_CLERK, 12, 36, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, SpurgeMartShop3, -1
	person_event SPRITE_CLERK, 30, 38, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, SpurgeMartShop4, -1
	person_event SPRITE_CLERK, 24, 19, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, SpurgeMartGoldTokenShop, -1
	person_event SPRITE_CLERK, 28, 1, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC1, -1
	person_event SPRITE_GENTLEMAN, 10, 17, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC2, -1
	person_event SPRITE_R_GAMBLER, 15, 24, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC3, -1
	person_event SPRITE_FISHER, 11, 33, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC4, -1
	person_event SPRITE_FISHER, 18, 28, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, 0, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC5, -1
	person_event SPRITE_R_JRTRAINERM, 18, 5, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC6, -1
	person_event SPRITE_TEACHER, 26, 4, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC7, -1
	person_event SPRITE_YOUNGSTER, 29, 19, SPRITEMOVEDATA_WANDER, 2, 2, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, SpurgeMartNPC8, -1
