Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Lootmacro by everest
- -- Version: 0.005
- -- Release date: 19/06/2018
- -- If the stuff will be looted to custom bag or your main backpack
- local lootToCustomBag = true
- -- If loot is set to false, it will print the result out instead as a sysmessage
- -- Will "magic" items be looted
- local lootMagic = false
- -- Will custom items be looted
- local lootCustom = true
- -- Will custom by name be looted
- local lootCustomByName = true
- -- Always cut corpse before looting
- local cutCorpse = false
- -- Settings "magic" itemtypes, add item types you'd like to be check
- -- if they have word "magic" in them
- lootedCorpses= {}
- itemTypes = {}
- itemTypes["magic"] = {5398,5434,5903,5422,
- 5399,7933,7939,7935,
- 8095,7937,5435,5431,
- 5397,8189,5437,8097,
- 5441,8059,9919,3997,
- 5091,3780}
- -- Loot type settings, just add itemtypes you'd like to be looted
- -- 3821 gold
- -- 3965 blood vials
- -- 3968 daemon bones
- -- 3977 obsidian
- -- 3982 serpent scales
- -- 3964 blood spawns
- -- etc,etc
- itemTypes["custom"] = {3821,3965,3968,3977,
- 3982,3964,2545}
- -- Loot if name matches, add part of item name like "onyx"
- itemTypes["customByName"] = {"Minotaur Bones",
- "Phoenix Bones",
- "Thunderbird Bones",
- "Frostwing Bones",
- "Giant Bones"}
- -- Exclude that customByName item if it has this keyword in it
- itemTypes["exclude"] = {"Poison",
- "Electric"}
- -- Macro, do not touch if you don't know what you're doing
- -- Macro, do not touch if you don't know what you're doing
- -- Macro, do not touch if you don't know what you're doing
- function WaitFor(query, timeout)
- timeout = getticks() + timeout
- while dostring("return "..query) == false do
- wait(100)
- if getticks() >= timeout then
- printf("WaitFor: '%s' timed out (%d)", query, timeout)
- return true
- end
- end
- end
- function WaitForTarget(timeout)
- WaitFor("not UO.TargCurs", timeout or 10000)
- end
- function Target(msg)
- if msg ~= nil then
- UO.SysMessage(msg)
- end
- UO.TargCurs = true
- WaitForTarget()
- end
- function randomWait()
- return math.random(800,1200)
- end
- local lootBag = UO.BackpackID
- if lootToCustomBag then
- Target("Target lootbag!")
- lootBag = UO.LTargetID
- end
- function loot(nID, nStack)
- UO.Drag(nID, nStack)
- wait(randomWait())
- UO.DropC(lootBag)
- wait(10)
- end
- function scanThroughContainer(contID)
- if cutCorpse then
- UO.LTargetID = contID
- UO.Macro(1,0,".use dagger")
- WaitFor("UO.TargCurs", 3000)
- UO.Macro(22,0)
- wait(300)
- end
- local containerID = contID
- local nCount = UO.ScanItems(true)
- for i=1,nCount do
- local nID,nType,nKind,nContID,nX,nY,nZ,nStack,nRep,nCol = UO.GetItem(i)
- if nContID == containerID then
- -- let's check if corpse contains cloth types
- for i=0,#itemTypes["magic"] do
- if nType == itemTypes["magic"][i] then
- -- we have type match, now let's check if it's magic
- local name, info = UO.Property(nID)
- if string.match(name, "Magic") then
- -- it's magical
- if lootMagic then
- loot(nID, nStack)
- else
- UO.SysMessage("Found: "..name)
- end
- end
- end
- end
- -- let's check custom item types
- for i=1,#itemTypes["custom"] do
- if nType == itemTypes["custom"][i] then
- -- we have a custom item match
- if lootCustom then
- loot(nID, nStack)
- else
- local name, info = UO.Property(nID)
- UO.SysMessage("Found: "..name)
- end
- end
- end
- if #itemTypes["customByName"] > 0 then
- for i=1,#itemTypes["customByName"] do
- local name, info = UO.Property(nID)
- if string.match(name, itemTypes["customByName"][i]) then
- -- we have name match
- -- check for excludes
- local excludeThis = false
- for j=1, #itemTypes["exclude"] do
- if string.match(name, itemTypes["exclude"][j]) then
- excludeThis = true
- break
- end
- end
- if lootCustomByName and excludeThis == false then
- loot(nID, nStack)
- else
- local name, info = UO.Property(nID)
- UO.SysMessage("Found: "..name)
- end
- end
- end
- end
- end
- end
- table.insert(lootedCorpses, contID)
- UO.SysMessage("Looting done!")
- end
- while true do
- local alreadyLooted = false
- if UO.ContType == 8198 and UO.ContSizeX == 144 and UO.ContSizeY == 212 and UO.ContName == "container gump" then
- local cID = UO.ContID
- for i=1,#lootedCorpses do
- if cID == lootedCorpses[i] then
- alreadyLooted = true
- end
- end
- if alreadyLooted == false then
- scanThroughContainer(cID)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement