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

local items = {
	{itemid = 17727, position = Position(32732, 32113, 11)},
	{itemid = 9043, position = Position(32732,32113, 11)},
	{itemid = 17720, position = Position(32732, 32114, 11)},
	{itemid = 9043, position = Position(32732,32114, 11)},
	{itemid = 17898, position = Position(32732, 32115, 11)},
	{itemid = 9043, position = Position(32732,32115, 11)},
	{itemid = 17727, position = Position(32733, 32111, 11)},
	{itemid = 9043, position = Position(32733,32111, 11)},
	{itemid = 17720, position = Position(32733, 32112, 11)},
	{itemid = 9043, position = Position(32733,32112, 11)},
	{itemid = 17724, position = Position(32733, 32113, 11)},
	{itemid = 9043, position = Position(32733,32113, 11)},
	{itemid = 8313, position = Position(32733, 32114, 11)},
	{itemid = 9043, position = Position(32733,32114, 11)},
	{itemid = 17725, position = Position(32733, 32115, 11)},
	{itemid = 9043, position = Position(32733,32115, 11)},
	{itemid = 17898, position = Position(32733, 32116, 11)},
	{itemid = 9043, position = Position(32733,32116, 11)},
	{itemid = 17727, position = Position(32734, 32110, 11)},
	{itemid = 9043, position = Position(32734,32110, 11)},
	{itemid = 17724, position = Position(32734, 32111, 11)},
	{itemid = 9043, position = Position(32734,32111, 11)},
	{itemid = 3611, position = Position(32734, 32112, 11)},
	{itemid = 3611, position = Position(32734, 32112, 11)},
	{itemid = 6217, position = Position(32734, 32112, 11)},
	{itemid = 9043, position = Position(32734,32112, 11)},
	{itemid = 2712, position = Position(32734, 32113, 11)},
	{itemid = 9043, position = Position(32734,32113, 11)},
	{itemid = 9043, position = Position(32734,32114, 11)},
	{itemid = 6217, position = Position(32734, 32115, 11)},
	{itemid = 9043, position = Position(32734,32115, 11)},
	{itemid = 17725, position = Position(32734, 32116, 11)},
	{itemid = 9043, position = Position(32734,32116, 11)},
	{itemid = 17720, position = Position(32734, 32117, 11)},
	{itemid = 9043, position = Position(32734,32117, 11)},
	{itemid = 6217, position = Position(32734, 32118, 11)},
	{itemid = 17898, position = Position(32734, 32118, 11)},
	{itemid = 9043, position = Position(32734,32118, 11)},
	{itemid = 17843, position = Position(32735, 32110, 11)},
	{itemid = 9043, position = Position(32735,32110, 11)},
	{itemid = 9043, position = Position(32735,32111, 11)},
	{itemid = 6217, position = Position(32735, 32112, 11)},
	{itemid = 2702, position = Position(32735, 32112, 11)},
	{itemid = 9043, position = Position(32735,32112, 11)},
	{itemid = 6217, position = Position(32735, 32113, 11)},
	{itemid = 17701, position = Position(32735, 32113, 11)},
	{itemid = 9043, position = Position(32735,32113, 11)},
	{itemid = 6217, position = Position(32735, 32114, 11)},
	{itemid = 17685, position = Position(32735, 32114, 11)},
	{itemid = 9043, position = Position(32735,32114, 11)},
	{itemid = 2705, position = Position(32735, 32115, 11)},
	{itemid = 9043, position = Position(32735,32115, 11)},
	{itemid = 6217, position = Position(32735, 32116, 11)},
	{itemid = 9043, position = Position(32735,32116, 11)},
	{itemid = 2707, position = Position(32735, 32117, 11)},
	{itemid = 9043, position = Position(32735,32117, 11)},
	{itemid = 17725, position = Position(32735, 32118, 11)},
	{itemid = 9043, position = Position(32735,32118, 11)},
	{itemid = 6217, position = Position(32735, 32119, 11)},
	{itemid = 17898, position = Position(32735, 32119, 11)},
	{itemid = 9043, position = Position(32735,32119, 11)},
	{itemid = 17727, position = Position(32736, 32109, 11)},
	{itemid = 9043, position = Position(32736,32108, 11)},
	{itemid = 17724, position = Position(32736, 32110, 11)},
	{itemid = 9043, position = Position(32736,32110, 11)},
	{itemid = 6217, position = Position(32736, 32111, 11)},
	{itemid = 9043, position = Position(32736,32111, 11)},
	{itemid = 6217, position = Position(32736, 32112, 11)},
	{itemid = 17701, position = Position(32736, 32112, 11)},
	{itemid = 9043, position = Position(32736,32112, 11)},
	{itemid = 17933, position = Position(32736, 32113, 11)},
	{itemid = 9043, position = Position(32736,32113, 11)},
	{itemid = 6217, position = Position(32736, 32115, 11)},
	{itemid = 17842, position = Position(32736, 32115, 11)},
	{itemid = 9043, position = Position(32736,32115, 11)},
	{itemid = 6217, position = Position(32736, 32116, 11)},
	{itemid = 17685, position = Position(32736, 32116, 11)},
	{itemid = 9043, position = Position(32736,32116, 11)},
	{itemid = 6217, position = Position(32736, 32117, 11)},
	{itemid = 17685, position = Position(32736, 32117, 11)},
	{itemid = 9043, position = Position(32736,32117, 11)},
	{itemid = 6217, position = Position(32736, 32118, 11)},
	{itemid = 17685, position = Position(32736, 32118, 11)},
	{itemid = 9043, position = Position(32736,32118, 11)},
	{itemid = 6217, position = Position(32736, 32119, 11)},
	{itemid = 17933, position = Position(32736, 32119, 11)},
	{itemid = 9043, position = Position(32736,32119, 11)},
	{itemid = 17842, position = Position(32737, 32109, 11)},
	{itemid = 9043, position = Position(32737,32108, 11)},
	{itemid = 17726, position = Position(32737, 32110, 11)},
	{itemid = 9043, position = Position(32737,32110, 11)},
	{itemid = 6217, position = Position(32737, 32111, 11)},
	{itemid = 9043, position = Position(32737,32111, 11)},
	{itemid = 6217, position = Position(32737, 32112, 11)},
	{itemid = 17694, position = Position(32737, 32112, 11)},
	{itemid = 9043, position = Position(32737,32112, 11)},
	{itemid = 17694, position = Position(32737, 32119, 11)},
	{itemid = 17894, position = Position(32737,32119, 11)},
	{itemid = 17843, position = Position(32738, 32110, 11)},
	{itemid = 9043, position = Position(32738,32110, 11)},
	{itemid = 2711, position = Position(32738, 32111, 11)},
	{itemid = 9043, position = Position(32738,32111, 11)},
	{itemid = 17725, position = Position(32738, 32112, 11)},
	{itemid = 9043, position = Position(32738,32112, 11)},
	{itemid = 17898, position = Position(32738, 32113, 11)},
	{itemid = 9043, position = Position(32738,32113, 11)},
	{itemid = 6150, position = Position(32738, 32115, 11)},
	{itemid = 9043, position = Position(32738,32115, 11)},
	{itemid = 17720, position = Position(32738, 32116, 11)},
	{itemid = 9043, position = Position(32738,32116, 11)},
	{itemid = 17720, position = Position(32738, 32117, 11)},
	{itemid = 9043, position = Position(32738,32117, 11)},
	{itemid = 17720, position = Position(32738, 32118, 11)},
	{itemid = 9043, position = Position(32738,32118, 11)},
	{itemid = 6217, position = Position(32738, 32119, 11)},
	{itemid = 17898, position = Position(32738, 32119, 11)},
	{itemid = 9043, position = Position(32738,32119, 11)},
	{itemid = 17842, position = Position(32739, 32110, 11)},
	{itemid = 9043, position = Position(32739,32110, 11)},
	{itemid = 17726, position = Position(32739, 32111, 11)},
	{itemid = 9043, position = Position(32739,32111, 11)},
	{itemid = 6217, position = Position(32739, 32112, 11)},
	{itemid = 9043, position = Position(32739,32112, 11)},
	{itemid = 17725, position = Position(32739, 32113, 11)},
	{itemid = 9043, position = Position(32739,32113, 11)},
	{itemid = 17720, position = Position(32739, 32114, 11)},
	{itemid = 9043, position = Position(32739,32114, 11)},
	{itemid = 6180, position = Position(32739, 32115, 11)},
	{itemid = 17724, position = Position(32739, 32115, 11)},
	{itemid = 9043, position = Position(32739,32115, 11)},
	{itemid = 6181, position = Position(32739, 32116, 11)},
	{itemid = 6217, position = Position(32739, 32116, 11)},
	{itemid = 9043, position = Position(32739,32116, 11)},
	{itemid = 6217, position = Position(32739, 32117, 11)},
	{itemid = 9043, position = Position(32739,32117, 11)},
	{itemid = 2708, position = Position(32739, 32118, 11)},
	{itemid = 9043, position = Position(32739,32118, 11)},
	{itemid = 6217, position = Position(32739, 32119, 11)},
	{itemid = 17694, position = Position(32739, 32119, 11)},
	{itemid = 9043, position = Position(32739,32119, 11)},
	{itemid = 17842, position = Position(32740, 32111, 11)},
	{itemid = 9043, position = Position(32740,32111, 11)},
	{itemid = 17726, position = Position(32740, 32112, 11)},
	{itemid = 9043, position = Position(32740,32112, 11)},
	{itemid = 6217, position = Position(32740, 32113, 11)},
	{itemid = 9043, position = Position(32740,32113, 11)},
	{itemid = 2703, position = Position(32740, 32114, 11)},
	{itemid = 9043, position = Position(32740,32114, 11)},
	{itemid = 6217, position = Position(32740, 32115, 11)},
	{itemid = 9043, position = Position(32740,32115, 11)},
	{itemid = 6217, position = Position(32740, 32116, 11)},
	{itemid = 9043, position = Position(32740,32116, 11)},
	{itemid = 9043, position = Position(32740,32117, 11)},
	{itemid = 6217, position = Position(32740, 32118, 11)},
	{itemid = 17701, position = Position(32740, 32118, 11)},
	{itemid = 9043, position = Position(32740,32118, 11)},
	{itemid = 6217, position = Position(32740, 32119, 11)},
	{itemid = 17933, position = Position(32740, 32119, 11)},
	{itemid = 9043, position = Position(32740,32119, 11)},
	{itemid = 17842, position = Position(32741, 32112, 11)},
	{itemid = 9043, position = Position(32741,32112, 11)},
	{itemid = 17726, position = Position(32741, 32113, 11)},
	{itemid = 9043, position = Position(32741,32113, 11)},
	{itemid = 6217, position = Position(32741, 32114, 11)},
	{itemid = 9043, position = Position(32741,32114, 11)},
	{itemid = 6217, position = Position(32741, 32115, 11)},
	{itemid = 9043, position = Position(32741,32115, 11)},
	{itemid = 9043, position = Position(32741,32116, 11)},
	{itemid = 6217, position = Position(32741, 32117, 11)},
	{itemid = 17701, position = Position(32741, 32117, 11)},
	{itemid = 9043, position = Position(32741,32117, 11)},
	{itemid = 6217, position = Position(32741, 32118, 11)},
	{itemid = 17933, position = Position(32741, 32118, 11)},
	{itemid = 9043, position = Position(32741,32118, 11)},
	{itemid = 6217, position = Position(32742, 32113, 11)},
	{itemid = 17842, position = Position(32742, 32113, 11)},
	{itemid = 9043, position = Position(32742,32113, 11)},
	{itemid = 6217, position = Position(32742, 32114, 11)},
	{itemid = 17685, position = Position(32742, 32114, 11)},
	{itemid = 9043, position = Position(32742,32114, 11)},
	{itemid = 17726, position = Position(32742, 32115, 11)},
	{itemid = 9043, position = Position(32742,32115, 11)},
	{itemid = 6217, position = Position(32742, 32116, 11)},
	{itemid = 17701, position = Position(32742, 32116, 11)},
	{itemid = 9043, position = Position(32742,32116, 11)},
	{itemid = 6217, position = Position(32742, 32117, 11)},
	{itemid = 17933, position = Position(32742, 32117, 11)},
	{itemid = 9043, position = Position(32742,32117, 11)},
	{itemid = 17842, position = Position(32743, 32115, 11)},
	{itemid = 9043, position = Position(32743,32115, 11)},
	{itemid = 6217, position = Position(32743, 32116, 11)},
	{itemid = 17933, position = Position(32743, 32116, 11)},
	{itemid = 9043, position = Position(32743,32116, 11)}
}

local dry = {
		{itemid = 17727, position = Position(32732, 32113, 11)},
	{itemid = 11561, position = Position(32732,32113, 11)},
	{itemid = 17720, position = Position(32732, 32114, 11)},
	{itemid = 11561, position = Position(32732,32114, 11)},
	{itemid = 17898, position = Position(32732, 32115, 11)},
	{itemid = 11561, position = Position(32732,32115, 11)},
	{itemid = 17727, position = Position(32733, 32111, 11)},
	{itemid = 11561, position = Position(32733,32111, 11)},
	{itemid = 17720, position = Position(32733, 32112, 11)},
	{itemid = 11561, position = Position(32733,32112, 11)},
	{itemid = 17724, position = Position(32733, 32113, 11)},
	{itemid = 11561, position = Position(32733,32113, 11)},
	{itemid = 3622, position = Position(32733, 32114, 11)},
	{itemid = 8314, position = Position(32733, 32114, 11)},
	{itemid = 11561, position = Position(32733,32114, 11)},
	{itemid = 17725, position = Position(32733, 32115, 11)},
	{itemid = 11561, position = Position(32733,32115, 11)},
	{itemid = 17898, position = Position(32733, 32116, 11)},
	{itemid = 11561, position = Position(32733,32116, 11)},
	{itemid = 17727, position = Position(32734, 32110, 11)},
	{itemid = 11561, position = Position(32734,32110, 11)},
	{itemid = 17724, position = Position(32734, 32111, 11)},
	{itemid = 11561, position = Position(32734,32111, 11)},
	{itemid = 3611, position = Position(32734, 32112, 11)},
	{itemid = 3611, position = Position(32734, 32112, 11)},
	{itemid = 11561, position = Position(32734,32112, 11)},
	{itemid = 11561, position = Position(32734,32113, 11)},
	{itemid = 6190, position = Position(32734, 32114, 11)},
	{itemid = 11561, position = Position(32734,32114, 11)},
	{itemid = 3612, position = Position(32734, 32115, 11)},
	{itemid = 11561, position = Position(32734,32115, 11)},
	{itemid = 17725, position = Position(32734, 32116, 11)},
	{itemid = 11561, position = Position(32734,32116, 11)},
	{itemid = 17720, position = Position(32734, 32117, 11)},
	{itemid = 11561, position = Position(32734,32117, 11)},
	{itemid = 17898, position = Position(32734, 32118, 11)},
	{itemid = 11561, position = Position(32734,32118, 11)},
	{itemid = 17843, position = Position(32735, 32110, 11)},
	{itemid = 11561, position = Position(32735,32110, 11)},
	{itemid = 6431, position = Position(32735, 32111, 11)},
	{itemid = 11561, position = Position(32735,32111, 11)},
	{itemid = 11561, position = Position(32735,32112, 11)},
	{itemid = 17701, position = Position(32735, 32113, 11)},
	{itemid = 11561, position = Position(32735,32113, 11)},
	{itemid = 17685, position = Position(32735, 32114, 11)},
	{itemid = 11561, position = Position(32735,32114, 11)},
	{itemid = 6432, position = Position(32735, 32115, 11)},
	{itemid = 11561, position = Position(32735,32115, 11)},
	{itemid = 11561, position = Position(32735,32116, 11)},
	{itemid = 6431, position = Position(32735, 32117, 11)},
	{itemid = 11561, position = Position(32735,32117, 11)},
	{itemid = 17725, position = Position(32735, 32118, 11)},
	{itemid = 11561, position = Position(32735,32118, 11)},
	{itemid = 17898, position = Position(32735, 32119, 11)},
	{itemid = 11561, position = Position(32735,32119, 11)},
	{itemid = 17727, position = Position(32736, 32109, 11)},
	{itemid = 11561, position = Position(32736,32108, 11)},
	{itemid = 17724, position = Position(32736, 32110, 11)},
	{itemid = 11561, position = Position(32736,32110, 11)},
	{itemid = 11561, position = Position(32736,32111, 11)},
	{itemid = 17701, position = Position(32736, 32112, 11)},
	{itemid = 11561, position = Position(32736,32112, 11)},
	{itemid = 17933, position = Position(32736, 32113, 11)},
	{itemid = 11561, position = Position(32736,32113, 11)},
	{itemid = 17842, position = Position(32736, 32115, 11)},
	{itemid = 11561, position = Position(32736,32115, 11)},
	{itemid = 17685, position = Position(32736, 32116, 11)},
	{itemid = 11561, position = Position(32736,32116, 11)},
	{itemid = 17685, position = Position(32736, 32117, 11)},
	{itemid = 11561, position = Position(32736,32117, 11)},
	{itemid = 17685, position = Position(32736, 32118, 11)},
	{itemid = 11561, position = Position(32736,32118, 11)},
	{itemid = 17933, position = Position(32736, 32119, 11)},
	{itemid = 11561, position = Position(32736,32119, 11)},
	{itemid = 17842, position = Position(32737, 32109, 11)},
	{itemid = 11561, position = Position(32737,32108, 11)},
	{itemid = 17726, position = Position(32737, 32110, 11)},
	{itemid = 11561, position = Position(32737,32110, 11)},
	{itemid = 6191, position = Position(32737, 32111, 11)},
	{itemid = 11561, position = Position(32737,32111, 11)},
	{itemid = 17694, position = Position(32737, 32112, 11)},
	{itemid = 11561, position = Position(32737,32112, 11)},
	{itemid = 17694, position = Position(32737, 32119, 11)},
	{itemid = 17894, position = Position(32737,32119, 11)},
	{itemid = 17843, position = Position(32738, 32110, 11)},
	{itemid = 11561, position = Position(32738,32110, 11)},
	{itemid = 11561, position = Position(32738,32111, 11)},
	{itemid = 17725, position = Position(32738, 32112, 11)},
	{itemid = 11561, position = Position(32738,32112, 11)},
	{itemid = 17898, position = Position(32738, 32113, 11)},
	{itemid = 11561, position = Position(32738,32113, 11)},
	{itemid = 6150, position = Position(32738, 32115, 11)},
	{itemid = 11561, position = Position(32738,32115, 11)},
	{itemid = 17720, position = Position(32738, 32116, 11)},
	{itemid = 11561, position = Position(32738,32116, 11)},
	{itemid = 17720, position = Position(32738, 32117, 11)},
	{itemid = 11561, position = Position(32738,32117, 11)},
	{itemid = 17720, position = Position(32738, 32118, 11)},
	{itemid = 11561, position = Position(32738,32118, 11)},
	{itemid = 17898, position = Position(32738, 32119, 11)},
	{itemid = 11561, position = Position(32738,32119, 11)},
	{itemid = 17842, position = Position(32739, 32110, 11)},
	{itemid = 11561, position = Position(32739,32110, 11)},
	{itemid = 17726, position = Position(32739, 32111, 11)},
	{itemid = 11561, position = Position(32739,32111, 11)},
	{itemid = 11561, position = Position(32739,32112, 11)},
	{itemid = 17725, position = Position(32739, 32113, 11)},
	{itemid = 11561, position = Position(32739,32113, 11)},
	{itemid = 17720, position = Position(32739, 32114, 11)},
	{itemid = 11561, position = Position(32739,32114, 11)},
	{itemid = 6180, position = Position(32739, 32115, 11)},
	{itemid = 17724, position = Position(32739, 32115, 11)},
	{itemid = 11561, position = Position(32739,32115, 11)},
	{itemid = 6181, position = Position(32739, 32116, 11)},
	{itemid = 11561, position = Position(32739,32116, 11)},
	{itemid = 11561, position = Position(32739,32117, 11)},
	{itemid = 11561, position = Position(32739,32118, 11)},
	{itemid = 17694, position = Position(32739, 32119, 11)},
	{itemid = 11561, position = Position(32739,32119, 11)},
	{itemid = 17842, position = Position(32740, 32111, 11)},
	{itemid = 11561, position = Position(32740,32111, 11)},
	{itemid = 17726, position = Position(32740, 32112, 11)},
	{itemid = 11561, position = Position(32740,32112, 11)},
	{itemid = 3622, position = Position(32740, 32113, 11)},
	{itemid = 3622, position = Position(32740, 32113, 11)},
	{itemid = 6431, position = Position(32740, 32113, 11)},
	{itemid = 11561, position = Position(32740,32113, 11)},
	{itemid = 11561, position = Position(32740,32114, 11)},
	{itemid = 11561, position = Position(32740,32115, 11)},
	{itemid = 3611, position = Position(32740, 32116, 11)},
	{itemid = 11561, position = Position(32740,32116, 11)},
	{itemid = 6432, position = Position(32740, 32117, 11)},
	{itemid = 11561, position = Position(32740,32117, 11)},
	{itemid = 17701, position = Position(32740, 32118, 11)},
	{itemid = 11561, position = Position(32740,32118, 11)},
	{itemid = 17933, position = Position(32740, 32119, 11)},
	{itemid = 11561, position = Position(32740,32119, 11)},
	{itemid = 17842, position = Position(32741, 32112, 11)},
	{itemid = 11561, position = Position(32741,32112, 11)},
	{itemid = 17726, position = Position(32741, 32113, 11)},
	{itemid = 11561, position = Position(32741,32113, 11)},
	{itemid = 11561, position = Position(32741,32114, 11)},
	{itemid = 6432, position = Position(32741, 32115, 11)},
	{itemid = 11561, position = Position(32741,32115, 11)},
	{itemid = 11561, position = Position(32741,32116, 11)},
	{itemid = 17701, position = Position(32741, 32117, 11)},
	{itemid = 11561, position = Position(32741,32117, 11)},
	{itemid = 17933, position = Position(32741, 32118, 11)},
	{itemid = 11561, position = Position(32741,32118, 11)},
	{itemid = 17842, position = Position(32742, 32113, 11)},
	{itemid = 11561, position = Position(32742,32113, 11)},
	{itemid = 17685, position = Position(32742, 32114, 11)},
	{itemid = 11561, position = Position(32742,32114, 11)},
	{itemid = 17726, position = Position(32742, 32115, 11)},
	{itemid = 11561, position = Position(32742,32115, 11)},
	{itemid = 17701, position = Position(32742, 32116, 11)},
	{itemid = 11561, position = Position(32742,32116, 11)},
	{itemid = 17933, position = Position(32742, 32117, 11)},
	{itemid = 11561, position = Position(32742,32117, 11)},
	{itemid = 17842, position = Position(32743, 32115, 11)},
	{itemid = 11561, position = Position(32743,32115, 11)},
	{itemid = 17933, position = Position(32743, 32116, 11)},
	{itemid = 11561, 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(2703)
	local teleport = Tile(Position(32736, 32117, 10)):getItemById(1397)
	local jade = Tile(Position(32736, 32117, 10)):getItemById(12064)
	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(6190)
	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 == 26479 then
		if target.itemid ~= 26482 then
			return false
		end
		target:transform(26484)
		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 == 26478 then
		if target.itemid == 26484 then
			target:transform(26483)
			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 == 6181 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(6190)
			if tree then
				tree:getPosition():sendMagicEffect(CONST_ME_THUNDER)
				tree:transform(2703)
			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(12064, 1, Position(32736, 32117, 10))
			local teleport = Game.createItem(1397, 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(26478,26479)
forgottenKnowledgePlant:register()