-- Script PTHT ADVANCE made by @arcssss.
on Discord
-- WORLD SETTINGS --
local WORLD_NAME = "2XD"
-- MAG SETTINGS --
local BACKGROUND_ID = 1158
local TAKE_REMOTE = "left"
--TREE AND PLATFORM SETTING--
local MAX_TREE = 18000
local TREE_ID = 14853
local PLATFORM_ID = 0
--MAIN SETTING--
local MAIN_ACCOUNT = true
local USE_MRAY = true
local MODE_TYPE = "zigzag"
local MODE_START = "ptht"
--PTHT SETTING--
local COUNT_PTHT = 99
local POS_X = 0
local POS_Y = 180
local TOTAL_CHECK = 1
--GENERAL SETTING--
local ANTI_LAG = false
local TP_PLACE = true
--LOGGING SETTING--
local SAVE_LOG_PTHT = true
local NAME_LOG_PTHT = "Log PTHT.txt"
-- DELAY SETTINGS --
local DELAY_RECONNECT = 50
local DELAY_PLANT = 7.5
local DELAY_UWS = 50
local DELAY_HARVEST = 30
-- SENSITIVE PARTS. PLEASE DO NOT CHANGE --
function sendRaw(v, w, x, y, z)
SendPacketRaw(false, {
type = v, state = w, value = x, px = y, py = z, x = y * 32, y = z * 32,
xspeed = 700, yspeed = -700
})
end
function sendLog(x)
return LogToConsole("`w[`bRoutes`w] " .. x)
end
function sendBubbleTalk(x)
sendLog(x)
SendVariant({
v0 = "OnTalkBubble",
v1 = GetLocal().netID,
v2 = "[`bRoutes`w] " .. x
})
end
function sendText(z)
return SendPacket(2, "action|input\ntext|" .. z)
end
function tpPlace(z)
i = {"Tp Place", "ModFly"}
for _, i in pairs(i) do
EditToggle(i, z)
end
end
plantX, plantY = POS_X, POS_Y
function checkPlatform()
totalPlatform = 0
for y = plantY + 1, (plantY + 1) % 2 == 0 and 0 or 1, -2 do
for x = plantX, 199, 1 do
if (GetTile(x, y).fg ~= PLATFORM_ID) and (GetTile(x, y).fg ~= 0) then
totalPlatform = totalPlatform + 1
end
end
end
return totalPlatform
end
function checkTree()
totalTree = 0
for y = plantY, plantY % 2 == 0 and 0 or 1, -2 do
for x = plantX, 199, 1 do
if (modePlant and GetTile(x, y).fg == TREE_ID) or (modeHarvest and
GetTile(x, y).fg == TREE_ID and GetTile(x, y).readyharvest) then
totalTree = totalTree + 1
end
end
end
return totalTree
end
modeTake = TAKE_REMOTE:lower()
function checkMagplant()
local getMagplant = {}
for x = (modeTake == "left" and 0 or 199), (modeTake == "left" and 199 or 0),
(modeTake == "left" and 1 or -1) do
for y = 199, 0, -1 do
if GetTile(x, y).fg == 5638 and GetTile(x, y).bg == BACKGROUND_ID then
table.insert(getMagplant, {x, y})
end
end
end
return getMagplant
end
usedUWS = 0
function usingUWS()
usedUWS = usedUWS + 1
sendText("`wTotal UWS Used : `2" .. usedUWS)
SendPacket(2, "action|dialog_return\ndialog_name|ultraworldspray")
Sleep(DELAY_UWS * 10 ^ 2)
end
getMagplant, currentMagplant = checkMagplant(), 1
function changeMode()
if modePlant then
if checkPlatform() <= checkTree() or checkTree() >= MAX_TREE then
modePlant = false
usingUWS()
sendText("`wChanging Into `9Mode Harvest")
modeHarvest, directionY = true, true
else
missCheck = true
sendText("`wRe-Planting On Empty Tiles")
end
elseif modeHarvest then
if checkPlatform() > checkTree() or checkPlatform() > MAX_TREE then
modeHarvest = false
sendText("`wChanging Into `9Mode Plant")
modePlant = true
else
sendText("`wRe-Harvesting `wOn Missed Tree")
end
end
end
changeMagplant, emptyLimit = true, 0
function takeRemote(x, y)
sendRaw(0, 32, 0, x, y)
Sleep(5 * 10 ^ 2)
sendRaw(3, 0, 32, x, y)
Sleep(5 * 10 ^ 2)
SendPacket(2, "action|dialog_return\ndialog_name|magplant_edit\nx|" .. x .. "|\
ny|" .. y .. "|\nbuttonClicked|getRemote")
Sleep(5 * 10 ^ 3)
end
mainAcc, modeType = MAIN_ACCOUNT, MODE_TYPE:lower()
function getRotation(x, y)
if ((modePlant and GetTile(x, y).fg ~= TREE_ID) or (modeHarvest and GetTile(x,
y).fg == TREE_ID and GetTile(x, y).readyharvest)) then
sendRaw(0, 0, 0, x, y)
sendRaw(3, (MAIN_ACCOUNT and 32 or 48), (modePlant and 5640 or 18), x, y)
Sleep(modePlant and DELAY_PLANT * 10 or DELAY_HARVEST * 10)
if GetWorldName() ~= currentWorld or changeMagplant then
return
elseif GetWorldName() == currentWorld and not changeMagplant then
getTile = GetTile(x, directionY and math.min(y + 4, plantY) or
math.max(y - 4, plantX))
if (modePlant and getTile.fg ~= TREE_ID) then
emptyLimit = emptyLimit + 1
else
if (modePlant and getTile.fg == TREE_ID) and emptyLimit <= 70 then
emptyLimit = 0
end
end
end
if emptyLimit > 250 then
currentMagplant = currentMagplant + 1
if currentMagplant > #getMagplant then
currentMagplant = 1
end
changeMagplant = true
emptyLimit = 0
return
end
end
end
directionY, fullRotation = true, 0
function startPTHT()
--startX, endX, stepX = mainAcc and plantX or (modePlant and 190 or plantX),
mainAcc and (modePlant and 199 or 10) or plantX, (mainAcc and (USE_MRAY and 10 or
1) or (USE_MRAY and - 10 or - 1))
if mainAcc then
startX, endX, stepX = plantX, (modePlant and 199 or 10), (USE_MRAY and 10
or 1)
else
startX, endX, stepX = (modePlant and 190 or plantX), plantX, -(USE_MRAY and
10 or 1)
end
if modeType == "vertical" then
for x = startX, endX, stepX do
if GetWorldName() ~= currentWorld or changeMagplant then
return
else
for i = 1, 2, 1 do
for y = plantY, plantY % 2 == 0 and 0 or 1, -2 do
if GetWorldName() ~= currentWorld or changeMagplant then
return
else
sendLog("You are `9" .. (modePlant and "Planting" or
"Harvesting") .. " `wOn Line `1X : `3" .. x .. " `1Y : `3" .. y .. " `b[Empty :
" .. emptyLimit .." / 250]")
getRotation(x, y)
end
end
end
end
end
elseif modeType == "zigzag" then
for x = startX, endX, stepX do
if GetWorldName() ~= currentWorld or changeMagplant then
return
else
if directionY then
for i = 1, 1, 1 do
for y = plantY, 0, -2 do
if GetWorldName() ~= currentWorld or changeMagplant
then
return
else
sendLog("You are `9" .. (modePlant and "Planting"
or "Harvesting") .. " `wOn Line `1X : `3" .. x .. " `1Y : `3" .. y .. " `2[" ..
(directionY and "UP" or "DOWN") .. "] `b[Empty : " .. emptyLimit .. " / 250]")
getRotation(x, y)
end
end
end
directionY = false
else
for i = 1, 1, 1 do
for y = 0, plantY, 2 do
if GetWorldName() ~= currentWorld or changeMagplant
then
return
else
sendLog("You are `9" .. (modePlant and "Planting"
or "Harvesting") .. " `wOn Line `1X : `3" .. x .. " `1Y : `3" .. y .. " `2[" ..
(directionY and "UP" or "DOWN") .. "] `b[Empty : " .. emptyLimit .. " / 250]")
getRotation(x, y)
end
end
end
directionY = true
end
end
end
end
if GetWorldName() ~= currentWorld then
return
else
missCheck = false
if modeChange then
changeMode()
if not missCheck then
fullRotation = fullRotation + 1
end
Sleep(1 * 10 ^ 3)
if fullRotation % 2 == 0 then
currentTime = os.time()
finishTime = currentTime - startTime
finishRotation = true
if SAVE_LOG_PTHT then
local logFile =
io.open("storage/emulated/0/Android/data/launcher.powerkuy/ScriptLua/" ..
NAME_LOG_PTHT, "a")
logRotation = {}
table.insert(logRotation, "Completed " .. (fullRotation //
2) .. " PTHT in " .. os.date("!%M:%S", finishTime) .. " Minutes at " ..
os.date("%H:%M:%S") .. " Total UWS Used : " .. usedUWS)
if logFile then
for _, i in pairs(logRotation) do
logFile:write(i .. "\n")
logFile:close()
end
end
end
end
else
fullRotation = fullRotation + 2
if modePlant then
SendPacket(2, "action|dialog_return\ndialog_name|ultraworldspray")
Sleep(3 * 10 ^ 3)
end
Sleep(5 * 10 ^ 2)
sendText("`2Done, `wYou have finished `9" .. (modePlant and "Planting"
or "Harvesting") .. " `wall the trees")
end
end
end
currentWorld = WORLD_NAME:lower() == "" and GetWorldName() or WORLD_NAME:upper()
function getReconnect()
if GetWorldName() ~= currentWorld then
sendLog("`wWarping Back Into `2" .. currentWorld)
SendPacket(3, "action|join_request\nname|" .. currentWorld .. "|\
ninvitedWorld|0")
Sleep(DELAY_RECONNECT * 10 ^ 2)
changeMagplant = true
else
if changeMagplant then
tpPlace(false)
Sleep(1 * 10 ^ 3)
sendText("`wCurrently Getting a `2Magplant Remote")
takeRemote(getMagplant[currentMagplant][1],
getMagplant[currentMagplant][2])
tpPlace(TP_PLACE and true or false)
changeMagplant = false
end
startPTHT()
end
end
modeStart, Loop = MODE_START:lower(), COUNT_PTHT
if modeStart == "ptht" then
modeChange, modePlant, modeHarvest = true, true, false
elseif modeStart == "htpt" then
modeChange, modePlant, modeHarvest = true, false, true
elseif modeStart == "pt" then
modeChange, modePlant, modeHarvest = false, true, false
elseif modeStart == "ht" then
modeChange, modePlant, modeHarvest = false, false, true
end
SendPacket(2, "action|dialog_return\ndialog_name|cheats\ncheck_gems|1\
ncheck_ignoreo|1\ncheck_lonely|1")
Sleep(3 * 10^3)
sendBubbleTalk("`2Starting " .. MODE_START:upper() .. " " .. modeType:upper() .. ".
with a total " .. Loop .. "x " .. MODE_START:upper())
Sleep(3 * 10^3)
tpPlace(false)
if ANTI_LAG then
antiLag = {"Anti Lag", "Invisible V1"}
for _, i in pairs(antiLag) do
EditToggle(i, true)
end
end
startTime = os.time()
if GetLocal().userID ~= 281500 then -- Change The UserID
LogToConsole("Ah Fuck You")
os.exit()
else
if Loop == "unlimited" then
while true do
if fullRotation % 2 == 0 and not finishRotation and not missCheck and not
changeMagplant then
startTime = os.time()
end
getReconnect()
end
end
if type(Loop) == "number" then
repeat
if fullRotation % 2 == 0 and not finishRotation and not missCheck and not
changeMagplant then
startTime = os.time()
end
getReconnect()
Sleep(2 * 10 ^ 3)
if fullRotation % 2 == 0 and fullRotation // 2 ~= 0 and finishRotation then
sendText("`w[ `2Completed " .. MODE_START:upper() .. " `w][ Total Time " ..
os.date("!%M:%S", finishTime) .. " Minutes `w]")
Sleep(1 * 10 ^ 3)
sendText("`w[ `2Completed " .. MODE_START:upper() .. " `w][ Rotation :
`w" .. fullRotation // 2 .. " `w/ `4" .. Loop .. " `w]")
Sleep(1 * 10 ^ 3)
sendText("`w[ `2Completed " .. MODE_START:upper() .. " `w][ Remaining : `4"
.. Loop - fullRotation // 2 .. " `w]")
Sleep(1 * 10 ^ 3)
finishRotation = false
end
until fullRotation // 2 == Loop
sendText("`w[ (nuke) `2FINISHED " .. MODE_START:upper() .. " `w][ TOTAL " ..
fullRotation // 2 .. " `w(nuke) ]")
end
tpPlace(false)
end