local config = {
    fromPosition = Position(32731, 32108, 11),
    toPosition = Position(32745, 32121, 11)
}

local items = {
	{itemid = 15104, position = Position(32732, 32113, 11)},
	{itemid = 4515, position = Position(32732,32113, 11)},
	{itemid = 15095, position = Position(32732, 32114, 11)},
	{itemid = 4515, position = Position(32732,32114, 11)},
	{itemid = 15355, position = Position(32732, 32115, 11)},
	{itemid = 4515, position = Position(32732,32115, 11)},
	{itemid = 15104, position = Position(32733, 32111, 11)},
	{itemid = 4515, position = Position(32733,32111, 11)},
	{itemid = 15095, position = Position(32733, 32112, 11)},
	{itemid = 4515, position = Position(32733,32112, 11)},
	{itemid = 15101, position = Position(32733, 32113, 11)},
	{itemid = 4515, position = Position(32733,32113, 11)},
	{itemid = 957, position = Position(32733, 32114, 11)},
	{itemid = 4515, position = Position(32733,32114, 11)},
	{itemid = 15102, position = Position(32733, 32115, 11)},
	{itemid = 4515, position = Position(32733,32115, 11)},
	{itemid = 15355, position = Position(32733, 32116, 11)},
	{itemid = 4515, position = Position(32733,32116, 11)},
	{itemid = 15104, position = Position(32734, 32110, 11)},
	{itemid = 4515, position = Position(32734,32110, 11)},
	{itemid = 15101, position = Position(32734, 32111, 11)},
	{itemid = 4515, position = Position(32734,32111, 11)},
	{itemid = 1855, position = Position(32734, 32112, 11)},
	{itemid = 1855, position = Position(32734, 32112, 11)},
	{itemid = 21935, position = Position(32734, 32112, 11)},
	{itemid = 4515, position = Position(32734,32112, 11)},
	{itemid = 3626, position = Position(32734, 32113, 11)},
	{itemid = 4515, position = Position(32734,32113, 11)},
	{itemid = 4515, position = Position(32734,32114, 11)},
	{itemid = 21935, position = Position(32734, 32115, 11)},
	{itemid = 4515, position = Position(32734,32115, 11)},
	{itemid = 15102, position = Position(32734, 32116, 11)},
	{itemid = 4515, position = Position(32734,32116, 11)},
	{itemid = 15095, position = Position(32734, 32117, 11)},
	{itemid = 4515, position = Position(32734,32117, 11)},
	{itemid = 21935, position = Position(32734, 32118, 11)},
	{itemid = 15355, position = Position(32734, 32118, 11)},
	{itemid = 4515, position = Position(32734,32118, 11)},
	{itemid = 15268, position = Position(32735, 32110, 11)},
	{itemid = 4515, position = Position(32735,32110, 11)},
	{itemid = 4515, position = Position(32735,32111, 11)},
	{itemid = 21935, position = Position(32735, 32112, 11)},
	{itemid = 3616, position = Position(32735, 32112, 11)},
	{itemid = 4515, position = Position(32735,32112, 11)},
	{itemid = 21935, position = Position(32735, 32113, 11)},
	{itemid = 15076, position = Position(32735, 32113, 11)},
	{itemid = 4515, position = Position(32735,32113, 11)},
	{itemid = 21935, position = Position(32735, 32114, 11)},
	{itemid = 15060, position = Position(32735, 32114, 11)},
	{itemid = 4515, position = Position(32735,32114, 11)},
	{itemid = 3619, position = Position(32735, 32115, 11)},
	{itemid = 4515, position = Position(32735,32115, 11)},
	{itemid = 21935, position = Position(32735, 32116, 11)},
	{itemid = 4515, position = Position(32735,32116, 11)},
	{itemid = 3621, position = Position(32735, 32117, 11)},
	{itemid = 4515, position = Position(32735,32117, 11)},
	{itemid = 15102, position = Position(32735, 32118, 11)},
	{itemid = 4515, position = Position(32735,32118, 11)},
	{itemid = 21935, position = Position(32735, 32119, 11)},
	{itemid = 15355, position = Position(32735, 32119, 11)},
	{itemid = 4515, position = Position(32735,32119, 11)},
	{itemid = 15104, position = Position(32736, 32109, 11)},
	{itemid = 4515, position = Position(32736,32108, 11)},
	{itemid = 15101, position = Position(32736, 32110, 11)},
	{itemid = 4515, position = Position(32736,32110, 11)},
	{itemid = 21935, position = Position(32736, 32111, 11)},
	{itemid = 4515, position = Position(32736,32111, 11)},
	{itemid = 21935, position = Position(32736, 32112, 11)},
	{itemid = 15076, position = Position(32736, 32112, 11)},
	{itemid = 4515, position = Position(32736,32112, 11)},
	{itemid = 15392, position = Position(32736, 32113, 11)},
	{itemid = 4515, position = Position(32736,32113, 11)},
	{itemid = 21935, position = Position(32736, 32115, 11)},
	{itemid = 15267, position = Position(32736, 32115, 11)},
	{itemid = 4515, position = Position(32736,32115, 11)},
	{itemid = 21935, position = Position(32736, 32116, 11)},
	{itemid = 15060, position = Position(32736, 32116, 11)},
	{itemid = 4515, position = Position(32736,32116, 11)},
	{itemid = 21935, position = Position(32736, 32117, 11)},
	{itemid = 15060, position = Position(32736, 32117, 11)},
	{itemid = 4515, position = Position(32736,32117, 11)},
	{itemid = 21935, position = Position(32736, 32118, 11)},
	{itemid = 15060, position = Position(32736, 32118, 11)},
	{itemid = 4515, position = Position(32736,32118, 11)},
	{itemid = 21935, position = Position(32736, 32119, 11)},
	{itemid = 15392, position = Position(32736, 32119, 11)},
	{itemid = 4515, position = Position(32736,32119, 11)},
	{itemid = 15267, position = Position(32737, 32109, 11)},
	{itemid = 4515, position = Position(32737,32108, 11)},
	{itemid = 15103, position = Position(32737, 32110, 11)},
	{itemid = 4515, position = Position(32737,32110, 11)},
	{itemid = 21935, position = Position(32737, 32111, 11)},
	{itemid = 4515, position = Position(32737,32111, 11)},
	{itemid = 21935, position = Position(32737, 32112, 11)},
	{itemid = 15069, position = Position(32737, 32112, 11)},
	{itemid = 4515, position = Position(32737,32112, 11)},
	{itemid = 15069, position = Position(32737, 32119, 11)},
	{itemid = 15347, position = Position(32737,32119, 11)},
	{itemid = 15268, position = Position(32738, 32110, 11)},
	{itemid = 4515, position = Position(32738,32110, 11)},
	{itemid = 3625, position = Position(32738, 32111, 11)},
	{itemid = 4515, position = Position(32738,32111, 11)},
	{itemid = 15102, position = Position(32738, 32112, 11)},
	{itemid = 4515, position = Position(32738,32112, 11)},
	{itemid = 15355, position = Position(32738, 32113, 11)},
	{itemid = 4515, position = Position(32738,32113, 11)},
	{itemid = 6149, position = Position(32738, 32115, 11)},
	{itemid = 4515, position = Position(32738,32115, 11)},
	{itemid = 15095, position = Position(32738, 32116, 11)},
	{itemid = 4515, position = Position(32738,32116, 11)},
	{itemid = 15095, position = Position(32738, 32117, 11)},
	{itemid = 4515, position = Position(32738,32117, 11)},
	{itemid = 15095, position = Position(32738, 32118, 11)},
	{itemid = 4515, position = Position(32738,32118, 11)},
	{itemid = 21935, position = Position(32738, 32119, 11)},
	{itemid = 15355, position = Position(32738, 32119, 11)},
	{itemid = 4515, position = Position(32738,32119, 11)},
	{itemid = 15267, position = Position(32739, 32110, 11)},
	{itemid = 4515, position = Position(32739,32110, 11)},
	{itemid = 15103, position = Position(32739, 32111, 11)},
	{itemid = 4515, position = Position(32739,32111, 11)},
	{itemid = 21935, position = Position(32739, 32112, 11)},
	{itemid = 4515, position = Position(32739,32112, 11)},
	{itemid = 15102, position = Position(32739, 32113, 11)},
	{itemid = 4515, position = Position(32739,32113, 11)},
	{itemid = 15095, position = Position(32739, 32114, 11)},
	{itemid = 4515, position = Position(32739,32114, 11)},
	{itemid = 6179, position = Position(32739, 32115, 11)},
	{itemid = 15101, position = Position(32739, 32115, 11)},
	{itemid = 4515, position = Position(32739,32115, 11)},
	{itemid = 6180, position = Position(32739, 32116, 11)},
	{itemid = 21935, position = Position(32739, 32116, 11)},
	{itemid = 4515, position = Position(32739,32116, 11)},
	{itemid = 21935, position = Position(32739, 32117, 11)},
	{itemid = 4515, position = Position(32739,32117, 11)},
	{itemid = 3622, position = Position(32739, 32118, 11)},
	{itemid = 4515, position = Position(32739,32118, 11)},
	{itemid = 21935, position = Position(32739, 32119, 11)},
	{itemid = 15069, position = Position(32739, 32119, 11)},
	{itemid = 4515, position = Position(32739,32119, 11)},
	{itemid = 15267, position = Position(32740, 32111, 11)},
	{itemid = 4515, position = Position(32740,32111, 11)},
	{itemid = 15103, position = Position(32740, 32112, 11)},
	{itemid = 4515, position = Position(32740,32112, 11)},
	{itemid = 21935, position = Position(32740, 32113, 11)},
	{itemid = 4515, position = Position(32740,32113, 11)},
	{itemid = 3617, position = Position(32740, 32114, 11)},
	{itemid = 4515, position = Position(32740,32114, 11)},
	{itemid = 21935, position = Position(32740, 32115, 11)},
	{itemid = 4515, position = Position(32740,32115, 11)},
	{itemid = 21935, position = Position(32740, 32116, 11)},
	{itemid = 4515, position = Position(32740,32116, 11)},
	{itemid = 4515, position = Position(32740,32117, 11)},
	{itemid = 21935, position = Position(32740, 32118, 11)},
	{itemid = 15076, position = Position(32740, 32118, 11)},
	{itemid = 4515, position = Position(32740,32118, 11)},
	{itemid = 21935, position = Position(32740, 32119, 11)},
	{itemid = 15392, position = Position(32740, 32119, 11)},
	{itemid = 4515, position = Position(32740,32119, 11)},
	{itemid = 15267, position = Position(32741, 32112, 11)},
	{itemid = 4515, position = Position(32741,32112, 11)},
	{itemid = 15103, position = Position(32741, 32113, 11)},
	{itemid = 4515, position = Position(32741,32113, 11)},
	{itemid = 21935, position = Position(32741, 32114, 11)},
	{itemid = 4515, position = Position(32741,32114, 11)},
	{itemid = 21935, position = Position(32741, 32115, 11)},
	{itemid = 4515, position = Position(32741,32115, 11)},
	{itemid = 4515, position = Position(32741,32116, 11)},
	{itemid = 21935, position = Position(32741, 32117, 11)},
	{itemid = 15076, position = Position(32741, 32117, 11)},
	{itemid = 4515, position = Position(32741,32117, 11)},
	{itemid = 21935, position = Position(32741, 32118, 11)},
	{itemid = 15392, position = Position(32741, 32118, 11)},
	{itemid = 4515, position = Position(32741,32118, 11)},
	{itemid = 21935, position = Position(32742, 32113, 11)},
	{itemid = 15267, position = Position(32742, 32113, 11)},
	{itemid = 4515, position = Position(32742,32113, 11)},
	{itemid = 21935, position = Position(32742, 32114, 11)},
	{itemid = 15060, position = Position(32742, 32114, 11)},
	{itemid = 4515, position = Position(32742,32114, 11)},
	{itemid = 15103, position = Position(32742, 32115, 11)},
	{itemid = 4515, position = Position(32742,32115, 11)},
	{itemid = 21935, position = Position(32742, 32116, 11)},
	{itemid = 15076, position = Position(32742, 32116, 11)},
	{itemid = 4515, position = Position(32742,32116, 11)},
	{itemid = 21935, position = Position(32742, 32117, 11)},
	{itemid = 15392, position = Position(32742, 32117, 11)},
	{itemid = 4515, position = Position(32742,32117, 11)},
	{itemid = 15267, position = Position(32743, 32115, 11)},
	{itemid = 4515, position = Position(32743,32115, 11)},
	{itemid = 21935, position = Position(32743, 32116, 11)},
	{itemid = 15392, position = Position(32743, 32116, 11)},
	{itemid = 4515, position = Position(32743,32116, 11)}
}

local dry = {
		{itemid = 15104, position = Position(32732, 32113, 11)},
	{itemid = 10605, position = Position(32732,32113, 11)},
	{itemid = 15095, position = Position(32732, 32114, 11)},
	{itemid = 10605, position = Position(32732,32114, 11)},
	{itemid = 15355, position = Position(32732, 32115, 11)},
	{itemid = 10605, position = Position(32732,32115, 11)},
	{itemid = 15104, position = Position(32733, 32111, 11)},
	{itemid = 10605, position = Position(32733,32111, 11)},
	{itemid = 15095, position = Position(32733, 32112, 11)},
	{itemid = 10605, position = Position(32733,32112, 11)},
	{itemid = 15101, position = Position(32733, 32113, 11)},
	{itemid = 10605, position = Position(32733,32113, 11)},
	{itemid = 1866, position = Position(32733, 32114, 11)},
	{itemid = 958, position = Position(32733, 32114, 11)},
	{itemid = 10605, position = Position(32733,32114, 11)},
	{itemid = 15102, position = Position(32733, 32115, 11)},
	{itemid = 10605, position = Position(32733,32115, 11)},
	{itemid = 15355, position = Position(32733, 32116, 11)},
	{itemid = 10605, position = Position(32733,32116, 11)},
	{itemid = 15104, position = Position(32734, 32110, 11)},
	{itemid = 10605, position = Position(32734,32110, 11)},
	{itemid = 15101, position = Position(32734, 32111, 11)},
	{itemid = 10605, position = Position(32734,32111, 11)},
	{itemid = 1855, position = Position(32734, 32112, 11)},
	{itemid = 1855, position = Position(32734, 32112, 11)},
	{itemid = 10605, position = Position(32734,32112, 11)},
	{itemid = 10605, position = Position(32734,32113, 11)},
	{itemid = 6189, position = Position(32734, 32114, 11)},
	{itemid = 10605, position = Position(32734,32114, 11)},
	{itemid = 1856, position = Position(32734, 32115, 11)},
	{itemid = 10605, position = Position(32734,32115, 11)},
	{itemid = 15102, position = Position(32734, 32116, 11)},
	{itemid = 10605, position = Position(32734,32116, 11)},
	{itemid = 15095, position = Position(32734, 32117, 11)},
	{itemid = 10605, position = Position(32734,32117, 11)},
	{itemid = 15355, position = Position(32734, 32118, 11)},
	{itemid = 10605, position = Position(32734,32118, 11)},
	{itemid = 15268, position = Position(32735, 32110, 11)},
	{itemid = 10605, position = Position(32735,32110, 11)},
	{itemid = 6430, position = Position(32735, 32111, 11)},
	{itemid = 10605, position = Position(32735,32111, 11)},
	{itemid = 10605, position = Position(32735,32112, 11)},
	{itemid = 15076, position = Position(32735, 32113, 11)},
	{itemid = 10605, position = Position(32735,32113, 11)},
	{itemid = 15060, position = Position(32735, 32114, 11)},
	{itemid = 10605, position = Position(32735,32114, 11)},
	{itemid = 6431, position = Position(32735, 32115, 11)},
	{itemid = 10605, position = Position(32735,32115, 11)},
	{itemid = 10605, position = Position(32735,32116, 11)},
	{itemid = 6430, position = Position(32735, 32117, 11)},
	{itemid = 10605, position = Position(32735,32117, 11)},
	{itemid = 15102, position = Position(32735, 32118, 11)},
	{itemid = 10605, position = Position(32735,32118, 11)},
	{itemid = 15355, position = Position(32735, 32119, 11)},
	{itemid = 10605, position = Position(32735,32119, 11)},
	{itemid = 15104, position = Position(32736, 32109, 11)},
	{itemid = 10605, position = Position(32736,32108, 11)},
	{itemid = 15101, position = Position(32736, 32110, 11)},
	{itemid = 10605, position = Position(32736,32110, 11)},
	{itemid = 10605, position = Position(32736,32111, 11)},
	{itemid = 15076, position = Position(32736, 32112, 11)},
	{itemid = 10605, position = Position(32736,32112, 11)},
	{itemid = 15392, position = Position(32736, 32113, 11)},
	{itemid = 10605, position = Position(32736,32113, 11)},
	{itemid = 15267, position = Position(32736, 32115, 11)},
	{itemid = 10605, position = Position(32736,32115, 11)},
	{itemid = 15060, position = Position(32736, 32116, 11)},
	{itemid = 10605, position = Position(32736,32116, 11)},
	{itemid = 15060, position = Position(32736, 32117, 11)},
	{itemid = 10605, position = Position(32736,32117, 11)},
	{itemid = 15060, position = Position(32736, 32118, 11)},
	{itemid = 10605, position = Position(32736,32118, 11)},
	{itemid = 15392, position = Position(32736, 32119, 11)},
	{itemid = 10605, position = Position(32736,32119, 11)},
	{itemid = 15267, position = Position(32737, 32109, 11)},
	{itemid = 10605, position = Position(32737,32108, 11)},
	{itemid = 15103, position = Position(32737, 32110, 11)},
	{itemid = 10605, position = Position(32737,32110, 11)},
	{itemid = 6190, position = Position(32737, 32111, 11)},
	{itemid = 10605, position = Position(32737,32111, 11)},
	{itemid = 15069, position = Position(32737, 32112, 11)},
	{itemid = 10605, position = Position(32737,32112, 11)},
	{itemid = 15069, position = Position(32737, 32119, 11)},
	{itemid = 15347, position = Position(32737,32119, 11)},
	{itemid = 15268, position = Position(32738, 32110, 11)},
	{itemid = 10605, position = Position(32738,32110, 11)},
	{itemid = 10605, position = Position(32738,32111, 11)},
	{itemid = 15102, position = Position(32738, 32112, 11)},
	{itemid = 10605, position = Position(32738,32112, 11)},
	{itemid = 15355, position = Position(32738, 32113, 11)},
	{itemid = 10605, position = Position(32738,32113, 11)},
	{itemid = 6149, position = Position(32738, 32115, 11)},
	{itemid = 10605, position = Position(32738,32115, 11)},
	{itemid = 15095, position = Position(32738, 32116, 11)},
	{itemid = 10605, position = Position(32738,32116, 11)},
	{itemid = 15095, position = Position(32738, 32117, 11)},
	{itemid = 10605, position = Position(32738,32117, 11)},
	{itemid = 15095, position = Position(32738, 32118, 11)},
	{itemid = 10605, position = Position(32738,32118, 11)},
	{itemid = 15355, position = Position(32738, 32119, 11)},
	{itemid = 10605, position = Position(32738,32119, 11)},
	{itemid = 15267, position = Position(32739, 32110, 11)},
	{itemid = 10605, position = Position(32739,32110, 11)},
	{itemid = 15103, position = Position(32739, 32111, 11)},
	{itemid = 10605, position = Position(32739,32111, 11)},
	{itemid = 10605, position = Position(32739,32112, 11)},
	{itemid = 15102, position = Position(32739, 32113, 11)},
	{itemid = 10605, position = Position(32739,32113, 11)},
	{itemid = 15095, position = Position(32739, 32114, 11)},
	{itemid = 10605, position = Position(32739,32114, 11)},
	{itemid = 6179, position = Position(32739, 32115, 11)},
	{itemid = 15101, position = Position(32739, 32115, 11)},
	{itemid = 10605, position = Position(32739,32115, 11)},
	{itemid = 6180, position = Position(32739, 32116, 11)},
	{itemid = 10605, position = Position(32739,32116, 11)},
	{itemid = 10605, position = Position(32739,32117, 11)},
	{itemid = 10605, position = Position(32739,32118, 11)},
	{itemid = 15069, position = Position(32739, 32119, 11)},
	{itemid = 10605, position = Position(32739,32119, 11)},
	{itemid = 15267, position = Position(32740, 32111, 11)},
	{itemid = 10605, position = Position(32740,32111, 11)},
	{itemid = 15103, position = Position(32740, 32112, 11)},
	{itemid = 10605, position = Position(32740,32112, 11)},
	{itemid = 1866, position = Position(32740, 32113, 11)},
	{itemid = 1866, position = Position(32740, 32113, 11)},
	{itemid = 6430, position = Position(32740, 32113, 11)},
	{itemid = 10605, position = Position(32740,32113, 11)},
	{itemid = 10605, position = Position(32740,32114, 11)},
	{itemid = 10605, position = Position(32740,32115, 11)},
	{itemid = 1855, position = Position(32740, 32116, 11)},
	{itemid = 10605, position = Position(32740,32116, 11)},
	{itemid = 6431, position = Position(32740, 32117, 11)},
	{itemid = 10605, position = Position(32740,32117, 11)},
	{itemid = 15076, position = Position(32740, 32118, 11)},
	{itemid = 10605, position = Position(32740,32118, 11)},
	{itemid = 15392, position = Position(32740, 32119, 11)},
	{itemid = 10605, position = Position(32740,32119, 11)},
	{itemid = 15267, position = Position(32741, 32112, 11)},
	{itemid = 10605, position = Position(32741,32112, 11)},
	{itemid = 15103, position = Position(32741, 32113, 11)},
	{itemid = 10605, position = Position(32741,32113, 11)},
	{itemid = 10605, position = Position(32741,32114, 11)},
	{itemid = 6431, position = Position(32741, 32115, 11)},
	{itemid = 10605, position = Position(32741,32115, 11)},
	{itemid = 10605, position = Position(32741,32116, 11)},
	{itemid = 15076, position = Position(32741, 32117, 11)},
	{itemid = 10605, position = Position(32741,32117, 11)},
	{itemid = 15392, position = Position(32741, 32118, 11)},
	{itemid = 10605, position = Position(32741,32118, 11)},
	{itemid = 15267, position = Position(32742, 32113, 11)},
	{itemid = 10605, position = Position(32742,32113, 11)},
	{itemid = 15060, position = Position(32742, 32114, 11)},
	{itemid = 10605, position = Position(32742,32114, 11)},
	{itemid = 15103, position = Position(32742, 32115, 11)},
	{itemid = 10605, position = Position(32742,32115, 11)},
	{itemid = 15076, position = Position(32742, 32116, 11)},
	{itemid = 10605, position = Position(32742,32116, 11)},
	{itemid = 15392, position = Position(32742, 32117, 11)},
	{itemid = 10605, position = Position(32742,32117, 11)},
	{itemid = 15267, position = Position(32743, 32115, 11)},
	{itemid = 10605, position = Position(32743,32115, 11)},
	{itemid = 15392, position = Position(32743, 32116, 11)},
	{itemid = 10605, position = Position(32743,32116, 11)}
}

local function revertItem(position, itemId, transformId)
	local item = Tile(position):getItemById(itemId)
	if item then
		item:transform(transformId)
	end
end

local function revertTree()
	iterateArea(
		function(position)
			local tile = Tile(position)
			if tile then
				local items = tile:getItems()
				if items then
					for i = 1, #items do
						items[i]:remove()
					end
				end

				local ground = tile:getGround()
				if ground then
					ground:remove()
				end
			end
		end,
		config.fromPosition,
		config.toPosition
	)
	local tree = Tile(Position(32737, 32114, 10)):getItemById(3617)
	local teleport = Tile(Position(32736, 32117, 10)):getItemById(775)
	local jade = Tile(Position(32736, 32117, 10)):getItemById(11108)
	if teleport then
		teleport:getPosition():sendMagicEffect(CONST_ME_POFF)
		teleport:remove()
	end
	if jade then
		jade:remove()
	end
	if tree then
		tree:getPosition():sendMagicEffect(CONST_ME_POFF)
		tree:transform(6189)
	end
	Game.setStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree, 0)
	for v = 1, #dry do
		Game.createItem(dry[v].itemid, 1, dry[v].position)
		local pos = Position(dry[v].position)
		pos:sendMagicEffect(CONST_ME_POFF)
	end
end

local forgottenKnowledgePlant = Action()
function forgottenKnowledgePlant.onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if item.itemid == 23811 then
		if target.itemid ~= 23814 then
			return false
		end
		target:transform(23816)
		target:getPosition():sendMagicEffect(CONST_ME_SMALLPLANTS)
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You planted some seeds into the soil.')
		addEvent(revertItem, 10 * 60 * 1000, target:getPosition(), 26484, 26482)
		item:remove(1)
		return true
	elseif item.itemid == 23810 then
		if target.itemid == 23816 then
			target:transform(23815)
			target:getPosition():sendMagicEffect(CONST_ME_SMALLPLANTS)
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The birch grows as you pour the sparkling water from the phial over it.')
			addEvent(revertItem, 10 * 60 * 1000, target:getPosition(), 26483, 26482)
			if player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) < 0 then
				player:setStorageValue(Storage.ForgottenKnowledge.PlantCounter, 0)
			end
			player:setStorageValue(Storage.ForgottenKnowledge.PlantCounter, player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) + 1)
		elseif target.itemid == 6180 and target:getPosition() == Position(32737, 32116, 10) then
			if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree) >= 1 then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You cannot use the phial while the trees still have life and colour.')
				return true
			end
			if player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) < 5 or player:getStorageValue(Storage.ForgottenKnowledge.BirdCounter) < 3 then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Seems that you don\'t make grow enough trees or not free the parrots.')
				return true
			end
			iterateArea(
				function(position)
					local tile = Tile(position)
					if tile then
						local items = tile:getItems()
						if items then
							for i = 1, #items do
								items[i]:remove()
							end
						end

						local ground = tile:getGround()
						if ground then
							ground:remove()
						end
					end
				end,
				config.fromPosition,
				config.toPosition
			)
			for k = 1, #items do
				Game.createItem(items[k].itemid, 1, items[k].position)
				local pos = Position(items[k].position)
				pos:sendMagicEffect(CONST_ME_THUNDER)
			end
			local tree = Tile(Position(32737, 32114, 10)):getItemById(6189)
			if tree then
				tree:getPosition():sendMagicEffect(CONST_ME_THUNDER)
				tree:transform(3617)
			end
			local contingences = Tile(Position(32736, 32117, 10)):getItems()
			if contingences then
				for h = 1, #contingences do
					local contingence = contingences[h]
					if contingence then
						contingence:moveTo(Position(32737, 32117, 10))
					end
				end
			end
			Game.setStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree, 1)
			addEvent(revertTree, 1 * 60 * 1000)
			Game.createItem(11108, 1, Position(32736, 32117, 10))
			local teleport = Game.createItem(775, 1, Position(32736, 32117, 10))
			local creature = Tile(Position(32736, 32117, 10)):getTopCreature()
			if creature then
				creature:teleportTo(Position(32737, 32117, 10))
			end
			if teleport then
				teleport:setActionId(27830)
				teleport:getPosition():sendMagicEffect(CONST_ME_THUNDER)
			end
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Suddenly the area brightens and everything around you starts to bloom and thrive with life and colour.')
		else
			return false
		end
	end
	return true
end

forgottenKnowledgePlant:id(23810,23811)
forgottenKnowledgePlant:register()