local table = 
{
	-- [level] = type = "item", id = {ITEM_ID, QUANTIDADE}, msg = "MENSAGEM"},
	-- [level] = type = "bank", id = {QUANTIDADE, 0}, msg = "MENSAGEM"},
	-- [level] = type = "addon1", id = {ID_ADDON_FEMALE, ID_ADDON_MALE}, msg = "MENSAGEM"},
	-- [level] = type = "addon2", id = {ID_ADDON_FEMALE, ID_ADDON_MALE}, msg = "MENSAGEM"},
	-- [level] = type = "mount", id = {ID_MOUNT, 0}, msg = "MENSAGEM"},

	[15] = {type = "bank", id = {20000, 0}, msg = "You won 2 crystal coins by reaching level 15!"},
	[20] = {type = "mount", id = {22, 0}, msg = "You won a Brown Horse by reaching level 20!"},
	[25] = {type = "item", id = {7618, 50}, msg = "You won 50 health potions by reaching level 25!"},
	[30] = {type = "item", id = {7620, 50}, msg = "You won 50 mana potions by reaching level 30!"},
	[50] = {type = "addon1", id = {136, 128}, msg = "You won first citizen addon by reaching level 50!"},
	[75] = {type = "bank", id = {100000, 0}, msg = "You won 10 crystal coins by reaching level 75!"},
	[100] = {type = "addon2", id = {136, 128}, msg = "You won seccond citizen addon by reaching level 100!"},
}

local storage = 15000

function onAdvance(player, skill, oldLevel, newLevel)

	if skill ~= SKILL_LEVEL or newLevel <= oldLevel then
		return true
	end

	for level, _ in pairs(table) do
		if newLevel >= level and player:getStorageValue(storage) < level then
			if table[level].type == "item" then	
				player:addItem(table[level].id[1], table[level].id[2])
			elseif table[level].type == "bank" then
				player:setBankBalance(player:getBankBalance() + table[level].id[1])
			elseif table[level].type == "addon1" then
				player:addOutfitAddon(table[level].id[1], 1)
				player:addOutfitAddon(table[level].id[2], 1)
			elseif table[level].type == "addon2" then
				player:addOutfitAddon(table[level].id[1], 2)
				player:addOutfitAddon(table[level].id[2], 2)
			elseif table[level].type == "mount" then
				player:addMount(table[level].id[1])
			else
				return false
			end

			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, table[level].msg)
			player:setStorageValue(storage, level)
		end
	end

	player:save()

	return true
end