HeathGymUnderground_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0
	
HeathGymUndergroundNPC1:
	db TX_COMPRESSED, $63, $a9

	db $e2, $03, $1f, $41, $b6, $3f, $a0, $a2, $0c, $df
	db $79, $a4, $1f, $4d, $08, $96, $18, $80, $be, $7f
	db $00, $ad, $ab, $96, $18, $f9, $fe, $0e, $f1, $4d
	db $79, $58, $f9, $8f, $84, $86, $0a, $3f, $aa, $46, $be

	db $20, $1d, $12, $cd, $7a, $cd, $ca, $87, $69, $96, $93
	db $7b, $ba, $0d, $b2, $c3, $10, $f9, $f6
	db $c0, $54, $9d, $b3, $06, $35, $c0, $ac, $e0, $20
	db $b4, $f3, $fa, $0a, $27, $41, $8e, $3e, $32, $1e

	db $7c, $01, $da, $e5, $b4, $b2, $40, $41, $69, $71, $90, $ef
	db $5e, $19, $2c, $33, $50, $9f

	db $00, $13, $2d, $22, $e3, $fa, $a4, $71, $0d, $2c
	db $de, $04, $16, $a2, $74, $18, $e0, $20, $b4
	db $b0, $0a, $02, $1b, $8a, $35, $95, $28, $ac, $f0, $0a
	db $cd, $e0, $41, $6a, $08, $6a, $e0, $20, $b4, $b8, $c8, $77
	db $aa, $86, $49, $69, $35, $9f
	
	db $10, $0e, $d3, $f9, $a4, $cc, $04, $16, $9c, $3d
	db $78, $86, $79, $9a, $48, $ed, $67, $1b, $75
	
	db $06, $02, $c3, $11, $61, $59, $c0, $41, $69
	db $6f, $21, $f3, $ed, $9e, $63, $b5, $9a
	
	db $3c, $00, $ad, $ea, $94, $b0, $c7, $c1, $4c, $9e, $f4
	db $d6, $f0, $41, $8d, $72, $d2, $6b, $39, $61
	db $54, $b3, $64, $c6, $0c, $70, $24, $3f
	db $53, $40

HeathGymUndergroundNPC2:
	faceplayer
	checkevent EVENT_RECEIVED_ORE_CASE
	sif true, then
		callasmf CalculateTotalWorthOfOres
		sif false
			jumptext HeathGymUndergroundNPC2_NoOresText
		opentext
		writetext HeathGymUndergroundNPC2_WishToSellMeOresText
		yesorno
		sif false, then
			jumptext HeathGymUndergroundNPC2_VeryWellComeAgainText
		selse
			loadarray wTotalOrePrices, 0
			cmdwitharrayargs
			db givemoney_command, %10, 0, 0
			endcmdwitharrayargs
			callasm .ClearOreCaseInventory
			killsfx
			playwaitsfx SFX_TRANSACTION
			writetext HeathGymUndergroundNPC2_VeryWellThenHereIs
			endtext
		sendif
	sendif
	setevent EVENT_RECEIVED_ORE_CASE
	opentext
	writetext HeathGymUndergroundNPC2_IntroText
	verbosegiveitem ORE_CASE
	endtext

.ClearOreCaseInventory:
	ld hl, wOreCaseInventory
	ld bc, 10
	xor a
	jp ByteFill

HeathGymUndergroundNPC2_IntroText:
	db TX_COMPRESSED, $62, $69, $34, $9f, $bd
	
	db $e0, $0e, $50, $b5, $19, $d2, $44, $1f, $7b, $01, $05, $a5
	db $bc, $15, $9a, $25, $86, $3e, $73, $00
	db $ad, $52, $b1, $f3, $1f, $09, $0c, $17
	
	db $80, $15, $aa, $47, $2d, $23, $44, $76, $b3, $8d, $ba, $83
	db $79, $01, $80, $82, $d4, $4e, $83, $1c

	db $d0, $02, $3b, $ac, $9c, $b0, $c4, $58, $56, $73, $7b
	db $d7, $81, $05, $a5, $c0, $ac, $d1, $30, $58, $5f
	db $54, $87, $cf, $b6, $32, $73
	db $e0, $73

HeathGymUndergroundNPC2_WishToSellMeOresText:
	db TX_COMPRESSED, $ad, $3f, $80, $82, $d4, $a8, $68, $4c, $b0
	db $bc, $83, $ef, $63, $e7, $10, $17, $ce, $05, $66, $8a
	
	db $50, $0c, $5f, $7f, $de
	
	db $f0, $0a, $fb, $d8, $08, $2d, $2e, $05, $66, $88, $86, $9f
	db $79, $a1, $12, $c3, $36, $58, $6f, $7b, $03
	db $82, $a1, $35, $ae, $39, $80
	deciram wTotalOrePrices, 3, 7
	db TX_COMPRESSED
	
	db $f0, $06, $e3, $ef, $60, $20, $b5, $10, $7d
	db $eb, $d6, $93, $41, $c0, $ac, $d1, $2c, $31, $f3, $a5
	db $a6, $80

HeathGymUndergroundNPC2_VeryWellThenHereIs:
	db TX_COMPRESSED, $07, $06, $b0, $52, $a3, $ef, $7d, $18, $9a, $ce, $0d
	db $0f, $09, $ad, $71, $cc, $00
	deciram wTotalOrePrices, 3, 7
	db TX_COMPRESSED
	
	db $f0, $01, $92, $1d, $3a, $ca, $74, $9c, $9c, $c0, $2b
	db $78, $10, $5a, $5c, $0a, $cd, $1e
	db $a6, $80

HeathGymUndergroundNPC2_VeryWellComeAgainText:
	db TX_COMPRESSED, $07, $06, $b0, $52, $a3, $ef, $7d, $38, $7a, $7a, $83
	db $79, $90, $be, $73, $79, $d1, $92, $54, $93
	
	db $20, $00, $41, $6a, $60, $67, $d9, $69, $38, $43, $3c
	db $bd, $61, $88, $3e, $f6, $20, $2f, $9c, $0a, $cd, $1e
	db $a6, $80

HeathGymUndergroundNPC2_NoOresText:
	db TX_COMPRESSED, $6e, $9d, $ba, $58, $e5, $0b, $53, $21, $25
	db $31, $e4, $e8, $31, $cd, $20, $28, $15, $9a, $20
	db $c8, $a8, $10, $5a, $5c, $76, $b3, $8d, $ba, $83
	
	db $f0, $05, $0f, $9f, $6e, $20, $2f, $9c, $0a, $cd
	db $0f, $60, $35, $a2, $ff, $2d, $26, $49, $7b, $d5
	
	db $20, $16, $18, $f9, $cb, $0c, $41, $f7
	db $af, $5a, $4d, $ff
	db $53, $40

HeathGymUnderground_MapEventHeader:: db 0, 0

.Warps
	db 3
	warp_def $11, $5, 3, HEATH_GYM_UNDERGROUND
	warp_def $13, $7, 3, HEATH_GYM_HOUSE
	warp_def $b, $3, 1, HEATH_GYM_UNDERGROUND

.CoordEvents
	db 0

.BGEvents
	db 0

.ObjectEvents
	db 2
	person_event SPRITE_BLACK_BELT, 2, 2, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_PLAYER, PERSONTYPE_TEXTFP, 0, HeathGymUndergroundNPC1, -1
	person_event SPRITE_GRAMPS, 2, 9, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_ORANGE, PERSONTYPE_SCRIPT, 0, HeathGymUndergroundNPC2, -1
