local desert = {
	{ itemid = 12516, position = Position(33642, 32683, 12) },
	{ itemid = 12516, position = Position(33643, 32682, 12) },
	{ itemid = 231, position = Position(33641, 32680, 12) },
	{ itemid = 231, position = Position(33641, 32683, 12) },
	{ itemid = 231, position = Position(33641, 32681, 12) },
	{ itemid = 231, position = Position(33641, 32682, 12) },
	{ itemid = 231, position = Position(33641, 32679, 12) },
	{ itemid = 231, position = Position(33641, 32677, 12) },
	{ itemid = 231, position = Position(33640, 32690, 12) },
	{ itemid = 231, position = Position(33641, 32678, 12) },
	{ itemid = 231, position = Position(33640, 32691, 12) },
	{ itemid = 231, position = Position(33641, 32676, 12) },
	{ itemid = 231, position = Position(33640, 32689, 12) },
	{ itemid = 231, position = Position(33641, 32684, 12) },
	{ itemid = 231, position = Position(33641, 32686, 12) },
	{ itemid = 231, position = Position(33642, 32678, 12) },
	{ itemid = 231, position = Position(33642, 32677, 12) },
	{ itemid = 231, position = Position(33642, 32679, 12) },
	{ itemid = 231, position = Position(33642, 32680, 12) },
	{ itemid = 231, position = Position(33641, 32685, 12) },
	{ itemid = 231, position = Position(33642, 32676, 12) },
	{ itemid = 231, position = Position(33641, 32690, 12) },
	{ itemid = 231, position = Position(33641, 32691, 12) },
	{ itemid = 231, position = Position(33641, 32687, 12) },
	{ itemid = 231, position = Position(33641, 32688, 12) },
	{ itemid = 231, position = Position(33641, 32689, 12) },
	{ itemid = 231, position = Position(33640, 32688, 12) },
	{ itemid = 231, position = Position(33640, 32686, 12) },
	{ itemid = 231, position = Position(33639, 32685, 12) },
	{ itemid = 231, position = Position(33639, 32684, 12) },
	{ itemid = 231, position = Position(33639, 32686, 12) },
	{ itemid = 231, position = Position(33639, 32687, 12) },
	{ itemid = 231, position = Position(33639, 32688, 12) },
	{ itemid = 231, position = Position(33639, 32683, 12) },
	{ itemid = 231, position = Position(33639, 32681, 12) },
	{ itemid = 231, position = Position(33639, 32682, 12) },
	{ itemid = 231, position = Position(33639, 32679, 12) },
	{ itemid = 231, position = Position(33639, 32680, 12) },
	{ itemid = 231, position = Position(33640, 32687, 12) },
	{ itemid = 231, position = Position(33639, 32689, 12) },
	{ itemid = 231, position = Position(33640, 32676, 12) },
	{ itemid = 231, position = Position(33640, 32683, 12) },
	{ itemid = 231, position = Position(33640, 32682, 12) },
	{ itemid = 231, position = Position(33640, 32684, 12) },
	{ itemid = 231, position = Position(33640, 32685, 12) },
	{ itemid = 231, position = Position(33639, 32690, 12) },
	{ itemid = 231, position = Position(33640, 32681, 12) },
	{ itemid = 231, position = Position(33640, 32679, 12) },
	{ itemid = 231, position = Position(33640, 32680, 12) },
	{ itemid = 231, position = Position(33646, 32688, 12) },
	{ itemid = 231, position = Position(33646, 32687, 12) },
	{ itemid = 231, position = Position(33642, 32681, 12) },
	{ itemid = 231, position = Position(33642, 32682, 12) },
	{ itemid = 231, position = Position(33642, 32684, 12) },
	{ itemid = 231, position = Position(33644, 32687, 12) },
	{ itemid = 231, position = Position(33644, 32686, 12) },
	{ itemid = 231, position = Position(33644, 32688, 12) },
	{ itemid = 231, position = Position(33644, 32689, 12) },
	{ itemid = 231, position = Position(33644, 32690, 12) },
	{ itemid = 231, position = Position(33644, 32685, 12) },
	{ itemid = 231, position = Position(33644, 32683, 12) },
	{ itemid = 231, position = Position(33644, 32684, 12) },
	{ itemid = 231, position = Position(33646, 32679, 12) },
	{ itemid = 231, position = Position(33644, 32682, 12) },
	{ itemid = 231, position = Position(33646, 32680, 12) },
	{ itemid = 231, position = Position(33644, 32691, 12) },
	{ itemid = 231, position = Position(33645, 32680, 12) },
	{ itemid = 231, position = Position(33645, 32689, 12) },
	{ itemid = 231, position = Position(33645, 32688, 12) },
	{ itemid = 231, position = Position(33645, 32690, 12) },
	{ itemid = 231, position = Position(33645, 32691, 12) },
	{ itemid = 231, position = Position(33645, 32676, 12) },
	{ itemid = 231, position = Position(33645, 32687, 12) },
	{ itemid = 231, position = Position(33645, 32685, 12) },
	{ itemid = 231, position = Position(33645, 32686, 12) },
	{ itemid = 231, position = Position(33645, 32681, 12) },
	{ itemid = 231, position = Position(33645, 32684, 12) },
	{ itemid = 231, position = Position(33639, 32676, 12) },
	{ itemid = 231, position = Position(33646, 32681, 12) },
	{ itemid = 231, position = Position(33644, 32676, 12) },
	{ itemid = 231, position = Position(33642, 32691, 12) },
	{ itemid = 231, position = Position(33642, 32690, 12) },
	{ itemid = 231, position = Position(33643, 32676, 12) },
	{ itemid = 231, position = Position(33643, 32677, 12) },
	{ itemid = 231, position = Position(33643, 32678, 12) },
	{ itemid = 231, position = Position(33642, 32689, 12) },
	{ itemid = 231, position = Position(33642, 32687, 12) },
	{ itemid = 231, position = Position(33642, 32688, 12) },
	{ itemid = 231, position = Position(33642, 32685, 12) },
	{ itemid = 231, position = Position(33642, 32686, 12) },
	{ itemid = 231, position = Position(33644, 32677, 12) },
	{ itemid = 231, position = Position(33643, 32679, 12) },
	{ itemid = 231, position = Position(33643, 32683, 12) },
	{ itemid = 231, position = Position(33643, 32689, 12) },
	{ itemid = 231, position = Position(33643, 32690, 12) },
	{ itemid = 231, position = Position(33643, 32691, 12) },
	{ itemid = 231, position = Position(33646, 32684, 12) },
	{ itemid = 231, position = Position(33643, 32688, 12) },
	{ itemid = 231, position = Position(33643, 32686, 12) },
	{ itemid = 231, position = Position(33643, 32687, 12) },
	{ itemid = 231, position = Position(33643, 32684, 12) },
	{ itemid = 231, position = Position(33643, 32685, 12) },
	{ itemid = 231, position = Position(33638, 32690, 12) },
	{ itemid = 231, position = Position(33639, 32691, 12) },
	{ itemid = 231, position = Position(33637, 32676, 12) },
	{ itemid = 231, position = Position(33637, 32687, 12) },
	{ itemid = 231, position = Position(33637, 32686, 12) },
	{ itemid = 231, position = Position(33636, 32683, 12) },
	{ itemid = 231, position = Position(33637, 32685, 12) },
	{ itemid = 231, position = Position(33637, 32688, 12) },
	{ itemid = 231, position = Position(33647, 32680, 12) },
	{ itemid = 231, position = Position(33648, 32679, 12) },
	{ itemid = 231, position = Position(33648, 32681, 12) },
	{ itemid = 231, position = Position(33646, 32691, 12) },
	{ itemid = 231, position = Position(33638, 32689, 12) },
	{ itemid = 231, position = Position(33637, 32684, 12) },
	{ itemid = 231, position = Position(33637, 32682, 12) },
	{ itemid = 231, position = Position(33647, 32682, 12) },
	{ itemid = 231, position = Position(33647, 32679, 12) },
	{ itemid = 231, position = Position(33647, 32681, 12) },
	{ itemid = 231, position = Position(33637, 32683, 12) },
	{ itemid = 231, position = Position(33635, 32686, 12) },
	{ itemid = 231, position = Position(33635, 32684, 12) },
	{ itemid = 231, position = Position(33635, 32685, 12) },
	{ itemid = 231, position = Position(33647, 32688, 12) },
	{ itemid = 231, position = Position(33638, 32676, 12) },
	{ itemid = 231, position = Position(33648, 32680, 12) },
	{ itemid = 231, position = Position(33638, 32677, 12) },
	{ itemid = 231, position = Position(33638, 32686, 12) },
	{ itemid = 231, position = Position(33638, 32685, 12) },
	{ itemid = 231, position = Position(33636, 32685, 12) },
	{ itemid = 231, position = Position(33636, 32686, 12) },
	{ itemid = 231, position = Position(33638, 32687, 12) },
	{ itemid = 231, position = Position(33648, 32688, 12) },
	{ itemid = 231, position = Position(33636, 32684, 12) },
	{ itemid = 231, position = Position(33638, 32688, 12) },
	{ itemid = 231, position = Position(33638, 32683, 12) },
	{ itemid = 231, position = Position(33638, 32684, 12) },
	{ itemid = 231, position = Position(33638, 32680, 12) },
	{ itemid = 231, position = Position(33638, 32682, 12) },
	{ itemid = 231, position = Position(33638, 32681, 12) },
	{ itemid = 231, position = Position(33638, 32679, 12) },
	{ itemid = 231, position = Position(33638, 32678, 12) },
	{ itemid = 991, position = Position(33646, 32679, 12) },
	{ itemid = 991, position = Position(33644, 32681, 12) },
	{ itemid = 991, position = Position(33637, 32681, 12) },
	{ itemid = 991, position = Position(33645, 32680, 12) },
	{ itemid = 991, position = Position(33636, 32682, 12) },
	{ itemid = 991, position = Position(33635, 32683, 12) },
	{ itemid = 990, position = Position(33646, 32690, 12) },
	{ itemid = 990, position = Position(33643, 32681, 12) },
	{ itemid = 990, position = Position(33646, 32686, 12) },
	{ itemid = 990, position = Position(33647, 32678, 12) },
	{ itemid = 990, position = Position(33647, 32687, 12) },
	{ itemid = 989, position = Position(33636, 32676, 12) },
	{ itemid = 989, position = Position(33636, 32687, 12) },
	{ itemid = 989, position = Position(33638, 32691, 12) },
	{ itemid = 989, position = Position(33637, 32689, 12) },
	{ itemid = 989, position = Position(33637, 32677, 12) },
	{ itemid = 988, position = Position(33645, 32677, 12) },
	{ itemid = 988, position = Position(33646, 32689, 12) },
	{ itemid = 988, position = Position(33643, 32680, 12) },
	{ itemid = 988, position = Position(33648, 32682, 12) },
	{ itemid = 988, position = Position(33644, 32678, 12) },
	{ itemid = 988, position = Position(33646, 32685, 12) },
	{ itemid = 988, position = Position(33647, 32683, 12) },
	{ itemid = 987, position = Position(33634, 32683, 12) },
	{ itemid = 987, position = Position(33646, 32677, 12) },
	{ itemid = 987, position = Position(33635, 32682, 12) },
	{ itemid = 987, position = Position(33645, 32679, 12) },
	{ itemid = 987, position = Position(33644, 32680, 12) },
	{ itemid = 987, position = Position(33636, 32681, 12) },
	{ itemid = 986, position = Position(33647, 32690, 12) },
	{ itemid = 986, position = Position(33648, 32687, 12) },
	{ itemid = 986, position = Position(33647, 32686, 12) },
	{ itemid = 986, position = Position(33647, 32677, 12) },
	{ itemid = 985, position = Position(33636, 32677, 12) },
	{ itemid = 985, position = Position(33636, 32689, 12) },
	{ itemid = 985, position = Position(33637, 32691, 12) },
	{ itemid = 985, position = Position(33635, 32676, 12) },
	{ itemid = 985, position = Position(33634, 32687, 12) },
	{ itemid = 984, position = Position(33648, 32683, 12) },
	{ itemid = 984, position = Position(33648, 32689, 12) },
	{ itemid = 984, position = Position(33644, 32680, 12) },
	{ itemid = 984, position = Position(33647, 32685, 12) },
	{ itemid = 984, position = Position(33645, 32678, 12) },
	{ itemid = 984, position = Position(33646, 32677, 12) },
	{ itemid = 983, position = Position(33646, 32678, 12) },
	{ itemid = 983, position = Position(33637, 32678, 12) },
	{ itemid = 983, position = Position(33634, 32686, 12) },
	{ itemid = 983, position = Position(33637, 32679, 12) },
	{ itemid = 983, position = Position(33634, 32684, 12) },
	{ itemid = 983, position = Position(33636, 32688, 12) },
	{ itemid = 983, position = Position(33637, 32690, 12) },
	{ itemid = 983, position = Position(33634, 32685, 12) },
	{ itemid = 983, position = Position(33637, 32680, 12) },
	{ itemid = 981, position = Position(33647, 32684, 12) },
	{ itemid = 981, position = Position(33646, 32676, 12) },
	{ itemid = 981, position = Position(33647, 32691, 12) },
	{ itemid = 981, position = Position(33648, 32688, 12) },
	{ itemid = 981, position = Position(33644, 32679, 12) },
	{ itemid = 980, position = Position(33648, 32678, 12) },
	{ itemid = 979, position = Position(33647, 32689, 12) },
	{ itemid = 979, position = Position(33635, 32687, 12) },
	{ itemid = 6218, position = Position(33642, 32685, 12) },
	{ itemid = 6218, position = Position(33642, 32684, 12) },
	{ itemid = 6218, position = Position(33639, 32682, 12) },
	{ itemid = 6218, position = Position(33639, 32683, 12) },
	{ itemid = 6218, position = Position(33643, 32684, 12) },
	{ itemid = 6217, position = Position(33641, 32683, 12) },
	{ itemid = 6217, position = Position(33640, 32686, 12) },
	{ itemid = 6217, position = Position(33643, 32685, 12) },
	{ itemid = 6217, position = Position(33640, 32681, 12) },
	{ itemid = 6217, position = Position(33642, 32689, 12) },
	{ itemid = 1866, position = Position(33640, 32690, 12) },
	{ itemid = 1865, position = Position(33638, 32684, 12) },
	{ itemid = 1857, position = Position(33642, 32680, 12) },
	{ itemid = 3650, position = Position(33640, 32687, 12) },
	{ itemid = 3642, position = Position(33639, 32683, 12) },
	{ itemid = 3640, position = Position(33642, 32686, 12) },
	{ itemid = 3639, position = Position(33640, 32680, 12) },
	{ itemid = 3639, position = Position(33643, 32683, 12) },
	{ itemid = 417, position = Position(33647, 32686, 12) },
	{ itemid = 417, position = Position(33647, 32687, 12) },
	{ itemid = 417, position = Position(33648, 32685, 12) },
	{ itemid = 417, position = Position(33646, 32686, 12) },
	{ itemid = 417, position = Position(33648, 32686, 12) },
	{ itemid = 417, position = Position(33648, 32678, 12) },
	{ itemid = 417, position = Position(33648, 32687, 12) },
	{ itemid = 417, position = Position(33648, 32689, 12) },
	{ itemid = 417, position = Position(33647, 32685, 12) },
	{ itemid = 417, position = Position(33647, 32684, 12) },
	{ itemid = 417, position = Position(33647, 32683, 12) },
	{ itemid = 417, position = Position(33646, 32689, 12) },
	{ itemid = 417, position = Position(33646, 32677, 12) },
	{ itemid = 417, position = Position(33646, 32685, 12) },
	{ itemid = 417, position = Position(33647, 32678, 12) },
	{ itemid = 417, position = Position(33648, 32676, 12) },
	{ itemid = 417, position = Position(33647, 32691, 12) },
	{ itemid = 417, position = Position(33648, 32682, 12) },
	{ itemid = 417, position = Position(33648, 32677, 12) },
	{ itemid = 417, position = Position(33646, 32690, 12) },
	{ itemid = 417, position = Position(33647, 32676, 12) },
	{ itemid = 417, position = Position(33648, 32683, 12) },
	{ itemid = 417, position = Position(33648, 32684, 12) },
	{ itemid = 417, position = Position(33647, 32689, 12) },
	{ itemid = 417, position = Position(33647, 32690, 12) },
	{ itemid = 417, position = Position(33646, 32678, 12) },
	{ itemid = 417, position = Position(33647, 32677, 12) },
	{ itemid = 417, position = Position(33646, 32676, 12) },
	{ itemid = 417, position = Position(33634, 32676, 12) },
	{ itemid = 417, position = Position(33648, 32691, 12) },
	{ itemid = 417, position = Position(33635, 32681, 12) },
	{ itemid = 417, position = Position(33635, 32682, 12) },
	{ itemid = 417, position = Position(33635, 32683, 12) },
	{ itemid = 417, position = Position(33635, 32680, 12) },
	{ itemid = 417, position = Position(33635, 32678, 12) },
	{ itemid = 417, position = Position(33635, 32679, 12) },
	{ itemid = 417, position = Position(33635, 32677, 12) },
	{ itemid = 417, position = Position(33635, 32687, 12) },
	{ itemid = 417, position = Position(33635, 32689, 12) },
	{ itemid = 417, position = Position(33636, 32677, 12) },
	{ itemid = 417, position = Position(33636, 32678, 12) },
	{ itemid = 417, position = Position(33635, 32688, 12) },
	{ itemid = 417, position = Position(33636, 32676, 12) },
	{ itemid = 417, position = Position(33635, 32690, 12) },
	{ itemid = 417, position = Position(33635, 32691, 12) },
	{ itemid = 417, position = Position(33636, 32679, 12) },
	{ itemid = 417, position = Position(33635, 32676, 12) },
	{ itemid = 417, position = Position(33634, 32690, 12) },
	{ itemid = 417, position = Position(33634, 32680, 12) },
	{ itemid = 417, position = Position(33634, 32681, 12) },
	{ itemid = 417, position = Position(33634, 32682, 12) },
	{ itemid = 417, position = Position(33634, 32679, 12) },
	{ itemid = 417, position = Position(33634, 32677, 12) },
	{ itemid = 417, position = Position(33634, 32678, 12) },
	{ itemid = 417, position = Position(33634, 32691, 12) },
	{ itemid = 417, position = Position(33634, 32683, 12) },
	{ itemid = 417, position = Position(33634, 32685, 12) },
	{ itemid = 417, position = Position(33634, 32689, 12) },
	{ itemid = 417, position = Position(33634, 32684, 12) },
	{ itemid = 417, position = Position(33634, 32688, 12) },
	{ itemid = 417, position = Position(33634, 32686, 12) },
	{ itemid = 417, position = Position(33634, 32687, 12) },
	{ itemid = 417, position = Position(33636, 32680, 12) },
	{ itemid = 417, position = Position(33636, 32681, 12) },
	{ itemid = 417, position = Position(33636, 32682, 12) },
	{ itemid = 417, position = Position(33645, 32677, 12) },
	{ itemid = 417, position = Position(33644, 32681, 12) },
	{ itemid = 417, position = Position(33645, 32678, 12) },
	{ itemid = 417, position = Position(33645, 32679, 12) },
	{ itemid = 417, position = Position(33638, 32691, 12) },
	{ itemid = 417, position = Position(33648, 32690, 12) },
	{ itemid = 417, position = Position(33643, 32680, 12) },
	{ itemid = 417, position = Position(33644, 32680, 12) },
	{ itemid = 417, position = Position(33642, 32683, 12) },
	{ itemid = 417, position = Position(33643, 32682, 12) },
	{ itemid = 417, position = Position(33643, 32681, 12) },
	{ itemid = 417, position = Position(33644, 32679, 12) },
	{ itemid = 417, position = Position(33637, 32691, 12) },
	{ itemid = 417, position = Position(33637, 32689, 12) },
	{ itemid = 417, position = Position(33636, 32689, 12) },
	{ itemid = 417, position = Position(33636, 32690, 12) },
	{ itemid = 417, position = Position(33636, 32688, 12) },
	{ itemid = 417, position = Position(33636, 32687, 12) },
	{ itemid = 417, position = Position(33637, 32690, 12) },
	{ itemid = 417, position = Position(33636, 32691, 12) },
	{ itemid = 417, position = Position(33637, 32678, 12) },
	{ itemid = 417, position = Position(33637, 32681, 12) },
	{ itemid = 417, position = Position(33637, 32677, 12) },
	{ itemid = 417, position = Position(33637, 32680, 12) },
	{ itemid = 417, position = Position(33637, 32679, 12) },
	{ itemid = 417, position = Position(33644, 32678, 12) },
	{ itemid = 231, position = Position(33640, 32677, 12) },
	{ itemid = 231, position = Position(33646, 32683, 12) },
	{ itemid = 231, position = Position(33639, 32677, 12) },
	{ itemid = 231, position = Position(33646, 32682, 12) },
	{ itemid = 231, position = Position(33639, 32678, 12) },
	{ itemid = 231, position = Position(33640, 32678, 12) },
	{ itemid = 231, position = Position(33645, 32683, 12) },
	{ itemid = 231, position = Position(33645, 32682, 12) },
}

local function transformArea()
	for x = 33634, 33648 do
		for y = 32676, 32691 do
			local position = Position(x, y, 12)
			local tile = Tile(position)
			if not tile then
				return
			end
			local ground = tile:getGround()
			if not ground then
				return
			end
			local grounds = ground:getId()
			local items = tile:getItems()
			for i = 1, #items do
				local item = items[i]
				if item then
					item:remove()
				end
			end
			ground:remove()
		end
	end
	for i = 1, #desert do
		local item = desert[i]
		local ground = Tile(item.position):getGround()
		local transformid = item.itemid
		local tp = Game.createItem(item.itemid, 1, item.position)
	end
	return true
end

local function resetFerumbrasAscendantHabitats(player)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1)
	player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0)
end

local ferumbrasAscendantHabitatDesert = Action()

function ferumbrasAscendantHabitatDesert.onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 9125 then
		if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert) >= 1 then
			player:say("The lever are stuck, need some time to it can be movable again.", TALKTYPE_MONSTER_SAY)
			return true
		end
		Game.createMonster("lovely rotworm", Position(33641, 32684, 12), true, true)
		addEvent(transformArea, 2 * 1000)
		item:transform(9126)
		local basin = Tile(Position(33631, 32685, 12)):getItemById(11114)
		if basin then
			basin:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
			basin:transform(22196)
		end
		player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, 1)
		player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats) + 1)
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The room transforms into a completely different landscape.")
		if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats) >= 7 then
			addEvent(function()
				resetFerumbrasAscendantHabitats(player)
				local basin = Tile(Position(33631, 32685, 12)):getItemById(22196)
				if basin then
					basin:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
					basin:transform(11114)
				end
			end, 1 * 60 * 60 * 1000)
		end
	elseif item.itemid == 9126 then
		item:transform(9125)
	end
	return true
end

ferumbrasAscendantHabitatDesert:aid(34308)
ferumbrasAscendantHabitatDesert:register()
