;Miner NPC

OreScrap = 68
OreChunk = 69
DarkMetal = 63

If #MAPID = 435
	GoTo SMELTER
EndIf

AmountOfOreScraps = 0
while HasItem(#USERID, OreScrap) = 1
	TakeItem(#USERID, OreScrap)
	AmountOfOreScraps = AmountOfOreScraps + 1
Wend

SendMessageToUser(#USERID,"Miner says, 'I can compile your scraps of ore into one hunk of metal if you like.'", #MSG_SAY)

If AmountOfOreScraps >= 10
	SendMessageToUser(#USERID,"The Miner takes your ore scraps and turns them into larger chunks.", #MSG_TELL)
EndIf
While AmountOfOreScraps >= 10
	GiveItem(#USERID, OreChunk)
	AmountOfOreScraps = AmountOfOreScraps - 10
Wend

while AmountOfOreScraps > 0
	GiveItem(#USERID, OreScrap)
	AmountOfOreScraps = AmountOfOreScraps - 1
Wend
GoTo END

Label SMELTER

If HasItem(#USERID, DarkMetal) = 1
	SendMessageToUser(#USERID,"Smelter says, 'That Dark Metal could make some amazing armor, if you can find someone skilled enough to forge it.'", #MSG_SAY)
	GoTo END
EndIf

AmountOfOreChunks = 0
while HasItem(#USERID, OreChunk) = 1
	TakeItem(#USERID, OreChunk)
	AmountOfOreChunks = AmountOfOreChunks + 1
Wend

SendMessageToUser(#USERID,"Smelter says, 'If you have five chunks of ore, I can melt them for you, and make some Dark Metal.'", #MSG_SAY)

If AmountOfOreChunks >= 5
	SendMessageToUser(#USERID,"The Smelter takes your ore chunks and melts them down.", #MSG_TELL)
EndIf
While AmountOfOreChunks >= 5
	GiveItem(#USERID, DarkMetal)
	AmountOfOreChunks = AmountOfOreChunks - 5
Wend

while AmountOfOreChunks > 0
	GiveItem(#USERID, OreChunk)
	AmountOfOreChunks = AmountOfOreChunks - 1
Wend

Label END

Continue = 1