Af PNB Gentaa - Lua

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

breakID = 4584

delayPlace, delayPunch = 180, 180


autoCollect = false
autoDrop = false
customTile = 5
tilesC = {{1, 0}}

--Don't Touch!!
tilesArr = {}
ex = math.floor(getLocal().pos.x / 32)
ye = math.floor(getLocal().pos.y / 32)
tilesCC = {}
seedID = breakID + 1

function collect(obj)
sendPacketRaw(
false,
{
type = 11,
value = obj.oid,
x = obj.pos.x,
y = obj.pos.y
}
)
end

function inv(id)
for _, item in pairs(getInventory()) do
if (item.id == id) then
return item.amount
end
end
return 0
end

function drop(id, count)


sendPacket(2, "action|drop\n|itemID|" .. id)
sleep(200)
sendPacket(2, "action|dialog_return\ndialog_name|drop_item\nitemID|" .. id ..
"|\ncount|" .. count)
end

function Collect()
mainpos = getLocal().pos
objects = getWorldObject()
for b = 1, #tilesCC do
for _, v in pairs(objects) do
if
(v.pos.x + 9) // 32 == ((mainpos.x + 10) // 32 + tilesCC[b][1]) and
(v.pos.y + 9) // 32 == ((mainpos.y + 15) // 32 + tilesCC[b][2])
then
collect(v)
sleep(10)
end
end
end
end

function place(id, x, y)
sendPacketRaw(
false,
{
x = getLocal().pos.x,
y = getLocal().pos.y,
tilex = math.floor(getLocal().pos.x / 32 + x),
tiley = math.floor(getLocal().pos.y / 32 + y),
type = 3,
value = id
}
)
end

function punch(x, y)
sendPacketRaw(
false,
{
x = getLocal().pos.x,
y = getLocal().pos.y,
tilex = math.floor(getLocal().pos.x / 32 + x),
tiley = math.floor(getLocal().pos.y / 32 + y),
type = 3,
value = 18
}
)
end

for i = math.floor(customTile / 2), 1, -1 do


i = i * -1
table.insert(tilesArr, i)
table.insert(tilesCC, {i, -1})
end

for i = 0, math.ceil(customTile / 2) - 1 do
table.insert(tilesArr, i)
table.insert(tilesCC, {i, -1})
end

for s = 1, #tilesC do
table.insert(tilesCC, {tilesC[s][1], tilesC[s][2]})
end

function tilesPunch(x, y)
for _, Numm in pairs(tilesArr) do
if checkTile(x + Numm, y - 1).fg ~= 0 or checkTile(x + Numm, y - 1).bg ~= 0
then
return true
end
end
return false
end

function tilesPlace(x, y)
for _, Numm in pairs(tilesArr) do
if checkTile(x + Numm, y - 1).fg == 0 and checkTile(x + Numm, y - 1).bg ==
0 then
return true
end
end
return false
end

while true do
logToConsole("`0Script running, Enjoy autofarming (love) ")
while tilesPlace(ex, ye) do
for _, i in pairs(tilesArr) do
if checkTile(ex + i, ye - 1).fg == 0 and checkTile(ex + i, ye - 1).bg
== 0 then
place(breakID, i, -1)
sleep(delayPlace)
end
end
end
while tilesPunch(ex, ye) do
for _, i in pairs(tilesArr) do
if checkTile(ex + i, ye - 1).fg ~= 0 or checkTile(ex + i, ye - 1).bg ~=
0 then
punch(i, -1)
sleep(delayPunch)
end
end
end
if autoCollect then
Collect()
end
if autoDrop then
if inv(seedID) >= 100 then
drop(seedID, 100)
sleep(200)
end
end
end

You might also like