Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ADD ITEMS TO LOOT LIST BELOW, BE SURE TO SEPARATE EACH ITEM WITH A COMMA ]]--
- --[[ VALID INPUT IS ID OR {ID, CONTAINER} ]]--
- local itemList = {
- 3031,
- {3577, 0}
- }
- --[[ DO NOT EDIT BELOW ]]--
- function getOpenBackpacks()
- local count = 0
- local bp = Container:GetFirst()
- while bp:isOpen() do
- count = count + 1
- bp = bp:GetNext()
- end
- return count
- end
- function watchTarget()
- local Target = Creature.GetByID(Self.TargetID())
- local pos = {}
- if Target:isAlive() then
- while Target:isAlive() do
- pos = Target:Position()
- sleep(50)
- end
- return pos
- end
- end
- function openCorpse(position, bpcount)
- local tries, corpseID = 0
- repeat
- corpseID = Self.UseItemFromGround(position.x, position.y, position.z)
- wait(1000, 1200)
- local Corpse = Container.GetFromIndex(bpcount)
- tries = tries + 1
- until Corpse:isOpen() or tries == 5
- if(corpseID == 9582 or corpseID == 4037)then
- print("Looting water elemental...")
- wait(2000)
- local used = fishWaterElemental(position)
- wait(2000)
- print("Tried to fish itemid: " .. used)
- end
- return tonumber(corpseID)
- end
- function lootItems(items, bpcount)
- local Corpse = Container.GetFromIndex(bpcount - 1)
- for x = 1, #items do
- for y = 0, Corpse:ItemCount() do
- local item = Corpse:GetItemData(y)
- if(type(items[x]) == "table")then
- if(item.id == items[x][1])then
- Corpse:MoveItemToContainer(y, items[x][2], 0)
- wait(500, 1000)
- lootItems(items, bpcount)
- end
- elseif(item.id == items[x])then
- Corpse:MoveItemToContainer(y, 0, 0)
- wait(500, 1000)
- lootItems(items, bpcount)
- end
- end
- end
- end
- function fishWaterElemental(position)
- local cont = Container.GetFirst()
- while (cont:isOpen()) do
- for spot = 0, cont:ItemCount() do
- local item = cont:GetItemData(spot)
- if(item.id == 3483)then
- local corpse = cont:UseItemWithGround(spot, position.x, position.y, position.z)
- wait(2000,2200)
- return corpse
- end
- end
- cont = cont:GetNext()
- end
- return false
- end
- while true do
- local position = watchTarget()
- if position ~= nil then
- setBotEnabled(false)
- local corpseID = openCorpse(position, getOpenBackpacks())
- if(corpseID > 0)then
- lootItems(itemList, getOpenBackpacks())
- print("Corpse ID: " ..corpseID)
- end
- setTargetingEnabled(true)
- setWalkerEnabled(true)
- end
- sleep(50)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement