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
	db TX_COMPRESSED, $6e, $7d, $64, $2f, $9f

	db $10, $0e, $50, $b5, $19, $d2, $43, $a7, $59, $4e, $93, $93
	db $79, $84, $1e, $e6, $14, $15, $23, $22, $20, $20
	db $b4, $01, $3a, $0c, $73, $00, $b4, $4c, $cc, $02
	db $b7, $84, $2c, $62, $6c, $d1

	db $e0, $0d, $d2, $36, $53, $02, $43, $99, $0c, $04, $16
	db $9e, $ab, $49, $74
	db $b4, $d0

.that_will_be_tokens_text
	db TX_COMPRESSED, $29, $3b, $6e, $1e, $c5, $67, $1c, $c0
	deciram hScriptVar, 1, 1
	db TX_COMPRESSED
	db $7a, $c2, $a4, $64, $47, $e0, $20, $b5, $37, $95, $99, $d2
	db $d3, $40

.denied_text
	db TX_COMPRESSED, $af, $ab, $1f, $29, $b9, $69, $32, $53
	db $c1, $4d

.thank_you_text
	db TX_COMPRESSED, $29, $3a, $45, $28, $08, $2d, $7e, $32, $17
	db $cd, $ed, $e7, $46, $4e
	db $34, $d0

.not_enough_tokens_text
	db TX_COMPRESSED, $72, $85, $a8, $43, $3c, $c7, $c2, $b3
	db $7a, $c2, $a4, $64, $44, $b4, $e9, $25, $a7, $6f
	db $d4, $d0

SpurgeMartNPC1:
	db TX_COMPRESSED, $6d, $0b, $e7, $3a, $10, $a9, $4d, $58, $5a, $26
	db $7e, $f3, $a8, $9d, $06, $39, $ce, $be, $68, $81, $13, $59
	db $ea, $a1, $1d, $32, $58, $28, $93, $59

	db $f8, $03, $ac, $20, $20, $b5, $10, $67, $36, $73, $af
	db $9b, $c0, $82, $d4, $e8, $d4, $8f, $f2, $9c, $69
	db $16, $ab, $a7, $71, $f3, $8a, $44, $0d, $5c
	db $69, $a0

SpurgeMartNPC2:
	db TX_COMPRESSED, $50, $1c, $ec, $e1, $08, $88, $34, $12
	db $98, $f0, $31, $ac, $14, $49, $ef, $6d, $20, $bf, $15, $b5
	db $60, $07, $71, $90, $a2, $d1, $3a, $68
	db $43, $d6, $9d, $24, $ab, $6c, $d7
	db $ea, $68

SpurgeMartNPC3:
	db TX_COMPRESSED, $50, $17, $ce, $03, $1a, $c1, $44, $27, $72
	db $09, $ee, $5a, $05, $37, $bd, $99, $59, $a1, $07

	db $90, $03, $24, $59, $e6, $33, $af, $9c, $56
	db $09, $eb, $0c, $56, $d0, $29, $b1, $f3, $de

	db $f8, $05, $64, $cc, $a9, $26, $48, $ea, $23, $41
	db $3c, $b3, $cf, $e3, $a8, $2a, $2e, $ac, $1f, $1c, $82, $ee, $0e

	db $20, $18, $9f, $5f, $3b, $fc, $a7, $1a, $7c, $42, $1a, $1d
	db $f9, $ea, $fb, $d8, $1c, $20, $ee, $2c, $f3

	db $e0, $0c, $4e, $2c, $f0, $69, $07, $99, $61, $97, $aa
	db $46, $f5, $a4, $e2, $4f, $af, $9d, $c0, $e1, $87, $e2

	db $02, $01, $27, $02, $bc, $9a, $cf, $31, $23
	db $43, $d8, $04, $39, $96, $19, $c8
	db $7d, $4d

SpurgeMartNPC4:
	db TX_COMPRESSED, $29, $23, $44, $c0, $21, $cc, $64, $2d, $2e
	db $de, $21, $83, $1a, $e6, $1a, $3e, $a2, $58
	db $40, $60, $3e, $f6, $3e, $0a, $2b, $1f, $31, $59, $f7, $a0
	db $9e, $68, $44, $59, $ef, $67, $21, $0e
	db $7d, $4d

SpurgeMartNPC5:
	db TX_COMPRESSED, $15, $05, $14, $10, $2b, $ee, $d3, $b3, $a1, $06, $34
	db $3d, $69, $34, $1c, $56, $d2, $f9, $35, $a2, $58, $43

	db $e0, $0c, $4e, $33, $a4, $87, $b7, $36, $74
	db $36, $f3, $e1, $59, $cb, $4e, $92, $3e, $7e
	db $a6, $80

SpurgeMartNPC6:
	db TX_COMPRESSED, $75, $12, $7a, $b9, $69, $38, $f8, $fa
	db $a4, $f5, $a4, $c1, $44, $1f, $7b, $12, $6b, $38, $34
	db $00, $7f, $72, $70, $64, $9b, $10, $fe, $f7
	db $af, $61, $ab, $7e, $0c, $90, $4c, $85, $36, $1f
	db $53, $40

SpurgeMartNPC7:
	db TX_COMPRESSED, $74, $59, $2d, $60, $86, $4e, $65, $86, $72
	db $76, $f6, $c5, $9d, $b4, $b2, $40, $92
	db $68, $0e, $75, $f3, $8e, $a2, $b0, $b5, $ca
	db $6d, $ec, $02, $b8, $f8, $28, $80, $93

	db $c0, $1b, $a4, $30, $68, $82, $6b, $3d, $53, $58, $f9, $08, $9a, $cf
	db $5e, $d2, $02, $ab, $41, $52, $c5, $06, $b1, $85, $a4, $74, $15

	db $28, $0a, $c9, $98, $0e, $57, $c2, $48, $26, $a6, $b5, $76, $26
	db $de, $4e, $e6, $6c, $e8, $6e, $07
	db $05, $42, $16, $1c, $34, $83, $b0, $50, $64, $83, $be

	db $20, $1d, $5c, $ab, $51, $17, $b6, $79, $82
	db $e7, $b0, $0a, $e0, $b8, $18, $d6, $08, $24, $39, $61, $0f
	db $1a, $68

SpurgeMartNPC8:
	db TX_COMPRESSED, $75, $19, $d2, $53, $26, $4d, $91, $e4
	db $de, $a9, $3b, $72, $c3, $15, $b4, $0b
	db $8d, $34

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_TEXTFP, 0, SpurgeMartNPC1, -1
	person_event SPRITE_GENTLEMAN, 10, 17, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC2, -1
	person_event SPRITE_R_GAMBLER, 15, 24, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC3, -1
	person_event SPRITE_FISHER, 11, 33, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC4, -1
	person_event SPRITE_FISHER, 18, 28, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, 0, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC5, -1
	person_event SPRITE_R_JRTRAINERM, 18, 5, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC6, -1
	person_event SPRITE_TEACHER, 26, 4, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC7, -1
	person_event SPRITE_YOUNGSTER, 29, 19, SPRITEMOVEDATA_WANDER, 2, 2, -1, -1, PAL_OW_YELLOW, PERSONTYPE_TEXTFP, 0, SpurgeMartNPC8, -1

