AcaniaMart_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

AcaniaMartNPC1:
	jumptextfaceplayer AcaniaMartNPC1_Text

AcaniaMartShopAttendantNPC:
	faceplayer
	opentext
	pokemart 0, 12
	closetext
	end

AcaniaMartGoldTokenExchangeNPC:
	faceplayer
	opentext
	writetext AcaniaMartGoldTokenExchangeNPC_Text_Intro
	loadmenudata AcaniaGoldTokenMenu
	verticalmenu
	closewindow
	anonjumptable
	dw AcaniaMartClose
	dw AcaniaMart_GoldTokenExchange_SelectedPPUp
	dw AcaniaMart_GoldTokenExchange_SelectedEther
	dw AcaniaMart_GoldTokenExchange_SelectedMetalPowder
	dw AcaniaMart_GoldTokenExchange_SelectedQuickClaw
	dw AcaniaMart_GoldTokenExchange_SelectedMaxEther
	dw AcaniaMart_GoldTokenExchange_SelectedQRScanner

AcaniaMartClose:
	closetext
	end

AcaniaGoldTokenMenu:
	db $40 ; flags
	db 00, 00 ; start coords
	db 12, 19 ; end coords
	dw .AcaniaGoldTokenMenuText
	db 1 ; default option

.AcaniaGoldTokenMenuText:
	db $c0 ; flags
	db 6 ; items
	db "PP Up           3@"
	db "Ether           3@"
	db "Metal Powder    5@"
	db "Quick Claw      5@"
	db "Max Ether       5@"
	db "QR Reader      10@"

AcaniaMart_GoldTokenExchange_SelectedPPUp:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantPPUp
	yesorno
	iffalse AcaniaMartClose
	writebyte PP_UP
	jump AcaniaMart_ThreeTokenReward

AcaniaMart_GoldTokenExchange_SelectedEther:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantEther
	yesorno
	iffalse AcaniaMartClose
	writebyte ETHER
	; fallthrough

AcaniaMart_ThreeTokenReward:
	pushvar
	writebyte 3
	jump AcaniaMart_Reward

AcaniaMart_GoldTokenExchange_SelectedMetalPowder:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantMetalPowder
	yesorno
	iffalse AcaniaMartClose
	writebyte METAL_POWDER
	jump AcaniaMart_FiveTokenReward

AcaniaMart_GoldTokenExchange_SelectedQuickClaw:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantQuickClaw
	yesorno
	iffalse AcaniaMartClose
	writebyte QUICK_CLAW
	jump AcaniaMart_FiveTokenReward

AcaniaMart_GoldTokenExchange_SelectedMaxEther:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantMaxEther
	yesorno
	iffalse AcaniaMartClose
	writebyte MAX_ETHER
	; fallthrough

AcaniaMart_FiveTokenReward:
	pushvar
	writebyte 5
	jump AcaniaMart_Reward

AcaniaMart_GoldTokenExchange_SelectedQRScanner:
	writetext AcaniaMartGoldTokenExchangeNPC_Text_WantQRScanner
	yesorno
	iffalse AcaniaMartClose
	writebyte QR_READER
	pushvar
	writebyte 10

AcaniaMart_Reward:
	scriptstartasm
	ld a, GOLD_TOKEN
	ld [wCurItem], a
	ld a, [hScriptVar]
	ld [wItemQuantityChangeBuffer], a
	ld a, -1
	ld [wCurItemQuantity], a
	ld hl, NumItems
	call TossItem
	ld hl, .not_enough_tokens
	ret nc
	scriptstopasm
	swapvar
	verbosegiveitem ITEM_FROM_MEM, 1
	sif true, then
		popvar
		endtext
	sendif
	popvar
	scriptstartasm
	ld a, GOLD_TOKEN
	ld [wCurItem], a
	ld a, [hScriptVar]
	ld [wItemQuantityChangeBuffer], a
	ld hl, NumItems
	call ReceiveItem
	scriptstopasm
	jumptext AcaniaMartGoldTokenExchangeNPC_Text_NotEnoughSpace
.not_enough_tokens
	jumptext AcaniaMartGoldTokenExchangeNPC_Text_NotEnoughTokens

AcaniaMartNPC1_Text:
	db TX_COMPRESSED, $29, $27, $18, $41, $ee, $61, $41, $52, $32
	db $21, $ed, $59, $cb, $08, $63, $3d, $30, $63, $5f, $41
	db $2a, $48, $f3, $93, $24, $c0, $2b, $8f, $9f
	db $1a, $68

AcaniaMartGoldTokenExchangeNPC_Text_Intro:
	db TX_COMPRESSED, $62, $39, $69, $35, $9f

	db $80, $3a, $70, $f6, $5a, $f7, $27, $01, $05, $a5
	db $bc, $c2, $0f, $73, $0a, $0a, $91, $91, $13, $00
	db $ad, $50, $85, $8c, $4d, $9a, $38

	db $80, $6e, $91, $b2, $98, $3b, $37, $e5, $41, $6b, $b9
	db $78, $10, $5a, $9d, $1a, $91, $d2
	db $d3, $40

AcaniaMartGoldTokenExchangeNPC_Text_WantPPUp:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e7, $0f, $0c, $73, $88, $a5
	db $a6, $80

AcaniaMartGoldTokenExchangeNPC_Text_WantEther:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e0, $ba, $d2, $6b, $a5
	db $a6, $80

AcaniaMartGoldTokenExchangeNPC_Text_WantMetalPowder:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e0, $a9, $de
	db $f5, $ee, $10, $d5, $93, $5d
	db $2d, $34

AcaniaMartGoldTokenExchangeNPC_Text_WantQuickClaw:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e0, $9a, $9a, $1b, $2a
	db $4f, $36, $f7, $6a, $a5
	db $a6, $80

AcaniaMartGoldTokenExchangeNPC_Text_WantMaxEther:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e0, $ae, $d3
	db $af, $0b, $ad, $26, $ba
	db $5a, $68

AcaniaMartGoldTokenExchangeNPC_Text_WantQRScanner:
	db TX_COMPRESSED, $72, $85, $a9, $56, $92, $e5, $a4
	db $de, $13, $53, $92, $28, $67, $48, $43, $5d
	db $2d, $34

AcaniaMartGoldTokenExchangeNPC_Text_NotEnoughTokens:
	db TX_COMPRESSED, $72, $85, $a9, $90, $92, $99, $13, $a0
	db $c6, $f1, $90, $2d, $72, $99, $61, $52, $32, $23
	db $d4, $d0

AcaniaMartGoldTokenExchangeNPC_Text_NotEnoughSpace:
	db TX_COMPRESSED, $53, $59, $9c, $68, $44, $40, $5f
	db $37, $90, $23, $59, $3e
	db $34, $d0

AcaniaMart_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $7, $6, 2, ACANIA_DOCKS
	warp_def $7, $7, 2, ACANIA_DOCKS

	;xy triggers
	db 0

	;signposts
	db 0

	;people-events
	db 3
	person_event SPRITE_TEACHER, 5, 9, SPRITEMOVEDATA_WANDER, 0, 0, -1, -1, PAL_OW_RED, 0, 0, AcaniaMartNPC1, -1
	person_event SPRITE_CLERK, 3, 6, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, 0, 0, AcaniaMartShopAttendantNPC, -1
	person_event SPRITE_CLERK, 3, 7, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, 0, 0, AcaniaMartGoldTokenExchangeNPC, -1

