Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stash, cube, belt, inventory = {}, {}, {}, {}
- --[[ Cube Functions ]]--
- cube.Cows = function()
- Log(2, "Containers", "cube.Cows : Started", true)
- local tbk, leg
- Act1()
- tbk = Ao.me.inventory:findByCode('tbk')
- leg = Ao.me.inventory:findByCode('leg')
- TownMove.ToObject('Bank')
- stash.Open()
- cube.ItemToCube(leg[0])
- for i = 0, tbk:size() - 1 do
- if Settings.Lock.Inventory[(tonumber(tbk[i].y..(tbk[i].x+1)))] == 0 then
- cube.ItemToCube(tbk[i])
- break
- end
- end
- cube.Open()
- cube.Transmute()
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "cube.Cows : Ended", true)
- end
- cube.Craft = function()
- -- Hit Power : Sapphire
- -- Helm : Full Helm / Basinet / Giant Conch (Ith)
- -- Boots : Chain / Mesh / Boneweave (Ral)
- -- Gloves : Chain Gloves / Heavy Bracers / Vambraces (Ort)
- -- Belt : Heavy / Battle / Troll (Tal)
- -- Shield : Gothic / Ancient / Ward (Eth)
- -- Body : Field Plate / Sharktooth / Kraken Shell (Nef)
- -- Amulet : (Thul)
- -- Ring : (Amn)
- -- Weapon : Any Blunt (Tir)
- -- Blood : Ruby
- -- Helm : Helm / Casque / Armet (Ral)
- -- Boots : Light Plated / Battle / Mirrored (Eth)
- -- Gloves : Heavy / Sharkskin / Vampirebone (Nef)
- -- Belt : Belt / Mesh / Mithril Coil (Tal)
- -- Shield : Spiked / Barbed / Blade Barrier (Ith)
- -- Body : Plate Mail / Templar Coat / Hellforge Plate (Thul)
- -- Amulet : (Amn)
- -- Ring : (Sol)
- -- Weapon : Any Axe (Ort)
- -- Caster : Amethyst
- -- Helm : Mask / Death Mask / Demonhead Mask (Nef)
- -- Boots : Boots / Demonhide / Wyrmhide (Thul)
- -- Gloves : Leather / Demonhide / Bramble (Ort)
- -- Belt : Light / Sharkskin / Vampirefang (Ith)
- -- Shield : Small / Round / Luna (Eth)
- -- Body : Light Plate / Mage Plate / Archon Plate (Tal)
- -- Amulet : (Ral)
- -- Ring : (Amn)
- -- Weapon : Any Rod (Scepter, Wand, Staff) (Tir)
- -- Safety (Emerald)
- -- Helm : Crown / Grand Crown / Corona (Ith)
- -- Boots : Greaves / War Boots / Myrmidon Boots (Ort)
- -- Gloves : Gauntlers / War Gauntlets / Ogre Gauntlets (Ral)
- -- Belt : Sash / Demonhide Sash / Spiderweb Sash (Tal)
- -- Shield : Kite / Dragon / Monarch (Nef)
- -- Body : Breast Plate / Cuirass / Great Hauberk (Eth)
- -- Amulet : (Thul)
- -- Ring : (Amn)
- -- Weapon : Spear or Javelin (Sol)
- end
- cube.Keys = function()
- Log(2, "Containers", "cube.Keys Started", true)
- local t = os.time(sec)
- local tkey = Ao.me.stash:findByCode("pk1")
- local hkey = Ao.me.stash:findByCode("pk2")
- local dkey = Ao.me.stash:findByCode("pk3")
- if tkey:size() > 0 and hkey:size() > 0 and dkey:size() > 0 then
- stash.Open()
- cube.ItemToCube(tkey[0])
- cube.ItemToCube(hkey[0])
- cube.ItemToCube(dkey[0])
- cube.Open()
- cube.Transmute()
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- else
- Log(2, "Containers", "cube.Keys : Not enough keys. T = "..tkey:size()..", H = "..hkey:size()..", D = "..dkey:size(), true)
- return false
- end
- Log(1, "Containers", "cube.Keys: t= "..os.time(sec) - t)
- Log(2, "Containers", "cube.Keys Done", true)
- t = nil
- return true
- end
- cube.Organs = function()
- Log(2, "Containers", "cube.Organs Started", true)
- local t = os.time(sec)
- local horn = Ao.me.stash:findByCode("dhn")
- local eye = Ao.me.stash:findByCode("bey")
- local brain = Ao.me.stash:findByCode("mbr")
- if horn:size() > 0 and eye:size() > 0 and brain:size() > 0 then
- stash.Open()
- cube.ItemToCube(horn[0])
- cube.ItemToCube(eye[0])
- cube.ItemToCube(brain[0])
- cube.Open()
- cube.Transmute()
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- else
- Log(2, "Containers", "cube.Organs: Not enough Organs. Horn = "..horn:size().." Eye = "..eye:size().." Brain = "..brain:size())
- return false
- end
- Log(1, "Containers", "cube.Organs: t= "..os.time(sec) - t)
- Log(2, "Containers", "cube.Organs Done", true)
- t = nil
- end
- cube.Essences = function()
- Log(2, "Containers", "cube.Essences Started", true)
- local t = os.time(sec)
- local inCube = {}
- local suffering = Ao.me.stash:findByCode("tes") -- Andy / Duriel
- local hatred = Ao.me.stash:findByCode("ceh") -- meph
- local terror = Ao.me.stash:findByCode("bet") -- diablo
- local destruction = Ao.me.stash:findByCode("fed") -- baal
- repeat
- if suffering:size() > 0 and hatred:size() > 0 and terror:size() > 0 and destruction:size() > 0 then
- stash.Open()
- cube.ItemToCube(suffering[0])
- cube.ItemToCube(hatred[0])
- cube.ItemToCube(terror[0])
- cube.ItemToCube(destruction[0])
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Essences failed!") return false end
- cube.ItemToStash(inCube[0])
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Cubed Token of Absolution", true)
- end
- suffering = Ao.me.stash:findByCode("tes")
- hatred = Ao.me.stash:findByCode("ceh")
- terror = Ao.me.stash:findByCode("bet")
- destruction = Ao.me.stash:findByCode("fed")
- until suffering:size() < 1 or hatred:size() < 1 or terror:size() < 1 or destruction:size() < 1
- Log(1, "Containers", "cube.Essences: t= "..os.time(sec) - t)
- Log(2, "Containers", "cube.Essences Done", true)
- t = nil
- end
- cube.Gems = function()
- Log(2, "Containers", "cube.Gems Started", true)
- local t = os.time(sec)
- local gems, inCube
- Log(1, "Containers", "Cubing Chipped Gems")
- for types = 1, #Settings.Craft.Flawed do --This will search through Settings.CubeChippedGems (or not if no values), this applies to runes as well
- gems = Ao.me.stash:findByCode(CHIPPED[Settings.Craft.Flawed[types]]) --This is now entered by type which is referenced in Globals.lua, this applies to runes as well
- while (gems and gems:size() >= 3) do
- stash.Open()
- for count = 0, 2 do cube.ItemToCube(gems[count]) end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Gems failed!") return false end
- cube.ItemToStash(inCube[0])
- gems = Ao.me.stash:findByCode(CHIPPED[Settings.Craft.Flawed[types]])
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Cubed Chipped "..Settings.Craft.Flawed[types], true)
- end
- end
- Log(1, "Containers", "Cubing Flawed Gems")
- for types = 1, #Settings.Craft.Normal do
- gems = Ao.me.stash:findByCode(FLAWED[Settings.Craft.Normal[types]])
- while (gems and gems:size() >= 3) do
- stash.Open()
- for count = 0, 2 do cube.ItemToCube(gems[count]) end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Gems failed!") return false end
- cube.ItemToStash(inCube[0])
- gems = Ao.me.stash:findByCode(FLAWED[Settings.Craft.Normal[types]])
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Cubed Flawed "..Settings.Craft.Normal[types], true)
- end
- end
- Log(1, "Containers", "Cubing Normal Gems")
- for types = 1, #Settings.Craft.Flawless do
- gems = Ao.me.stash:findByCode(NORMAL[Settings.Craft.Flawless[types]])
- while (gems and gems:size() >= 3) do
- stash.Open()
- for count = 0, 2 do cube.ItemToCube(gems[count]) end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Gems failed!") return false end
- cube.ItemToStash(inCube[0])
- gems = Ao.me.stash:findByCode(NORMAL[Settings.Craft.Flawless[types]])
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Cubed Normal "..Settings.Craft.Flawless[types], true)
- end
- end
- Log(1, "Containers", "Cubing Flawless Gems")
- for types = 1, #Settings.Craft.Perfect do
- gems = Ao.me.stash:findByCode(FLAWLESS[Settings.Craft.Perfect[types]])
- while (gems and gems:size() >= 3) do
- stash.Open()
- for count = 0, 2 do cube.ItemToCube(gems[count]) end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Gems failed!") return false end
- cube.ItemToStash(inCube[0])
- gems = Ao.me.stash:findByCode(FLAWLESS[Settings.Craft.Perfect[types]])
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Cubed Flawless "..Settings.Craft.Perfect[types], true)
- end
- end
- Log(2, "Containers", "cube.Gems Done", true)
- Log(1, "Containers", "cube.Gems: t= "..os.time(sec) - t)
- t = nil
- end
- cube.Runes = function()
- Log(2, "Containers", "cube.Runes Started", true)
- local t = os.time(sec)
- local rune, gem, countRune, inCube = 0, 0, 0, 0
- for getRune = 1, #Settings.Craft.Rune do
- rune = RUNES[Settings.Craft.Rune[getRune]] - 1
- if rune <= 9 then
- countRune = Ao.me.stash:findByCode("r0"..rune)
- while (countRune and countRune:size() >= 3) do
- stash.Open()
- for count = 0, 2 do cube.ItemToCube(countRune[count]) end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Runes failed!") return false end
- cube.ItemToStash(inCube[0])
- countRune = Ao.me.stash:findByCode("r0"..rune)
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Cubing", "Made "..Settings.Craft.Rune[getRune], true)
- end
- end
- if rune > 9 and rune < 21 then
- gem = Ao.me.stash:findByCode(FORMULA[rune])
- countRune = Ao.me.stash:findByCode("r"..rune)
- while (countRune and gem and countRune:size() >= 3 and gem:size() >= 1) do
- stash.Open()
- for count = 0, 2 do
- cube.ItemToCube(countRune[count])
- if count == 0 then cube.ItemToCube(gem[count]) end
- end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Runes failed!") return false end
- cube.ItemToStash(inCube[0])
- gem = Ao.me.stash:findByCode(FORMULA[rune])
- countRune = Ao.me.stash:findByCode("r"..rune)
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Made "..Settings.Craft.Rune[getRune], true)
- end
- end
- if rune > 20 and rune < 33 then
- gem = Ao.me.stash:findByCode(FORMULA[rune])
- countRune = Ao.me.stash:findByCode("r"..rune)
- while (countRune and gem and countRune:size() >= 3 and gem:size() >= 1) do
- stash.Open()
- for count = 0, 1 do
- cube.ItemToCube(countRune[count])
- if count == 0 then cube.ItemToCube(gem[count]) end
- end
- cube.Open()
- cube.Transmute()
- inCube = Ao.me.cube:get()
- if inCube:size() > 1 then Log(3, "Containers", "More than 1 item in cube, cube.Runes failed!") return false end
- cube.ItemToStash(inCube[0])
- gem = Ao.me.stash:findByCode(FORMULA[rune])
- countRune = Ao.me.stash:findByCode("r"..rune)
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- Log(2, "Containers", "Made "..Settings.Craft.Rune[getRune], true)
- end
- end
- end
- Log(2, "Containers", "cube.Runes Done", true)
- Log(1, "Containers", "cube.Runes: t= "..os.time(sec) - t)
- t = nil
- end
- cube.RerollBaalGCs = function()
- Log(2, "Containers", "Checking if we can reroll some gcs...", true)
- local logSaid = false
- local Gems = GetPGems()
- local BaalGCS = GetBaalGCS()
- local KeepGC = true
- local countKeptGCS = 0
- while table.getn(Gems) >= 3 and table.getn(BaalGCS) > 0 and countKeptGCS < table.getn(BaalGCS) do
- countKeptGCS = 0
- for i = 1, table.getn(BaalGCS) do
- if (not BaalGCS[i].flags.Identified) then -- Check if Unid and id it
- local ids = Ao.me.inventory:findByCode("ibk")
- if (ids:size() == 0) then Log(3, "Containers", "No Identify book, skipping") return end
- Ao:InitWaitingPacket(GS["UseStackableItem"])
- Ao:UseInventoryItem(ids[0].uid, Ao.me.x, Ao.me.y)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*3)
- Ao:InitWaitingPacket(GS["UseSpecialItem"])
- Ao:IdentifyItem(BaalGCS[i].uid, ids[0].uid);
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*3)
- end
- if (not sellItem(BaalGCS[i])) then -- Check if it should be kept as it is
- KeepGC = true
- countKeptGCS = countKeptGCS + 1 -- Count the kept gcs so it stops if all gcs in stash are kept
- else
- KeepGC = false
- end
- if table.getn(Gems) >= 3 and (not KeepGC) then
- if not logSaid then Log(2, "Containers", "Rerolling 91+ ILevel gc...", true) logSaid = true end
- stash.Open()
- cube.ItemToCube(Gems[1])
- cube.ItemToCube(Gems[2])
- cube.ItemToCube(Gems[3])
- cube.ItemToCube(BaalGCS[i])
- cube.Open()
- cube.Transmute()
- local newGc = Ao.me.cube:findByCode("cm3")
- cube.ItemToStash(newGc[0])
- end
- Gems = GetPGems()
- Ao:ClickButton(GameButton.CloseCube, 0)
- Ao:ClickButton(GameButton.CloseStash, 0)
- Sleep(Settings.Bot.InteractDelay)
- end
- Gems = GetPGems()
- BaalGCS = GetBaalGCS()
- end
- if logSaid then Log(2, "Containers", "Rerolling Baal gcs finished", true)
- else Log(2, "Containers", "Baal Gcs rerolling not needed, skipping.") end
- logSaid, Gems, BaalGCS, KeepGC, countKeptGCS = nil, nil, nil, nil, nil
- end
- cube.Open = function()
- local t = os.time(sec)
- Ao:InitWaitingPacket(GS["UseSpecialItem"])
- Ao:UseInventoryItem(Ao.me.cube.uid, Ao.me.x, Ao.me.y)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- t = nil
- end
- cube.Transmute = function()
- local t = os.time(sec)
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- Ao:ClickButton(GameButton.Transmute, 0)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*2)
- Log(1, "Containers", "cube.Transmute: t= "..os.time(sec) - t)
- t = nil
- end
- cube.ItemToCube = function(item)
- local t = os.time(sec)
- while Ao.me.cursor.uid == 0 do
- Log(1, "Containers", "cube.ItemToCube: Attempting to pick item ("..item.uid..")")
- Ao:InitWaitingPacket(GS["OwnedItemAction"])
- Ao:PickItemFromContainer(item.uid)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*2)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- while Ao.me.cursor.uid > 0 do
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- Ao:ItemToCube(item.uid, Ao.me.cube.uid)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*2)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- Log(1, "Containers", "cube.ItemToCube: t= "..os.time(sec) - t)
- t = nil
- end
- cube.ItemToStash = function(item)
- local t = os.time(sec)
- Ao:InitWaitingPacket(GS["OwnedItemAction"])
- while Ao.me.cursor.uid == 0 do
- Ao:PickItemFromContainer(item.uid)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- Ao:ClickButton(GameButton.CloseCube, 0)
- stash.Open()
- local place = Ao.me.stash:findLocation(Ao.me.cursor)
- if (place.x ~= -1 and place.y ~= -1) then
- if(place.x >= 0 and place.y >= 0) then
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- while Ao.me.cursor.uid ~= 0 do
- Ao:DropItemToContainer(Ao.me.cursor.uid, place.x, place.y, ItemContainerGC.Stash) --Is this crashing everything? We might need to move to inventory then to stash
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- Log(1, "Containers", "cube.ItemToStash: DropItem t= "..os.time(sec) - t)
- else
- Log(3, "Containers", "ÿc1Unable to find place to put item in cursor!")
- Log(1, "Containers", "cube.ItemToStash: fail t= "..os.time(sec) - t)
- return false
- end
- end
- Log(1, "Containers", "cube.ItemToStash: t= "..os.time(sec) - t)
- t = nil
- end
- cube.ItemToInventory = function(item)
- local t = os.time(sec)
- Ao:InitWaitingPacket(GS["OwnedItemAction"])
- while Ao.me.cursor.uid == 0 do
- Ao:PickItemFromContainer(item.uid)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- local place = Ao.me.inventory:findLocation(Ao.me.cursor)
- if (place.x ~= -1 and place.y ~= -1) then
- if (place.x >= 0 and place.y >= 0) then
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- while Ao.me.cursor.uid ~= 0 do
- Ao:DropItemToContainer(Ao.me.cursor.uid, to.x, to.y, ItemContainerGC.Inventory)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*3)
- end
- Sleep(Settings.Bot.InteractDelay/10)
- Log(1, "Containers", "cube.ItemToInventory: DropItem t= "..os.time(sec) -t)
- else
- Log(3, "Containers", "ÿc1Unable to find place to put item in cursor!")
- Log(1, "Containers", "cube.ItemToInventory: fail t= "..os.time(sec) - t)
- return false
- end
- end
- Log(1, "Containers", "cube.ItemToInventory: t= "..os.time(sec) - t)
- t = nil
- end
- --[[ End Cube Functions ]]--
- --[[ Stash Functions ]]--
- stash.Open = function()
- Ao:InitWaitingPacket(GS["UpdateItemUI"])
- Ao:UnitInteract(UnitType.GameObject, Ao.objects:FindBank())
- return Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- end
- --[[ End Stash Functions ]]--
- --[[ Belt Functions ]]--
- belt.ItemToInventory = function(item)
- local count = 0
- local to = Ao.me.inventory:findLocation(item)
- if (to ~= nil) then
- if (to.x < 0 or to.y < 0 or to.x > 9 or to.y > 3) then
- Log(3, "Containers", "ÿc1Unable to find place to put Pot into Inventory! Drinking pot")
- Ao:UseBeltItem(item.uid, false)
- Ao:Sleep(Settings.Bot.InteractDelay/3)
- return
- end
- end
- while (Ao.me.cursor.uid == 0 and count < 5) do
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- Ao:RemoveBeltItem(item.uid)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*3)
- count = count + 1
- end
- if (count > 4) then return end
- count = 0
- while (Ao.me.cursor.uid ~= 0 and count < 5) do
- Ao:InitWaitingPacket(GS["WorldItemAction"])
- Ao:DropItemToContainer(Ao.me.cursor.uid, to.x, to.y, ItemContainerGC.Inventory)
- Ao:WaitForInitPacket(Settings.Bot.InteractDelay*3)
- count = count + 1
- end
- count = nil
- end
- belt.PotCheck = function(pot)
- if pot == nil then
- Ao:Chat("pot is nil, skipping")
- return false
- end
- if pot.baseItem == nil then
- Ao:Chat("pot.baseItem is nil, skipping")
- return false
- end
- local pottype = Items:GetPotType(pot.baseItem.code)
- if pottype >= 3 then --not a pot!
- return false
- end
- local beltmap = Ao.me.belt:getBelt()
- if beltmap:size() >= 4* Ao.me.beltrows then
- return false
- end
- local maxpots = 0
- for i = 1, 4 do
- if getEnumValue(PotionType, Settings.Inventory.Belt[i]) == pottype then
- maxpots = maxpots + Ao.me.beltrows
- end
- end
- return Ao.me.belt:getPotionCount(pottype) < maxpots
- end
- belt.ListMe = function()
- local beltRow
- Ao:Chat("ListMe")
- for j = 0, 3 do
- --Ao:Chat("j = "..j)
- beltRow = Ao.me.belt:getBeltRow(j)
- for i = 0, beltRow:size() - 1 do--, 0, -1 do
- Ao:Chat(Items:GetPotType(beltRow[i].baseItem.code).." == "..getEnumKey(PotionType, Items:GetPotType(beltRow[i].baseItem.code)))
- end
- end
- end
- belt.ManagePots = function()
- if (belt.CleanToInv()) then -- check if the beltrows are sorted properly
- Log(2, "Containers", "Transferring potions back to belt.", true)
- end
- for c = 1, 4 do
- local items = Ao.me.inventory:get()
- for i = 0, items:size() - 1 do
- --Ao:Chat("this is a : "..Items:GetPotType(items[i].baseItem.code).." and PotionType.Error is "..PotionType.Error)
- if (Items:GetPotType(items[i].baseItem.code) ~= PotionType.Error) then
- --Ao:Chat(Items:GetPotType(items[i].baseItem.code).." ?= ".. getEnumValue(PotionType, Settings.Inventory.Belt[c]))
- if (Items:GetPotType(items[i].baseItem.code) == getEnumValue(PotionType, Settings.Inventory.Belt[c])) then
- --Ao:Chat("PotCheck()")
- if (belt.PotCheck(items[i])) then
- --Ao:Chat("beltPotCheck")
- Ao:InventoryItemToBelt(items[i].uid)
- Sleep(Settings.Bot.InteractDelay/20)
- else
- Ao:UseInventoryItem(items[i].uid, Ao.me.x, Ao.me.y)
- Sleep(Settings.Bot.InteractDelay/20)
- end
- end
- Ao:Sleep(Settings.Bot.InteractDelay/5) -- don't sleep too much, it's annoying
- end
- end
- end
- end
- belt.CleanToInv = function()
- local beltRow
- local messedUp = false
- for i = 0, 3 do
- beltRow = Ao.me.belt:getBeltRow(i)
- for ii = beltRow:size()-1, 0, -1 do
- --Ao:Chat(Items:GetPotType(beltRow[ii].baseItem.code).." ~= "..PotionType.Error)
- if (Items:GetPotType(beltRow[ii].baseItem.code) ~= PotionType.Error) then
- --Ao:Chat(" * "..getEnumKey(PotionType, Items:GetPotType(beltRow[ii].baseItem.code)).." ~= "..Settings.Inventory.Belt[i+1])
- if (getEnumKey(PotionType, Items:GetPotType(beltRow[ii].baseItem.code)) ~= Settings.Inventory.Belt[i+1]) then
- belt.ItemToInventory(beltRow[ii])
- if(messedUp == false) then
- messedUp = true
- Log(2, "Containers", "Belt is messed up, moving to inventory.", true)
- end
- end
- end
- end
- end
- return messedUp
- end
- belt.Drink = function(potion, givemerc)
- local pot = Ao.me.belt:getPotion(potion)
- if (pot ~= nil and pot.uid ~= 0) then
- if (givemerc == false) then ItemMessage("Drank ", pot)
- elseif (givemerc == true) then ItemMessage("Gave Merc ", pot) end
- Ao:UseBeltItem(pot.uid, givemerc)
- return true
- end
- Log(1, "Containers", "Drink failed, Cant find pot")
- return false
- end
- --[[ End Belt Functions ]]--
- --[[ Inventory Functions ]]--
- inventory.GetItemsToId = function()
- local items = Ao.me.inventory:get()
- local id = {}
- for i = 0, items:size() - 1 do
- if Settings.Lock.Inventory[(tonumber(items[i].y..(items[i].x+1)))] == 0 then
- if not items[i].flags.Identified and identifyItem(items[i]) then
- table.insert(id, items[i])
- end
- end
- end
- return id
- end
- inventory.GetItemsToSell = function()
- local items = Ao.me.inventory:get()
- local sell = {}
- for i = 0, items:size() - 1 do
- if Settings.Lock.Inventory[(tonumber(items[i].y..(items[i].x+1)))] == 0 then
- if sellItem(items[i]) then
- table.insert(sell, items[i])
- end
- end
- end
- return sell
- end
- inventory.GetItemsToStash = function()
- local items = Ao.me.inventory:get()
- local stash = {}
- for i = 0, items:size() - 1 do
- if Settings.Lock.Inventory[(tonumber(items[i].y..(items[i].x+1)))] == 0 then
- if not sellItem(items[i]) then
- table.insert(stash, items[i])
- end
- end
- end
- return stash
- end
- inventory.IdentifyItem = function(item)
- local id = Ao.me.inventory:findByCode('ibk')
- if id:size() == 0 then
- id = Ao.me.inventory:findByCode('isc')
- if id:size() == 0 then
- return false
- end
- end
- Ao:InitWaitingPacket(GS["UseStackableItem"])
- repeat
- Ao:UseInventoryItem(id[0].uid, Ao.me.x, Ao.me.y)
- until Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- Ao:InitWaitingPacket(GS["UseSpecialItem"])
- repeat
- Ao:IdentifyItem(item.uid, id[0].uid)
- until Ao:WaitForInitPacket(Settings.Bot.InteractDelay)
- end
- inventory.ScrollCheck = function(scroll)
- if scroll.baseItem.code ~= "tsc" or scroll.baseItem.code ~= "isc" then
- return false
- end
- local tptome, idtome = Ao.me.inventory:findByCode("tbk"), Ao.me.inventory:findByCode("ibk")
- if scroll.baseItem.code == "tsc" and tptome:size() > 0 then
- if Ao.me.tps < 20 then
- return true
- end
- elseif scroll.baseItem.code == "tsc" and idtome:size() > 0 then
- if Ao.me.ids < 20 then
- return true
- end
- end
- return false
- end
- inventory.AmmoCheck = function(ammo)
- if ammo.baseItem.code ~= "aqv" or ammo.baseItem.code ~= "cqv" then
- return false
- end
- --[[ Needs code to determine whether to pick arrows or bolts ]]--
- end
- inventory.GoldCheck = function(gold)
- if gold.baseItem.code ~= "gld" then
- return false
- elseif gold.stats[0].Value >= Settings.Inventory.MinGoldToPick and Ao.me.gold < Ao.me.level * 10000 then
- return true
- else
- return false
- end
- end
- --[[ End Inventory Functions ]]--
- --[[ Body Functions ]]--
- -- Placeholder
- --[[ End Body Functions ]]--
- --[[ Misc Functions ]]--
- GetBaalGCS = function()
- local BaalGCS = {}
- local GCS = Ao.me.stash:findByCode("cm3")
- for i = 0, GCS:size() - 1 do
- if (GCS[i].level >= 91) then table.insert(BaalGCS,table.getn(BaalGCS) + 1,GCS[i]) end
- end
- return BaalGCS
- end
- GetPGems = function()
- local gems = {}
- PGemsA = Ao.me.stash:findByCode("gpv")
- PGemsB = Ao.me.stash:findByCode("gpw")
- PGemsC = Ao.me.stash:findByCode("gpg")
- PGemsD = Ao.me.stash:findByCode("gpr")
- PGemsE = Ao.me.stash:findByCode("gpb")
- PGemsF = Ao.me.stash:findByCode("skz")
- PGemsG = Ao.me.stash:findByCode("gpy")
- for i = 0, PGemsA:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsA[i]) end
- for i = 0, PGemsB:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsB[i]) end
- for i = 0, PGemsC:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsC[i]) end
- for i = 0, PGemsD:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsD[i]) end
- for i = 0, PGemsE:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsE[i]) end
- for i = 0, PGemsF:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsF[i]) end
- for i = 0, PGemsG:size() - 1 do table.insert(gems,table.getn(gems) + 1,PGemsG[i]) end
- return gems
- end
- GetStashContainer = function(item)
- local to = 0
- local gotcube = Ao.me.stash:findByCode("box")
- if table.getn(Settings.Craft.Rune) == 0
- and table.getn(Settings.Craft.Flawed) == 0
- and table.getn(Settings.Craft.Normal) == 0
- and table.getn(Settings.Craft.Flawless) == 0
- and table.getn(Settings.Craft.Perfect) == 0
- and gotcube:size() == 1 then
- to = Ao.me.cube:findLocation(item)
- if to and to.x < 3 and to.y < 4 and to.x >= 0 and to.y >= 0 then
- return ItemContainerGC.Cube, to.x, to.y
- end
- end
- to = Ao.me.stash:findLocation(item)
- if to and to.x < 6 and to.y < 8 and to.x >= 0 and to.y >= 0 then
- return ItemContainerGC.Stash, to.x, to.y
- end
- return ItemContainerGC.Inventory, to.x, to.y
- end
Add Comment
Please, Sign In to add comment