MagBG = 568
World = "UZA"
PnbX, PnbY = 1, 186
function rw(t, s, id, x, y)
SendPacketRaw(false, { type = t, state = s, value = id, px = x, py = y, x = x
* 32, y = y * 32 })
end
Magplants = {}
function GetMagplants()
local function GetStocksHook(v)
if v[0] == "OnDialogRequest" and v[1]:find("magplant_edit") then
local x = tonumber(v[1]:match("embed_data|x|(%d+)"))
local y = tonumber(v[1]:match("embed_data|y|(%d+)"))
local stock = tonumber(v[1]:match("Stock: `$(%d+)``"))
if v[1]:find("Stock: `4EMPTY!``") then
stock = 0
end
local has_stock = stock and stock > 0 or false
print(x, y, stock, has_stock)
table.insert(Magplants, {
x = x,
y = y,
stock = stock,
has_stock = has_stock,
})
return true
end
end
AddHook("onvariant", "GetStocksHook", GetStocksHook)
for x = 0, math.floor(GetWorld().width - 1) do
for y = 0, math.floor(GetWorld().height - 1) do
local t = GetTile(x, y)
if t.bg == MagBG and t.fg == 5638 then
rw(nil, nil, nil, x, y)
rw(3, nil, 32, x, y)
Sleep(150)
end
end
end
Sleep(1000)
RemoveHook("GetStocksHook")
end
function StartPNB()
local arroz = false
local songpyeon = false
local cheat = false
local autobfg = false
local MagHabis = false
local function Use(id, x, y)
rw(3, nil, id, x, y)
end
local function CheckPlayer()
SendPacket(2, "action|wrench\n|netid|" .. GetLocal().netid)
end
local function CheckAll()
if not arroz then
Use(4604, PnbX, PnbY)
Sleep(100)
songpyeon = true
elseif not songpyeon then
Use(1056, PnbX, PnbY)
Sleep(100)
songpyeon = true
elseif not cheat then
SendPacket(2, "action|dialog_return\ndialog_name|buycheat")
Sleep(100)
cheat = true
end
end
local function HidePopUp(v)
if v[0] == "OnDialogRequest" and v[1]:find("`bCreative Cheat Menu````")
then
return true
end
if v[0] == "OnDialogRequest" and v[1]:find("magplant_edit") then
return true
end
if v[0] == "OnDialogRequest" and v[1]:find("add_player_info") then
arroz = v[1]:find("|4604|")
songpyeon = v[1]:find("|528|")
cheat = v[1]:find("|16086|")
autobfg = v[1]:find("Cheat Active: Autofarm")
return true
end
if v[0] == "OnTalkBubble" and v[2]:find("The MAGPLANT 5000 is empty") then
if not MagHabis then
MagHabis = true
end
return true
end
end
local function isDisconnected()
if GetClient().ping == 999 and GetWorld() == nil then
return true
end
return false
end
local function GetRemote(x, y)
SendPacket(
2,
"action|dialog_return\ndialog_name|magplant_edit\nx|" .. x .. "|\
ny|" .. y .. "|\nbuttonClicked|getRemote"
)
end
local function CheatMenu()
if autobfg then
SendPacket(2, "action|dialog_return\ndialog_name|cheats\
ncheck_autofarm|0\ncheck_bfg|0\ncheck_gems|1")
else
SendPacket(2, "action|dialog_return\ndialog_name|cheats\
ncheck_autofarm|1\ncheck_bfg|1\ncheck_gems|1")
end
end
Magplants = {}
LogToConsole("`2[INFO] `oScanning magplants...")
GetMagplants()
Sleep(5000)
stockedMagplants = {}
for _, mag in pairs(Magplants) do
if mag.has_stock then
table.insert(stockedMagplants, mag)
end
end
if #stockedMagplants == 0 then
LogToConsole("`4[ERROR] `cTidak ada magplant dengan stok yang
ditemukan. Skrip dihentikan.")
return
end
AddHook("onvariant", "HidePopUp", HidePopUp)
local currentIndex = #stockedMagplants
while currentIndex > 0 do
local currentMag = stockedMagplants[currentIndex]
local function ConfigurePNB()
MagHabis = false
FindPath(PnbX, PnbY)
Sleep(1000)
rw(nil, nil, nil, currentMag.x, currentMag.y)
Sleep(200)
rw(3, nil, 32, currentMag.x, currentMag.y)
Sleep(1000)
GetRemote(currentMag.x, currentMag.y)
Sleep(1000)
rw(nil, nil, nil, PnbX, PnbY)
Sleep(1000)
CheckPlayer()
Sleep(550)
CheckAll()
Sleep(550)
CheatMenu()
end
ConfigurePNB()
LogToConsole("`2[INFO] `oMulai farming di magplant saat ini hingga stok
habis...")
while not MagHabis do
if isDisconnected() then
Sleep(30000)
if GetWorld() == nil then
RequestJoinWorld(World)
Sleep(5000)
ConfigurePNB()
Sleep(200)
elseif GetWorld ~= nil then
Sleep(5000)
ConfigurePNB()
Sleep(200)
end
else
CheckPlayer()
Sleep(250)
CheckAll()
Sleep(250)
end
end
CheckPlayer()
CheatMenu()
currentIndex = currentIndex - 1
if currentIndex > 0 then
LogToConsole("`2[INFO] `oPindah ke magplant selanjutnya...")
else
LogToConsole("`2[INFO] `oSemua magplant telah habis. Proses
farming selesai.")
end
Sleep(2000)
end
end
StartPNB()
RemoveHooks()