so Leute habe mal nen Fehler beseitigt weis nicht ob es nur bei mir der Fall war kommt wenn ihr startend immer ein Error mit der actions ini überschreibt es mit dem hier!
Code:
function Heal()
Log(2, "Awesom-O", "Heal")
local life = ((Ao.me.life / Ao.me.maxlife) * 100 )
local mana = ((Ao.me.mana / Ao.me.maxmana) * 100)
if (life < Settings.ShopHealth or mana < Settings.ShopMana) then
ToTown()
ManagePots()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Akara
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Fara
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Ormus
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Jamella
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.Malah
MoveTo(5075, 5023)
end
if (not MoveToNPC(npcid)) then
return false
end
if (NpcInteract(npcid)) then
Ao:Sleep(1000)
NpcCloseMenu(npcid)
Log(2, "Awesom-O", "Heal end")
return true
end
return false
else
Log(2, "Awesom-O", "Heal not needed")
end
end
function Repair(skip)
Log(2, "Awesom-O", "Repair")
if (skip ~= nil and type(skip) == "number") then
if (math.mod(Ao.gamenumber , skip) ~= 0 ) then
Log(2, "Awesom-O", "Skipping Repair!")
return
end
end
ToTown()
ManagePots()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Charsi
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Fara
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Hratli
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Halbu
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.Larzuk
end
if (npcid == NPCCode.Larzuk) then
MoveTo(5143, 5045)
elseif (not MoveToNPC(npcid)) then
return false
end
if (NpcInteract(npcid)) then
Ao:Sleep(1000)
NpcMenuSelect(TownFolkMenuItem.Trade, npcid)
Ao:Sleep(500)
local npc = FindNpcByCode(npcid)
Ao:TownFolkRepair(npc.uid)
Ao:WaitForPacket(42, 3); --TransactionComplete
NpcCloseMenu(npcid)
Log(2, "Awesom-O", "Repair end")
return true
end
Log(3, "Awesom-O", "Repair failed")
return false
end
function Ressurect()
if (not Settings.UseMerc) then
return false
end
Log(2, "Awesom-O", "Ressurect")
-- check doesnt work it seems merc struct doest work yet
if (Ao.merc.uid > 0) then
Log(2, "Awesom-O", "Merc alive! Skipping Ressurect")
return false
end
if ((Ao.me.gold + Ao.me.goldbank) < 50000) then
Log(3, "Awesom-O", "Failed to Ressurect Merc, not enough gold")
return false
end
ToTown()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Kashya
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Greiz
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Asheara
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Tyrael2
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.QualKehk
MoveTo(5061, 5081)
end
if (not MoveToNPC(npcid)) then
return false
end
if (NpcInteract(npcid)) then
Ao:Sleep(1000)
local npc = FindNpcByCode(npcid )
Ao:ResurrectMerc(npc.uid)
Ao:WaitForPacket(42, 3); --TransactionComplete
Log(2, "Awesom-O", "Merc Resurrected");
NpcCloseMenu(npcid)
end
--Reequip merc weapon
if (Settings.ReEquipMercWeapon and Ao.merc.uid > 0) then
while (Ao.me.cursor.uid == 0 ) do
Ao:ChangeMercEquipment(EquipmentLocation.RightHand, true)
Ao:WaitForPacket(156, 3) --WorldItemAction
Ao:Sleep(200)
end
while (Ao.me.cursor.uid ~= 0 ) do
Ao:ChangeMercEquipment(EquipmentLocation.NotApplicable)
Ao:WaitForPacket(66, 3) --PlayerClearCursor
Ao:Sleep(30)
end
end
Log(2, "Awesom-O", "Ressurect end")
end
function Shop()
Log(2, "Awesom-O", "Shop")
local blue = Ao.me.belt:getPotionCount(PotionType.Blue)
local red = Ao.me.belt:getPotionCount(PotionType.Red)
local purple = Ao.me.belt:getPotionCount(PotionType.Purple)
if ( blue >= Settings.ShopBlue and red >= Settings.ShopRed and Ao.me.tps >= Settings.ShopTp and Ao.me.ids >= Settings.ShopId) then
Log(2, "Awesom-O", "Don't need to shop, skipping")
return false
end
local npcid
-- npcid of the shop npc for the act we're in
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Akara
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Drognan
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Ormus
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Jamella
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.Malah
MoveTo(5075, 5023)
end
-- goto town, if we are already in town, this will do nothing
ToTown()
ManagePots()
--goto the correct npc, and open their menu
if (not MoveToNPC(npcid)) then
return false
end
if ( NpcInteract(npcid) ) then
Ao:Sleep(1000)
if ( not NpcMenuSelect(TownFolkMenuItem.Trade, npcid)) then
return false
end
Log(1, "Awesom-O", "Open store!")
--sleep needed here for creating the item map in dia
Ao:Sleep(Settings.FindNpcStoreDelay)
-- find the items we may need to buy in the store
local _buyblue = Ao.store:findBaseItem("mp")
local _buyred = Ao.store:findBaseItem("hp")
local _buytp = Ao.store:findBaseItem("tsc")
local _buyid = Ao.store:findBaseItem("isc")
local npc = FindNpcByCode(npcid)
if (npc == 0) then
Log(3, "Awesom-O", "Cant find Npc in Shop() "..npcid)
return false
end
-- the following code simply buys the items we need
for i = blue, Settings.ShopBlue - 1 do
Ao:BuyItem(npc.uid, _buyblue.uid, 0, false);
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
for i = red, Settings.ShopRed - 1 do
Ao:BuyItem(npc.uid, _buyred.uid, 0, false);
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
if (Ao.me.tps < Settings.ShopTp) then
Ao:BuyItem(npc.uid, _buytp.uid, 0, true);
Ao:WaitForPacket(42, 3); --TransactionComplete
Ao:Sleep(30);
end
if (Ao.me.ids < Settings.ShopId) then
Ao:BuyItem(npc.uid, _buyid.uid, 0, true)
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
NpcCloseMenu(npcid)
Log(2, "Awesom-O", "Shop end")
return true
end
Log(3, "Awesom-O", "Shop failed")
return false
end
function Sell()
Log(2, "Awesom-O", "Sell")
local needSell = false
local items = Ao.me.inventory:get()
for i = 0, items:size() - 1 do
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
if (not items[i].flags.Identified) then
if (identifyItem(items[i])) then
needSell = true
end
else
if (sellItem(items[i])) then
needSell = true
end
end
end
end
if (not needSell) then
Log(2, "Awesom-O", "Sell not needed")
return false
end
ToTown()
ManagePots()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Akara
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Drognan
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Ormus
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Jamella
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.Malah
MoveTo(5075, 5023)
end
--goto the correct npc, and open their menu
if (not MoveToNPC(npcid)) then
return false
end
if ( NpcInteract(npcid) ) then
Ao:Sleep(1000)
if ( not NpcMenuSelect(TownFolkMenuItem.Trade, npcid)) then
return false
end
end
--sleep needed here for creating the item map in dia
Ao:Sleep(Settings.FindNpcStoreDelay)
local npc = FindNpcByCode(npcid)
items = Ao.me.inventory:get()
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
-- check if item needs to be indentified
if (not items[i].flags.Identified) then
-- run Pickit Revolution func to check if item should be identified
if (identifyItem(items[i])) then
local ids = Ao.me.inventory:findByCode("ibk")
if (ids:size() == 0) then -- if no id book buy a scroll
local buyid = Ao.store:findBaseItem("isc")
Ao:BuyItem(npc.uid, buyid.uid, 0, false)
Ao:WaitForPacket(42, 3) --TransactionComplete
ids = Ao.me.inventory:findByCode("isc")
end
Ao:UseInventoryItem(ids[0].uid, Ao.me.x, Ao.me.y)
Ao:WaitForPacket(63, 3) --UseStackableItem
Ao:Sleep(30)
Ao:IdentifyItem(items[i].uid, ids[0].uid);
Ao:WaitForPacket(124, 3) --UseSpecialItem
Ao:Sleep(30)
end
end
end
end
Ao:Sleep(Settings.SellDelay)
items = Ao.me.inventory:get()
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
--check if item can be sold
if (sellItem(items[i])) then -- run PR script to check if item should be sold
ItemMessage("Sold:", items[i])
if (Settings.LogSold) then LogItem("Sold", items[i]) end
while (Ao.me.cursor.uid == 0 ) do
Ao:PickItemFromContainer(items[i].uid)
Ao:WaitForPacket(157, 3) -- OwnedItemAction
Ao:Sleep(30)
end
Ao:SellItem(npc.uid, items[i].uid, 0)
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
Ao:Sleep(Settings.SellDelay)
end
end
NpcCloseMenu(npcid)
if Ao.me.cursor.uid > 0 then
Ao:DropItem(Ao.me.cursor.uid)
Ao:WaitForPacket(156, 3) --WorldItemAction
end
Log(2, "Awesom-O", "Sell end")
end
function Stash()
Log(2, "Awesom-O", "Stashing")
local needStash = false
local maxgoldstash = (Ao.me.level - 30) * 50000 - 800000 -- formula for max gold in stash, will just work for lvl 31 and further
if Ao.me.gold >= Settings.StashGold and Ao.me.goldbank < maxgoldstash then
needStash = true
end
if (not needStash) then
local items = Ao.me.inventory:get()
for i = 0, items:size() - 1 do
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
if ( (items[i].flags.Identified ) or ( not identifyItem(items[i]))) then
if (not sellItem(items[i])) then
needStash = true
end
end
end
end
end
if (not needStash) then
Log(2, "Awesom-O", "Stashing not needed!")
return false
end
ToTown()
ManagePots()
if ( not Settings.StashEveryWhere ) then
MoveToObjectById(267)
end
OpenStash()
local items = Ao.me.inventory:get()
local count = 0
if ( Ao.me.gold >= Settings.StashGold and Ao.me.goldbank < maxgoldstash) then
while (Ao.me.gold ~= 0 and count < 5) do
Ao:ClickButton(GameButton.StashGold, Ao.me.gold)
Ao:WaitForPacket(29, 2) --AttributeByte
Ao:Sleep(30)
count = count + 1
end
end
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
-- if its cube dont go further
if (items[i].baseItem.code ~= "box") then
-- if its not identified and has to be identified dont go further
if ( (items[i].flags.Identified ) or ( not identifyItem(items[i]))) then
--if the item should be sold, dont go further
if (not sellItem(items[i])) then
-- if pot drink it
if (Items:GetPotType(items[i].baseItem.code) ~= PotionType.Error) then
Ao:UseInventoryItem(items[i].uid, Ao.me.x, Ao.me.y)
Ao:Sleep(300)
else
-- pick up item
while (Ao.me.cursor.uid == 0 ) do
Ao:PickItemFromContainer(items[i].uid)
Ao:WaitForPacket(157, 3) --OwnedItemAction
Ao:Sleep(30);
end
-- if its scroll drop it
if (items[i].baseItem.code == "tsc" or items[i].baseItem.code == "isc" ) then
Ao:DropItem(items[i].uid)
Ao:WaitForPacket(156, 3) --WorldItemAction
Ao:Sleep(30)
-- else to stash
else
local container = GetStashContainer(items[i])
local to
if ( container ~= ItemContainerGC.Inventory) then
ItemMessage("Stashed:",items[i])
if (Settings.LogStashed) then LogItem("Stashed", items[i]) end
if (container == ItemContainerGC.Stash) then
to = Ao.me.stash:findLocation(items[i])
else
to = Ao.me.cube:findLocation(items[i])
end
else
Log(3, "Awesom-O", "Stash is full, item back to Inventory")
to = Ao.me.inventory:findLocation(items[i])
end
Ao:DropItemToContainer(items[i].uid, to.x, to.y, container)
Ao:WaitForPacket(156, 3) --WorldItemAction
Ao:Sleep(30)
end
end
end
end
end
Ao:Sleep(Settings.StashDelay)
end
end
CloseStash()
Log(2, "Awesom-O", "Stash end")
end
function IdentifyCain()
Log(2, "Awesom-O", "IdentifyCain")
ToTown()
ManagePots()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.DeckardCain5
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.DeckardCain2
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.DeckardCain3
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.DeckardCain4
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.DeckardCain6
end
if (not MoveToNPC(npcid)) then
return false
end
local npc = FindNpcByCode(npcid)
if ( NpcInteract(npcid) ) then
Ao:CainIdentifyItems(npc.uid)
Ao:Sleep(50)
NpcCloseMenu(npcid)
end
Log(2, "Awesom-O", "IdentifyCain end")
end
function Act1()
Log(2, "Awesom-O", "Moving to act 1")
MoveToArea(AreaLevel.RogueEncampment)
end
function Act2()
Log(2, "Awesom-O", "Moving to act 2")
MoveToArea(AreaLevel.LutGholein)
end
function Act3()
Log(2, "Awesom-O", "Moving to act 3")
MoveToArea(AreaLevel.KurastDocks)
end
function Act4()
Log(2, "Awesom-O", "Moving to act 4")
MoveToArea(AreaLevel.ThePandemoniumFortress)
end
function Act5()
Log(2, "Awesom-O", "Moving to act 5")
MoveToArea(AreaLevel.Harrogath)
end
function Dump()
Log(1, "Awesom-O", "Dump")
local items = Ao.me.inventory:get()
if Settings.DumpDelay > 0 then
Ao:Sleep(Settings.DumpDelay)
end
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
-- check if item needs to be indentified
if (not items[i].flags.Identified) then
-- run Pickit Revolution func to check if item should be identified
if (identifyItem(items[i])) then
local ids = Ao.me.inventory:findByCode("ibk")
--add checks here if book is empty so buy ids
Ao:UseInventoryItem(ids[0].uid, Ao.me.x, Ao.me.y)
Ao:WaitForPacket(63, 3) --UseStackableItem
Ao:Sleep(30)
Ao:IdentifyItem(items[i].uid, ids[0].uid);
Ao:WaitForPacket(124, 3) --UseSpecialItem
Ao:Sleep(30)
end
end
end
end
items = Ao.me.inventory:get()
if Settings.DumpDelay > 0 then
Ao:Sleep(Settings.DumpDelay)
end
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
if (dumpItem(items[i])) then
ItemMessage("Dumping:", items[i])
if (Settings.LogDumped) then LogItem("Dumped", items[i]) end
while (Ao.me.cursor.uid == 0 ) do
Ao:PickItemFromContainer(items[i].uid)
Ao:WaitForPacket(157, 3) --OwnedItemAction
Ao:Sleep(30)
end
while (Ao.me.cursor.uid > 0 ) do
Ao:DropItem(items[i].uid)
Ao:WaitForPacket(156, 3) --WorldItemAction
Ao:Sleep(30)
end
end
end
end
end
function Gamble()
if ((Ao.me.gold + Ao.me.goldbank) < Settings.GambleFrom) then
Log(1, "Awesom-O", Ao.me.gold + Ao.me.goldbank.." gold found; Skipping Gamble")
return
end
Log(2, "Awesom-O", "Gambling")
ToTown()
local npcid
if ( Ao.me.act == 1 ) then
npcid = NPCCode.Gheed
elseif ( Ao.me.act == 2 ) then
npcid = NPCCode.Elzix
elseif ( Ao.me.act == 3 ) then
npcid = NPCCode.Alkor
elseif ( Ao.me.act == 4 ) then
npcid = NPCCode.Jamella
elseif ( Ao.me.act == 5 ) then
npcid = NPCCode.Drehya
MoveTo(5110, 5121, false)
end
--goto the correct npc, and open their menu
if (not MoveToNPC(npcid)) then
return false
end
local done = false
while (not done) do
if ( NpcInteract(npcid) ) then
if ( not NpcMenuSelect(TownFolkMenuItem.Gamble, npcid)) then
return false
end
end
if (Ao.me.gold + Ao.me.goldbank < Settings.GambleTo) then
done = true
return
end
local gamble = Ao.store:gamble()
local npc = FindNpcByCode(npcid)
for i = 0, gamble:size() - 1 do
if (gambleItem(gamble[i])) then
Ao:GambleItem(npc.uid, gamble[i].uid, 0)
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
end
local items = Ao.me.inventory:get()
for i = 0, items:size() - 1 do
-- check if item is locked
if (Settings.Inventory[items[i].y + 1][items[i].x + 1] ~= 1) then
ItemMessage("Gambled:", items[i])
if (Settings.LogGambled) then LogItem("Gambled", items[i]) end
if (sellItem(items[i])) then
--LOG(logINFO) << "Sell " << item.baseItem->code << " prefix = " << item.prefix.Index << " suffix = " << item.suffix.Index;
while (Ao.me.cursor.uid == 0 ) do
Ao:PickItemFromContainer(items[i].uid)
Ao:WaitForPacket(157, 3) --OwnedItemAction
Ao:Sleep(30);
end
while (Ao.me.cursor.uid > 0 ) do
Ao:SellItem(npc.uid, items[i].uid, 0)
Ao:WaitForPacket(42, 3) --TransactionComplete
Ao:Sleep(30)
end
end
end
end
NpcCloseMenu(npcid)
Ao:Sleep(500)
--end
end
Log(1, "Awesom-O", "Gamble end")
end