Updated to OTCv8 3.0 rev 43

This commit is contained in:
OTCv8 2021-05-15 16:51:02 +00:00
parent dea82a6751
commit 1def896276
111 changed files with 4642 additions and 2368 deletions

View File

@ -477,6 +477,7 @@ function initCallbacks()
onChannelEvent = botChannelEvent,
onImbuementWindow = botOnImbuementWindow,
onModalDialog = botOnModalDialog,
onAttackingCreatureChange = botOnAttackingCreatureChange
})
connect(Tile, {
@ -532,6 +533,7 @@ function terminateCallbacks()
onChannelEvent = botChannelEvent,
onImbuementWindow = botOnImbuementWindow,
onModalDialog = botOnModalDialog,
onAttackingCreatureChange = botOnAttackingCreatureChange
})
disconnect(Tile, {
@ -717,3 +719,8 @@ function botOnModalDialog(id, title, message, buttons, enterButton, escapeButton
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onModalDialog(id, title, message, buttons, enterButton, escapeButton, choices, priority) end)
end
function botOnAttackingCreatureChange(creature, oldCreature)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onAttackingCreatureChange(creature,oldCreature) end)
end

View File

@ -1,187 +0,0 @@
setDefaultTab("Main")
pushPanelName = "pushmax"
local ui = setupUI([[
Panel
height: 19
BotSwitch
id: title
anchors.top: parent.top
anchors.left: parent.left
text-align: center
width: 130
!text: tr('PUSHMAX')
Button
id: push
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
margin-left: 3
height: 17
text: Setup
]])
ui:setId(pushPanelName)
if not storage[pushPanelName] then
storage[pushPanelName] = {
enabled = true,
pushDelay = 1060,
pushMaxRuneId = 3188,
mwallBlockId = 2128,
pushMaxKey = "PageUp"
}
end
ui.title:setOn(storage[pushPanelName].enabled)
ui.title.onClick = function(widget)
storage[pushPanelName].enabled = not storage[pushPanelName].enabled
widget:setOn(storage[pushPanelName].enabled)
end
ui.push.onClick = function(widget)
pushWindow:show()
pushWindow:raise()
pushWindow:focus()
end
rootWidget = g_ui.getRootWidget()
if rootWidget then
pushWindow = g_ui.createWidget('PushMaxWindow', rootWidget)
pushWindow:hide()
pushWindow.closeButton.onClick = function(widget)
pushWindow:hide()
end
local updateDelayText = function()
pushWindow.delayText:setText("Push Delay: ".. storage[pushPanelName].pushDelay)
end
updateDelayText()
pushWindow.delay.onValueChange = function(scroll, value)
storage[pushPanelName].pushDelay = value
updateDelayText()
end
pushWindow.delay:setValue(storage[pushPanelName].pushDelay)
pushWindow.runeId.onItemChange = function(widget)
storage[pushPanelName].pushMaxRuneId = widget:getItemId()
end
pushWindow.runeId:setItemId(storage[pushPanelName].pushMaxRuneId)
pushWindow.mwallId.onItemChange = function(widget)
storage[pushPanelName].mwallBlockId = widget:getItemId()
end
pushWindow.mwallId:setItemId(storage[pushPanelName].mwallBlockId)
pushWindow.hotkey.onTextChange = function(widget, text)
storage[pushPanelName].pushMaxKey = text
end
pushWindow.hotkey:setText(storage[pushPanelName].pushMaxKey)
end
function matchPosition(curX, curY, destX, destY)
return (curX == destX and curY == destY)
end
local target
local targetTile
local targetOldPos
macro(10, function()
if not storage[pushPanelName].enabled then return end
if target and targetTile then
if not matchPosition(target:getPosition().x, target:getPosition().y, targetTile:getPosition().x, targetTile:getPosition().y) then
local tile = g_map.getTile(target:getPosition())
targetOldPos = tile:getPosition()
if tile then
if tile:getTopUseThing():isPickupable() or not tile:getTopUseThing():isNotMoveable() then
useWith(tonumber(storage[pushPanelName].pushMaxRuneId), target)
delay(10)
end
if targetTile:getTopThing():getId() == 2129 or targetTile:getTopThing():getId() == 2130 or targetTile:getTopThing():getId() == tonumber(storage[pushPanelName].mwallBlockId) then
if targetTile:getTimer() <= tonumber(storage[pushPanelName].pushDelay) then
info("now")
g_game.move(target, targetTile:getPosition())
tile:setText("")
targetTile:setText("")
target = nil
targetTile = nil
end
else
g_game.move(target, targetTile:getPosition())
delay(1250)
end
end
else
if targetOldPos then
local tile = g_map.getTile(targetOldPos)
if tile then
tile:setText("")
targetTile:setText("")
end
end
target = nil
targetTile = nil
end
end
end)
local resetTimer = now
onKeyDown(function(keys)
if not storage[pushPanelName].enabled then return end
if keys == storage[pushPanelName].pushMaxKey and resetTimer == 0 then
if not target then
local tile = getTileUnderCursor()
if tile and getDistanceBetween(pos(), tile:getPosition()) <= 1 then
if tile:getCreatures()[1] then
target = tile:getCreatures()[1]
tile:setText("PUSH TARGET")
end
end
else
local tile = getTileUnderCursor()
if tile and not tile:getCreatures()[1] then
targetTile = tile
tile:setText("DESTINATION")
end
end
resetTimer = now
end
end)
onKeyPress(function(keys)
if not storage[pushPanelName].enabled then return end
if keys == storage.pushMaxKey and (resetTimer - now) < -10 then
for _, tile in ipairs(g_map.getTiles(posz())) do
if getDistanceBetween(pos(), tile:getPosition()) < 3 then
if tile:getText() ~= "" then
tile:setText("")
end
end
end
target = nil
targetTile = nil
resetTimer = 0
else
resetTimer = 0
end
end)
onCreaturePositionChange(function(creature, newPos, oldPos)
if target and storage[pushPanelName].enabled then
if creature:getName() == target:getName() then
target = nil
targetTile = nil
for _, tile in ipairs(g_map.getTiles(posz())) do
if getDistanceBetween(pos(), tile:getPosition()) < 3 then
if tile:getText() ~= "" then
tile:setText("")
end
end
end
end
end
end)

View File

@ -1,20 +0,0 @@
local vocation = player:getVocation()
local vocText = ""
if vocation == 1 or vocation == 11 then
vocText = "- EK"
elseif vocation == 2 or vocation == 12 then
vocText = "- RP"
elseif vocation == 3 or vocation == 13 then
vocText = "- MS"
elseif vocation == 4 or vocation == 14 then
vocText = "- ED"
end
macro(2000, function()
if hppercent() > 0 then
g_window.setTitle("Tibia - " .. player:getName() .. " - " .. lvl() .. "lvl " .. vocText)
else
g_window.setTitle("Tibia - " .. player:getName() .. " - DEAD")
end
end)

View File

@ -1,242 +0,0 @@
setDefaultTab("HP")
local conditionPanelName = "ConditionPanel"
local ui = setupUI([[
Panel
height: 19
BotSwitch
id: title
anchors.top: parent.top
anchors.left: parent.left
text-align: center
width: 130
!text: tr('Conditions')
Button
id: conditionList
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
margin-left: 3
height: 17
text: Setup
]])
ui:setId(conditionPanelName)
if not storage[conditionPanelName] then
storage[conditionPanelName] = {
enabled = false,
curePosion = false,
poisonCost = 20,
cureCurse = false,
curseCost = 80,
cureBleed = false,
bleedCost = 45,
cureBurn = false,
burnCost = 30,
cureElectrify = false,
electrifyCost = 22,
cureParalyse = false,
paralyseCost = 40,
paralyseSpell = "utani hur",
holdHaste = false,
hasteCost = 40,
hasteSpell = "utani hur",
holdUtamo = false,
utamoCost = 40,
holdUtana = false,
utanaCost = 440,
holdUtura = false,
uturaType = "",
uturaCost = 100,
ignoreInPz = true,
stopHaste = false
}
end
ui.title:setOn(storage[conditionPanelName].enabled)
ui.title.onClick = function(widget)
storage[conditionPanelName].enabled = not storage[conditionPanelName].enabled
widget:setOn(storage[conditionPanelName].enabled)
end
ui.conditionList.onClick = function(widget)
conditionsWindow:show()
conditionsWindow:raise()
conditionsWindow:focus()
end
local rootWidget = g_ui.getRootWidget()
if rootWidget then
conditionsWindow = g_ui.createWidget('ConditionsWindow', rootWidget)
conditionsWindow:hide()
-- text edits
conditionsWindow.Cure.PoisonCost:setText(storage[conditionPanelName].poisonCost)
conditionsWindow.Cure.PoisonCost.onTextChange = function(widget, text)
storage[conditionPanelName].poisonCost = tonumber(text)
end
conditionsWindow.Cure.CurseCost:setText(storage[conditionPanelName].curseCost)
conditionsWindow.Cure.CurseCost.onTextChange = function(widget, text)
storage[conditionPanelName].curseCost = tonumber(text)
end
conditionsWindow.Cure.BleedCost:setText(storage[conditionPanelName].bleedCost)
conditionsWindow.Cure.BleedCost.onTextChange = function(widget, text)
storage[conditionPanelName].bleedCost = tonumber(text)
end
conditionsWindow.Cure.BurnCost:setText(storage[conditionPanelName].burnCost)
conditionsWindow.Cure.BurnCost.onTextChange = function(widget, text)
storage[conditionPanelName].burnCost = tonumber(text)
end
conditionsWindow.Cure.ElectrifyCost:setText(storage[conditionPanelName].electrifyCost)
conditionsWindow.Cure.ElectrifyCost.onTextChange = function(widget, text)
storage[conditionPanelName].electrifyCost = tonumber(text)
end
conditionsWindow.Cure.ParalyseCost:setText(storage[conditionPanelName].paralyseCost)
conditionsWindow.Cure.ParalyseCost.onTextChange = function(widget, text)
storage[conditionPanelName].paralyseCost = tonumber(text)
end
conditionsWindow.Cure.ParalyseSpell:setText(storage[conditionPanelName].paralyseSpell)
conditionsWindow.Cure.ParalyseSpell.onTextChange = function(widget, text)
storage[conditionPanelName].paralyseSpell = text
end
conditionsWindow.Hold.HasteSpell:setText(storage[conditionPanelName].hasteSpell)
conditionsWindow.Hold.HasteSpell.onTextChange = function(widget, text)
storage[conditionPanelName].hasteSpell = text
end
conditionsWindow.Hold.HasteCost:setText(storage[conditionPanelName].hasteCost)
conditionsWindow.Hold.HasteCost.onTextChange = function(widget, text)
storage[conditionPanelName].hasteCost = tonumber(text)
end
conditionsWindow.Hold.UtamoCost:setText(storage[conditionPanelName].utamoCost)
conditionsWindow.Hold.UtamoCost.onTextChange = function(widget, text)
storage[conditionPanelName].utamoCost = tonumber(text)
end
conditionsWindow.Hold.UtanaCost:setText(storage[conditionPanelName].utanaCost)
conditionsWindow.Hold.UtanaCost.onTextChange = function(widget, text)
storage[conditionPanelName].utanaCost = tonumber(text)
end
conditionsWindow.Hold.UturaCost:setText(storage[conditionPanelName].uturaCost)
conditionsWindow.Hold.UturaCost.onTextChange = function(widget, text)
storage[conditionPanelName].uturaCost = tonumber(text)
end
-- combo box
conditionsWindow.Hold.UturaType:setOption(storage[conditionPanelName].uturaType)
conditionsWindow.Hold.UturaType.onOptionChange = function(widget)
storage[conditionPanelName].uturaType = widget:getCurrentOption().text
end
-- checkboxes
conditionsWindow.Cure.CurePoison:setChecked(storage[conditionPanelName].curePoison)
conditionsWindow.Cure.CurePoison.onClick = function(widget)
storage[conditionPanelName].curePoison = not storage[conditionPanelName].curePoison
widget:setChecked(storage[conditionPanelName].curePoison)
end
conditionsWindow.Cure.CureCurse:setChecked(storage[conditionPanelName].cureCurse)
conditionsWindow.Cure.CureCurse.onClick = function(widget)
storage[conditionPanelName].cureCurse = not storage[conditionPanelName].cureCurse
widget:setChecked(storage[conditionPanelName].cureCurse)
end
conditionsWindow.Cure.CureBleed:setChecked(storage[conditionPanelName].cureBleed)
conditionsWindow.Cure.CureBleed.onClick = function(widget)
storage[conditionPanelName].cureBleed = not storage[conditionPanelName].cureBleed
widget:setChecked(storage[conditionPanelName].cureBleed)
end
conditionsWindow.Cure.CureBurn:setChecked(storage[conditionPanelName].cureBurn)
conditionsWindow.Cure.CureBurn.onClick = function(widget)
storage[conditionPanelName].cureBurn = not storage[conditionPanelName].cureBurn
widget:setChecked(storage[conditionPanelName].cureBurn)
end
conditionsWindow.Cure.CureElectrify:setChecked(storage[conditionPanelName].cureElectrify)
conditionsWindow.Cure.CureElectrify.onClick = function(widget)
storage[conditionPanelName].cureElectrify = not storage[conditionPanelName].cureElectrify
widget:setChecked(storage[conditionPanelName].cureElectrify)
end
conditionsWindow.Cure.CureParalyse:setChecked(storage[conditionPanelName].cureParalyse)
conditionsWindow.Cure.CureParalyse.onClick = function(widget)
storage[conditionPanelName].cureParalyse = not storage[conditionPanelName].cureParalyse
widget:setChecked(storage[conditionPanelName].cureParalyse)
end
conditionsWindow.Hold.HoldHaste:setChecked(storage[conditionPanelName].holdHaste)
conditionsWindow.Hold.HoldHaste.onClick = function(widget)
storage[conditionPanelName].holdHaste = not storage[conditionPanelName].holdHaste
widget:setChecked(storage[conditionPanelName].holdHaste)
end
conditionsWindow.Hold.HoldUtamo:setChecked(storage[conditionPanelName].holdUtamo)
conditionsWindow.Hold.HoldUtamo.onClick = function(widget)
storage[conditionPanelName].holdUtamo = not storage[conditionPanelName].holdUtamo
widget:setChecked(storage[conditionPanelName].holdUtamo)
end
conditionsWindow.Hold.HoldUtana:setChecked(storage[conditionPanelName].holdUtana)
conditionsWindow.Hold.HoldUtana.onClick = function(widget)
storage[conditionPanelName].holdUtana = not storage[conditionPanelName].holdUtana
widget:setChecked(storage[conditionPanelName].holdUtana)
end
conditionsWindow.Hold.HoldUtura:setChecked(storage[conditionPanelName].holdUtura)
conditionsWindow.Hold.HoldUtura.onClick = function(widget)
storage[conditionPanelName].holdUtura = not storage[conditionPanelName].holdUtura
widget:setChecked(storage[conditionPanelName].holdUtura)
end
conditionsWindow.Hold.IgnoreInPz:setChecked(storage[conditionPanelName].ignoreInPz)
conditionsWindow.Hold.IgnoreInPz.onClick = function(widget)
storage[conditionPanelName].ignoreInPz = not storage[conditionPanelName].ignoreInPz
widget:setChecked(storage[conditionPanelName].ignoreInPz)
end
conditionsWindow.Hold.StopHaste:setChecked(storage[conditionPanelName].stopHaste)
conditionsWindow.Hold.StopHaste.onClick = function(widget)
storage[conditionPanelName].stopHaste = not storage[conditionPanelName].stopHaste
widget:setChecked(storage[conditionPanelName].stopHaste)
end
-- buttons
conditionsWindow.closeButton.onClick = function(widget)
conditionsWindow:hide()
end
end
local utanaCast = nil
macro(500, function()
if not storage[conditionPanelName].enabled or modules.game_cooldown.isGroupCooldownIconActive(2) then return end
if storage[conditionPanelName].curePoison and mana() >= storage[conditionPanelName].poisonCost and isPoisioned() then say("exana pox")
elseif storage[conditionPanelName].cureCurse and mana() >= storage[conditionPanelName].curseCost and isCursed() then say("exana mort")
elseif storage[conditionPanelName].cureBleed and mana() >= storage[conditionPanelName].bleedCost and isBleeding() then say("exana kor")
elseif storage[conditionPanelName].cureBurn and mana() >= storage[conditionPanelName].burnCost and isBurning() then say("exana flam")
elseif storage[conditionPanelName].cureElectrify and mana() >= storage[conditionPanelName].electrifyCost and isEnergized() then say("exana vis")
elseif (not storage[conditionPanelName].ignoreInPz or not isInPz()) and storage[conditionPanelName].holdUtura and mana() >= storage[conditionPanelName].uturaCost and not hasPartyBuff() then say(storage[conditionPanelName].uturaType)
elseif (not storage[conditionPanelName].ignoreInPz or not isInPz()) and storage[conditionPanelName].holdUtana and mana() >= storage[conditionPanelName].utanaCost and (not utanaCast or (now - utanaCast > 120000)) then say("utana vid") utanaCast = now
end
end)
macro(50, function()
if not storage[conditionPanelName].enabled then return end
if (not storage[conditionPanelName].ignoreInPz or not isInPz()) and storage[conditionPanelName].holdUtamo and mana() >= storage[conditionPanelName].utamoCost and not hasManaShield() then say("utamo vita")
elseif (not storage[conditionPanelName].ignoreInPz or not isInPz()) and storage[conditionPanelName].holdHaste and mana() >= storage[conditionPanelName].hasteCost and not hasHaste() and not getSpellCoolDown(storage[conditionPanelName].hasteSpell) and (not target() or not storage[conditionPanelName].stopHaste or TargetBot.isCaveBotActionAllowed()) then say(storage[conditionPanelName].hasteSpell)
elseif storage[conditionPanelName].cureParalyse and mana() >= storage[conditionPanelName].paralyseCost and isParalyzed() and not getSpellCoolDown(storage[conditionPanelName].paralyseSpell) then say(storage[conditionPanelName].paralyseSpell)
end
end)

View File

@ -1,889 +0,0 @@
-- Author: Vithrax
-- contains mostly basic function shortcuts and code shorteners
-- burst damage calculation, for function burstDamageValue()
local dmgTable = {}
local lastDmgMessage = now
onTextMessage(function(mode, text)
if not text:lower():find("you lose") or not text:lower():find("due to") then return end
local dmg = string.match(text, "%d+")
if #dmgTable > 0 then
for k, v in ipairs(dmgTable) do
if now - v.t > 3000 then
table.remove(dmgTable, k)
end
end
end
lastDmgMessage = now
table.insert(dmgTable, {d = dmg, t = now})
schedule(3050, function()
if now - lastDmgMessage > 3000 then
dmgTable = {} end
end)
end)
function whiteInfoMessage(text)
return modules.game_textmessage.displayGameMessage(text)
end
function burstDamageValue()
local d = 0
local time = 0
if #dmgTable > 1 then
for i, v in ipairs(dmgTable) do
if i == 1 then
time = v.t
end
d = d + v.d
end
end
return math.ceil(d/((now-time)/1000))
end
function scheduleNpcSay(text, delay)
if not text or not delay then return false end
return schedule(delay, function() NPC.say(text) end)
end
function getFirstNumberInText(text)
local n = 0
if string.match(text, "%d+") then
n = tonumber(string.match(text, "%d+"))
end
return n
end
function isOnTile(id, p1, p2, p3)
if not id then return end
local tile
if type(p1) == "table" then
tile = g_map.getTile(p1)
elseif type(p1) ~= "number" then
tile = p1
else
local p = getPos(p1, p2, p3)
tile = g_map.getTile(p)
end
if not tile then return end
local item = false
if #tile:getItems() ~= 0 then
for i,v in ipairs(tile:getItems()) do
if v:getId() == id then
item = true
end
end
else
return false
end
return item
end
function getPos(x,y,z)
if not x or not y or not z then return nil end
local pos = pos()
pos.x = x
pos.y = y
pos.z = z
return pos
end
function openPurse()
return g_game.use(g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse))
end
function containerIsFull(c)
if not c then return false end
if c:getCapacity() > #c:getItems() then
return false
else
return true
end
end
function isBuffed()
local var = false
for i=1,4 do
local premium = (player:getSkillLevel(i) - player:getSkillBaseLevel(i))
local base = player:getSkillBaseLevel(i)
if hasPartyBuff() and (premium/100)*305 > base then
var = true
end
end
return var
end
function reindexTable(t)
if not t or type(t) ~= "table" then return end
local i = 0
for _, e in pairs(t) do
i = i + 1
e.index = i
end
end
function killsToRs()
return math.min(g_game.getUnjustifiedPoints().killsDayRemaining, g_game.getUnjustifiedPoints().killsWeekRemaining, g_game.getUnjustifiedPoints().killsMonthRemaining)
end
-- [[ experimental healing cooldown calculation ]] --
storage.isUsingPotion = false
onTalk(function(name, level, mode, text, channelId, pos)
if name ~= player:getName() then return end
if mode ~= 34 then return end
if text == "Aaaah..." then
storage.isUsingPotion = true
schedule(950, function()
storage.isUsingPotion = false
end)
end
end)
-- [[ eof ]] --
-- [[ canCast and cast functions ]] --
SpellCastTable = {}
onTalk(function(name, level, mode, text, channelId, pos)
if name ~= player:getName() then return end
if SpellCastTable[text] then
SpellCastTable[text].t = now
end
end)
function cast(text, delay)
if type(text) ~= "string" then return end
if not delay or delay < 100 then
return say(text) -- if not added delay or delay is really low then just treat it like casual say
end
if not SpellCastTable[text] or SpellCastTable[text].d ~= delay then
SpellCastTable[text] = {t=now-delay,d=delay}
return say(text)
end
local lastCast = SpellCastTable[text].t
local spellDelay = SpellCastTable[text].d
if now - lastCast > spellDelay then
return say(text)
end
return
end
local Spells = modules.gamelib.SpellInfo['Default']
function canCast(spell, ignoreRL, ignoreCd)
if type(spell) ~= "string" then return end
spell = spell:lower()
if not getSpellData(spell) then
if SpellCastTable[spell] then
if now - SpellCastTable[spell].t > SpellCastTable[spell].d then
return true
else
return false
end
else
return true
end
end
if (ignoreCd or not getSpellCoolDown(spell)) and (ignoreRL or level() >= getSpellData(spell).level and mana() >= getSpellData(spell).mana) then
return true
else
return false
end
end
function getSpellData(spell)
if not spell then return false end
spell = spell:lower()
local t = nil
for k,v in pairs(Spells) do
if v.words == spell then
t = k
break
end
end
if t then
return Spells[t]
else
return false
end
end
function getSpellCoolDown(text)
if not text then return false end
text = text:lower()
if not getSpellData(text) then return false end
for i,v in pairs(Spells) do
if v.words == text then
return modules.game_cooldown.isCooldownIconActive(v.id)
end
end
end
storage.isUsing = false
onUse(function(pos, itemId, stackPos, subType)
if pos.x < 65000 then
storage.isUsing = true
end
schedule(1500, function() if storage.isUsing then storage.isUsing = false end end)
end)
onUseWith(function(pos, itemId, target, subType)
if itemId ~= 3180 then return end
if pos.x < 65000 then
storage.isUsing = true
end
schedule(1500, function() if storage.isUsing then storage.isUsing = false end end)
end)
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
local cachedFriends = {}
local cachedNeutrals = {}
local cachedEnemies = {}
function isFriend(c)
local name = c
if type(c) ~= "string" then
if c == player then return true end
name = c:getName()
if name == name() then return true end
end
if table.find(cachedFriends, c) then return true end
if table.find(cachedNeutrals, c) or table.find(cachedEnemies, c) then return false end
if table.find(storage.playerList.friendList, name) then
table.insert(cachedFriends, c)
return true
elseif string.find(storage.serverMembers, name) then
table.insert(cachedFriends, c)
return true
elseif storage.playerList.groupMembers then
local p = c
if type(c) == "string" then
p = getCreatureByName(c, true)
end
if p:isLocalPlayer() then return true end
if p:isPlayer() then
if ((p:getShield() >= 3 and p:getShield() <= 10) or p:getEmblem() == 2) then
table.insert(cachedFriends, c)
table.insert(cachedFriends, p)
return true
else
table.insert(cachedNeutrals, c)
table.insert(cachedNeutrals, p)
return false
end
end
else
table.insert(cachedNeutrals, c)
table.insert(cachedNeutrals, p)
return false
end
end
function isEnemy(name)
if not name then return false end
local p = getCreatureByName(name, true)
if p:isLocalPlayer() then return end
if p:isPlayer() and table.find(storage.playerList.enemyList, name) or (storage.playerList.marks and not isFriend(name)) then
return true
else
return false
end
end
function isAttSpell(expr)
if string.starts(expr, "exori") or string.starts(expr, "exevo") then
return true
else
return false
end
end
function getActiveItemId(id)
if not id then
return false
end
if id == 3049 then
return 3086
elseif id == 3050 then
return 3087
elseif id == 3051 then
return 3088
elseif id == 3052 then
return 3089
elseif id == 3053 then
return 3090
elseif id == 3091 then
return 3094
elseif id == 3092 then
return 3095
elseif id == 3093 then
return 3096
elseif id == 3097 then
return 3099
elseif id == 3098 then
return 3100
elseif id == 16114 then
return 16264
elseif id == 23531 then
return 23532
elseif id == 23533 then
return 23534
elseif id == 23529 then
return 23530
else
return id
end
end
function getInactiveItemId(id)
if not id then
return false
end
if id == 3086 then
return 3049
elseif id == 3087 then
return 3050
elseif id == 3088 then
return 3051
elseif id == 3089 then
return 3052
elseif id == 3090 then
return 3053
elseif id == 3094 then
return 3091
elseif id == 3095 then
return 3092
elseif id == 3096 then
return 3093
elseif id == 3099 then
return 3097
elseif id == 3100 then
return 3098
elseif id == 16264 then
return 16114
elseif id == 23532 then
return 23531
elseif id == 23534 then
return 23533
elseif id == 23530 then
return 23529
else
return id
end
end
function getMonstersInRange(pos, range)
if not pos or not range then
return false
end
local monsters = 0
for i, spec in pairs(getSpectators()) do
if spec:isMonster() and (g_game.getClientVersion() < 960 or spec:getType() < 3) and getDistanceBetween(pos, spec:getPosition()) < range then
monsters = monsters + 1
end
end
return monsters
end
function distanceFromPlayer(coords)
if not coords then
return false
end
return getDistanceBetween(pos(), coords)
end
function getMonsters(range, multifloor)
if not range then
range = 10
end
local mobs = 0;
for _, spec in pairs(getSpectators(multifloor)) do
mobs = (g_game.getClientVersion() < 960 or spec:getType() < 3) and spec:isMonster() and distanceFromPlayer(spec:getPosition()) <= range and mobs + 1 or mobs;
end
return mobs;
end
function getPlayers(range, multifloor)
if not range then
range = 10
end
local specs = 0;
for _, spec in pairs(getSpectators(multifloor)) do
specs = not spec:isLocalPlayer() and spec:isPlayer() and distanceFromPlayer(spec:getPosition()) <= range and not ((spec:getShield() >= 3 and spec:getShield() <= 10) or spec:getEmblem() == 1) and specs + 1 or specs;
end
return specs;
end
function isBlackListedPlayerInRange(range)
if #storage.playerList.blackList == 0 then return end
if not range then range = 10 end
local safe = false
for _, spec in pairs(getSpectators()) do
if spec:isPlayer() and distanceFromPlayer(spec:getPosition()) < range then
if table.find(storage.playerList.blackList, spec:getName()) then
safe = true
end
end
end
return safe
end
function isSafe(range, multifloor, padding)
local onSame = 0
local onAnother = 0
if not multifloor and padding then
multifloor = false
padding = false
end
for _, spec in pairs(getSpectators(multifloor)) do
if spec:isPlayer() and not spec:isLocalPlayer() and not isFriend(spec:getName()) then
if spec:getPosition().z == posz() and distanceFromPlayer(spec:getPosition()) <= range then
onSame = onSame + 1
end
if multifloor and padding and spec:getPosition().z ~= posz() and distanceFromPlayer(spec:getPosition()) <= (range + padding) then
onAnother = onAnother + 1
end
end
end
if onSame + onAnother > 0 then
return false
else
return true
end
end
function getAllPlayers(range, multifloor)
if not range then
range = 10
end
local specs = 0;
for _, spec in pairs(getSpectators(multifloor)) do
specs = not spec:isLocalPlayer() and spec:isPlayer() and distanceFromPlayer(spec:getPosition()) <= range and specs + 1 or specs;
end
return specs;
end
function getNpcs(range, multifloor)
if not range then
range = 10
end
local npcs = 0;
for _, spec in pairs(getSpectators(multifloor)) do
npcs = spec:isNpc() and distanceFromPlayer(spec:getPosition()) <= range and npcs + 1 or npcs;
end
return npcs;
end
function itemAmount(id)
local totalItemCount = 0
for _, container in pairs(getContainers()) do
for _, item in ipairs(container:getItems()) do
totalItemCount = item:getId() == id and totalItemCount + item:getCount() or totalItemCount
end
end
if getHead() and getHead():getId() == id then
totalItemCount = totalItemCount + getHead():getCount()
end
if getNeck() and getNeck():getId() == id then
totalItemCount = totalItemCount + getNeck():getCount()
end
if getBack() and getBack():getId() == id then
totalItemCount = totalItemCount + getBack():getCount()
end
if getBody() and getBody():getId() == id then
totalItemCount = totalItemCount + getBody():getCount()
end
if getRight() and getRight():getId() == id then
totalItemCount = totalItemCount + getRight():getCount()
end
if getLeft() and getLeft():getId() == id then
totalItemCount = totalItemCount + getLeft():getCount()
end
if getLeg() and getLeg():getId() == id then
totalItemCount = totalItemCount + getLeg():getCount()
end
if getFeet() and getFeet():getId() == id then
totalItemCount = totalItemCount + getFeet():getCount()
end
if getFinger() and getFinger():getId() == id then
totalItemCount = totalItemCount + getFinger():getCount()
end
if getAmmo() and getAmmo():getId() == id then
totalItemCount = totalItemCount + getAmmo():getCount()
end
return totalItemCount
end
function hasSupplies()
local items = {
{ID = storage.supplies.item1, minAmount = storage.supplies.item1Min},
{ID = storage.supplies.item2, minAmount = storage.supplies.item2Min},
{ID = storage.supplies.item3, minAmount = storage.supplies.item3Min},
{ID = storage.supplies.item4, minAmount = storage.supplies.item4Min},
{ID = storage.supplies.item5, minAmount = storage.supplies.item5Min},
{ID = storage.supplies.item6, minAmount = storage.supplies.item6Min},
{ID = storage.supplies.item7, minAmount = storage.supplies.item7Min}
}
-- false = no supplies
-- true = supplies available
local hasSupplies = true
for i, supply in pairs(items) do
if supply.min and supply.ID then
if supply.ID > 100 and itemAmount(supply.ID) < supply.min then
hasSupplies = false
end
end
end
return hasSupplies
end
function cordsToPos(x, y, z)
if not x or not y or not z then
return false
end
local tilePos = pos()
tilePos.x = x
tilePos.y = y
tilePos.z = z
return tilePos
end
function reachGroundItem(id)
if not id then return nil end
local targetTile
for _, tile in ipairs(g_map.getTiles(posz())) do
if tile:getTopUseThing():getId() == id then
targetTile = tile:getPosition()
end
end
if targetTile then
CaveBot.walkTo(targetTile, 10, {ignoreNonPathable = true, precision=1})
delay(500*getDistanceBetween(targetTile, pos()))
return true
else
return nil
end
end
function useGroundItem(id)
if not id then
return nil
end
local targetTile = nil
for _, tile in ipairs(g_map.getTiles(posz())) do
if tile:getTopUseThing():getId() == id then
targetTile = tile:getPosition()
end
end
if targetTile then
g_game.use(g_map.getTile(targetTile):getTopUseThing())
delay(500*getDistanceBetween(targetTile, pos()))
else
return nil
end
end
function target()
if not g_game.isAttacking() then
return
else
return g_game.getAttackingCreature()
end
end
function getTarget()
return target()
end
function targetPos(dist)
if not g_game.isAttacking() then
return
end
if dist then
return distanceFromPlayer(target():getPosition())
else
return target():getPosition()
end
end
-- for gunzodus
function reopenPurse()
for i, c in pairs(getContainers()) do
if c:getName():lower() == "loot bag" or c:getName():lower() == "store inbox" then
g_game.close(c)
end
end
schedule(100, function() g_game.use(g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse)) end)
schedule(1400, function()
for i, c in pairs(getContainers()) do
if c:getName():lower() == "store inbox" then
for _, i in pairs(c:getItems()) do
if i:getId() == 23721 then
g_game.open(i, c)
end
end
end
end
end)
return CaveBot.delay(1500)
end
-- getSpectator patterns
function getCreaturesInArea(param1, param2, param3)
-- param1 - pos/creature
-- param2 - pattern
-- param3 - type of return
-- 1 - everyone, 2 - monsters, 3 - players
local specs = 0
local monsters = 0
local players = 0
for i, spec in pairs(getSpectators(param1, param2)) do
if spec ~= player then
specs = specs + 1
if spec:isMonster() and (g_game.getClientVersion() < 960 or spec:getType() < 3) then
monsters = monsters + 1
elseif spec:isPlayer() and not isFriend(spec:getName()) then
players = players +1
end
end
end
if param3 == 1 then
return specs
elseif param3 == 2 then
return monsters
else
return players
end
end
function getBestTileByPatern(pattern, specType, maxDist, safe)
if not pattern or not specType then return end
if not maxDist then maxDist = 4 end
local bestTile = nil
local best = nil
-- best area tile to use
for _, tile in pairs(g_map.getTiles(posz())) do
if distanceFromPlayer(tile:getPosition()) <= maxDist then
local minimapColor = g_map.getMinimapColor(tile:getPosition())
local stairs = (minimapColor >= 210 and minimapColor <= 213)
if tile:canShoot() and tile:isWalkable() and not stairs then
if getCreaturesInArea(tile:getPosition(), pattern, specType) > 0 then
if (not safe or getCreaturesInArea(tile:getPosition(), pattern, 3) == 0) then
local candidate = {pos = tile, count = getCreaturesInArea(tile:getPosition(), pattern, specType)}
if not best or best.count <= candidate.count then
best = candidate
end
end
end
end
end
end
bestTile = best
if bestTile then
return bestTile
else
return false
end
end
function getContainerByName(name)
if type(name) ~= "string" then return nil end
local d = nil
for i, c in pairs(getContainers()) do
if c:getName():lower() == name:lower() then
d = c
break
end
end
return d
end
function getContainerByItem(id)
if type(name) ~= "number" then return nil end
local d = nil
for i, c in pairs(getContainers()) do
if c:getContainerItem():getId() == id then
d = c
break
end
end
return d
end
LargeUeArea = [[
0000001000000
0000011100000
0000111110000
0001111111000
0011111111100
0111111111110
1111111111111
0111111111110
0011111111100
0001111111000
0000111110000
0000011100000
0000001000000
]]
NormalUeAreaMs = [[
00000100000
00011111000
00111111100
01111111110
01111111110
11111111111
01111111110
01111111110
00111111100
00001110000
00000100000
]]
NormalUeAreaEd = [[
00000100000
00001110000
00011111000
00111111100
01111111110
11111111111
01111111110
00111111100
00011111000
00001110000
00000100000
]]
smallUeArea = [[
0011100
0111110
1111111
1111111
1111111
0111110
0011100
]]
largeRuneArea = [[
0011100
0111110
1111111
1111111
1111111
0111110
0011100
]]
adjacentArea = [[
111
101
111
]]
longBeamArea = [[
0000000N0000000
0000000N0000000
0000000N0000000
0000000N0000000
0000000N0000000
0000000N0000000
0000000N0000000
WWWWWWW0EEEEEEE
0000000S0000000
0000000S0000000
0000000S0000000
0000000S0000000
0000000S0000000
0000000S0000000
0000000S0000000
]]
shortBeamArea = [[
00000100000
00000100000
00000100000
00000100000
00000100000
EEEEE0WWWWW
00000S00000
00000S00000
00000S00000
00000S00000
00000S00000
]]
newWaveArea = [[
000NNNNN000
000NNNNN000
0000NNN0000
WW00NNN00EE
WWWW0N0EEEE
WWWWW0EEEEE
WWWW0S0EEEE
WW00SSS00EE
0000SSS0000
000SSSSS000
000SSSSS000
]]
bigWaveArea = [[
0000NNN0000
0000NNN0000
0000NNN0000
00000N00000
WWW00N00EEE
WWWWW0EEEEE
WWW00S00EEE
00000S00000
0000SSS0000
0000SSS0000
0000SSS0000
]]
smallWaveArea = [[
00NNN00
00NNN00
WW0N0EE
WWW0EEE
WW0S0EE
00SSS00
00SSS00
]]
diamondArrowArea = [[
01110
11111
11111
11111
01110
]]

View File

@ -1,7 +0,0 @@
local lastMove = now
onPlayerPositionChange(function(newPos, oldPos)
if now - lastMove > 13*60*1000 then
turn(math.random(0,3))
lastMove = now
end
end)

View File

@ -1,8 +0,0 @@
if player:getBlessings() == 0 then
say("!bless")
schedule(2000, function()
if player:getBlessings() == 0 then
warn("!! Blessings not bought !!")
end
end)
end

View File

@ -1,100 +0,0 @@
CaveBot.Extensions.BuySupplies = {}
CaveBot.Extensions.BuySupplies.setup = function()
CaveBot.registerAction("BuySupplies", "#C300FF", function(value, retries)
local item1Count = itemAmount(storage[suppliesPanelName].item1)
local item2Count = itemAmount(storage[suppliesPanelName].item2)
local item3Count = itemAmount(storage[suppliesPanelName].item3)
local item4Count = itemAmount(storage[suppliesPanelName].item4)
local item5Count = itemAmount(storage[suppliesPanelName].item5)
local item6Count = itemAmount(storage[suppliesPanelName].item6)
local item7Count = itemAmount(storage[suppliesPanelName].item7)
local possibleItems = {}
local val = string.split(value, ",")
local waitVal
if #val == 0 or #val > 2 then
warn("CaveBot[BuySupplies]: incorrect BuySupplies value")
return false
elseif #val == 2 then
waitVal = tonumber(val[2]:trim())
end
local npc = getCreatureByName(val[1]:trim())
if not npc then
print("CaveBot[BuySupplies]: NPC not found")
return false
end
if not waitVal and #val == 2 then
warn("CaveBot[BuySupplies]: incorrect delay values!")
elseif waitVal and #val == 2 then
delay(waitVal)
end
if retries > 50 then
print("CaveBot[BuySupplies]: Too many tries, can't buy")
return false
end
delay(200)
local pos = player:getPosition()
local npcPos = npc:getPosition()
if math.max(math.abs(pos.x - npcPos.x), math.abs(pos.y - npcPos.y)) > 3 then
CaveBot.walkTo(npcPos, 20, {ignoreNonPathable = true, precision=3})
delay(300)
return "retry"
end
local itemList = {
item1 = {ID = storage[suppliesPanelName].item1, maxAmount = storage[suppliesPanelName].item1Max, currentAmount = item1Count},
item2 = {ID = storage[suppliesPanelName].item2, maxAmount = storage[suppliesPanelName].item2Max, currentAmount = item2Count},
item3 = {ID = storage[suppliesPanelName].item3, maxAmount = storage[suppliesPanelName].item3Max, currentAmount = item3Count},
item4 = {ID = storage[suppliesPanelName].item4, maxAmount = storage[suppliesPanelName].item4Max, currentAmount = item4Count},
item5 = {ID = storage[suppliesPanelName].item5, maxAmount = storage[suppliesPanelName].item5Max, currentAmount = item5Count},
item6 = {ID = storage[suppliesPanelName].item6, maxAmount = storage[suppliesPanelName].item6Max, currentAmount = item6Count},
item7 = {ID = storage[suppliesPanelName].item7, maxAmount = storage[suppliesPanelName].item7Max, currentAmount = item7Count}
}
if not NPC.isTrading() then
NPC.say("hi")
schedule(500, function() NPC.say("trade") end)
return "retry"
end
-- get items from npc
local npcItems = NPC.getBuyItems()
for i,v in pairs(npcItems) do
table.insert(possibleItems, v.id)
end
for i, item in pairs(itemList) do
-- info(table.find(possibleItems, item["ID"]))
if item["ID"] and item["ID"] > 100 and table.find(possibleItems, item["ID"]) then
local amountToBuy = item["maxAmount"] - item["currentAmount"]
if amountToBuy > 100 then
for i=1, math.ceil(amountToBuy/100), 1 do
NPC.buy(item["ID"], math.min(100, amountToBuy))
print("CaveBot[BuySupplies]: bought " .. amountToBuy .. "x " .. item["ID"])
return "retry"
end
else
if amountToBuy > 0 then
NPC.buy(item["ID"], math.min(100, amountToBuy))
print("CaveBot[BuySupplies]: bought " .. amountToBuy .. "x " .. item["ID"])
return "retry"
end
end
end
end
print("CaveBot[BuySupplies]: bought everything, proceeding")
return true
end)
CaveBot.Editor.registerAction("buysupplies", "buy supplies", {
value="NPC name",
title="Buy Supplies",
description="NPC Name, delay(in ms, optional)",
})
end

View File

@ -1,27 +0,0 @@
CaveBot.Extensions.Depositer = {}
local ui
-- first function called, here you should setup your UI
CaveBot.Extensions.Depositer.setup = function()
--ui = UI.createWidget('Label')
--ui:setText("Depositer UI")
end
-- called when cavebot config changes, configData is a table but it can be nil
CaveBot.Extensions.Depositer.onConfigChange = function(configName, isEnabled, configData)
if not configData then return end
end
-- called when cavebot is saving config, should return table or nil
CaveBot.Extensions.Depositer.onSave = function()
return {}
end
-- bellow add you custom functions
-- this function can be used in cavebot function waypoint as: return Depositer.run(retries, prev)
-- there are 2 useful parameters - retries (number) and prev (true/false), check actions.lua to learn more
CaveBot.Extensions.Depositer.run = function(retries, prev)
return true
end

View File

@ -1,47 +0,0 @@
CaveBot.Extensions.OpenDoors = {}
CaveBot.Extensions.OpenDoors.setup = function()
CaveBot.registerAction("OpenDoors", "#00FFFF", function(value, retries)
local pos = regexMatch(value, "\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)")
if not pos[1] then
error("CaveBot[OpenDoors]: invalid value. It should be position (x,y,z), is: " .. value)
return false
end
if retries >= 5 then
print("CaveBot[OpenDoors]: too many tries, can't open doors")
return false -- tried 5 times, can't open
end
pos = {x=tonumber(pos[1][2]), y=tonumber(pos[1][3]), z=tonumber(pos[1][4])}
local doorTile
if not doorTile then
for i, tile in ipairs(g_map.getTiles(posz())) do
if tile:getPosition().x == pos.x and tile:getPosition().y == pos.y and tile:getPosition().z == pos.z then
doorTile = tile
end
end
end
if not doorTile then
return false
end
if not doorTile:isWalkable() then
use(doorTile:getTopUseThing())
return "retry"
else
print("CaveBot[OpenDoors]: possible to cross, proceeding")
return true
end
end)
CaveBot.Editor.registerAction("opendoors", "open doors", {
value=function() return posx() .. "," .. posy() .. "," .. posz() end,
title="Door position",
description="doors position (x,y,z)",
multiline=false,
validation="^\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)$"
})
end

View File

@ -1,31 +0,0 @@
CaveBot.Extensions.Supply = {}
local ui
-- first function called, here you should setup your UI
CaveBot.Extensions.Supply.setup = function()
--ui = UI.createWidget('SupplyItemList')
--local widget = UI.createWidget('SupplyItem', ui.list)
--widget.item.onItemChange = function(newItem)
--widget.fields.min.onTextChange = function(newText)
--widget.fields.max.onTextChange = function(newText)
--make it similar to UI.Container, so if there are no free slots, add another one, keep min 4 slots, check if value min/max is number after edit
end
-- called when cavebot config changes, configData is a table but it can be nil
CaveBot.Extensions.Supply.onConfigChange = function(configName, isEnabled, configData)
if not configData then return end
end
-- called when cavebot is saving config, should return table or nil
CaveBot.Extensions.Supply.onSave = function()
return {}
end
-- bellow add you custom functions
-- this function can be used in cavebot function waypoint as: return Supply.run(retries, prev)
-- there are 2 useful parameters - retries (number) and prev (true/false), check actions.lua to learn more
CaveBot.Extensions.Supply.run = function(retries, prev)
return true
end

View File

@ -1,72 +0,0 @@
SupplyItem < Panel
height: 34
BotItem
id: item
size: 32 32
anchors.left: parent.left
anchors.top: parent.top
margin-top: 1
Panel
id: fields
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: prev.right
anchors.right: parent.right
margin-left: 2
margin-right: 2
Label
id: minLabel
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.horizontalCenter
margin-right: 2
text-align: center
text: "Min"
Label
id: maxLabel
anchors.top: parent.top
anchors.left: parent.horizontalCenter
anchors.right: parent.right
margin-left: 2
text-align: center
text: "Max"
BotTextEdit
id: min
anchors.top: minLabel.bottom
anchors.left: minLabel.left
anchors.right: minLabel.right
text-align: center
text: 1
BotTextEdit
id: max
anchors.top: maxLabel.bottom
anchors.left: maxLabel.left
anchors.right: maxLabel.right
text-align: center
text: 100
SupplyItemList < Panel
height: 102
ScrollablePanel
id: list
anchors.fill: parent
vertical-scrollbar: scroll
margin-right: 7
layout:
type: verticalBox
cell-height: 34
BotSmallScrollBar
id: scroll
anchors.top: prev.top
anchors.bottom: prev.bottom
anchors.right: parent.right
step: 10
pixels-scroll: true

View File

@ -1,70 +0,0 @@
CaveBot.Extensions.SupplyCheck = {}
storage.supplyRetries = 0
CaveBot.Extensions.SupplyCheck.setup = function()
CaveBot.registerAction("supplyCheck", "#db5a5a", function(value)
local softCount = itemAmount(6529) + itemAmount(3549)
local totalItem1 = itemAmount(storage[suppliesPanelName].item1)
local totalItem2 = itemAmount(storage[suppliesPanelName].item2)
local totalItem3 = itemAmount(storage[suppliesPanelName].item3)
local totalItem4 = itemAmount(storage[suppliesPanelName].item4)
local totalItem5 = itemAmount(storage[suppliesPanelName].item5)
local totalItem6 = itemAmount(storage[suppliesPanelName].item6)
if storage.supplyRetries > 50 then
print("CaveBot[SupplyCheck]: Round limit reached, going back on refill.")
storage.supplyRetries = 0
return false
elseif (storage[suppliesPanelName].imbues and player:getSkillLevel(11) ~= 100) then
print("CaveBot[SupplyCheck]: Imbues ran out. Going on refill.")
storage.supplyRetries = 0
return false
elseif (storage[suppliesPanelName].staminaSwitch and stamina() < tonumber(storage[suppliesPanelName].staminaValue)) then
print("CaveBot[SupplyCheck]: Stamina ran out. Going on refill.")
storage.supplyRetries = 0
return false
elseif (softCount < 1 and storage[suppliesPanelName].SoftBoots) then
print("CaveBot[SupplyCheck]: No soft boots left. Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem1 < tonumber(storage[suppliesPanelName].item1Min) and storage[suppliesPanelName].item1 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item1 .. "(only " .. totalItem1 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem2 < tonumber(storage[suppliesPanelName].item2Min) and storage[suppliesPanelName].item2 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item2 .. "(only " .. totalItem2 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem3 < tonumber(storage[suppliesPanelName].item3Min) and storage[suppliesPanelName].item3 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item3 .. "(only " .. totalItem3 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem4 < tonumber(storage[suppliesPanelName].item4Min) and storage[suppliesPanelName].item4 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item4 .. "(only " .. totalItem4 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem5 < tonumber(storage[suppliesPanelName].item5Min) and storage[suppliesPanelName].item5 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item5 .. "(only " .. totalItem5 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (totalItem6 < tonumber(storage[suppliesPanelName].item6Min) and storage[suppliesPanelName].item6 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. storage[suppliesPanelName].item6 .. "(only " .. totalItem6 .. " left). Going on refill.")
storage.supplyRetries = 0
return false
elseif (freecap() < tonumber(storage[suppliesPanelName].capValue) and storage[suppliesPanelName].capSwitch) then
print("CaveBot[SupplyCheck]: Not enough capacity. Going on refill.")
storage.supplyRetries = 0
return false
else
print("CaveBot[SupplyCheck]: Enough supplies. Hunting. Round (" .. storage.supplyRetries .. "/50)")
storage.supplyRetries = storage.supplyRetries + 1
return CaveBot.gotoLabel(value)
end
end)
CaveBot.Editor.registerAction("supplycheck", "supply check", {
value="startHunt",
title="Supply check label",
description="Insert here hunting start label",
})
end

View File

@ -1,52 +0,0 @@
CaveBot.Extensions.Travel = {}
CaveBot.Extensions.Travel.setup = function()
CaveBot.registerAction("Travel", "#db5a5a", function(value, retries)
local data = string.split(value, ",")
local waitVal = 0
if #data < 2 or #data > 3 then
warn("CaveBot[Travel]: incorrect travel value!")
return false
elseif #data == 3 then
waitVal = tonumber(data[3]:trim())
end
if not waitVal then
warn("CaveBot[Travel]: incorrect travel delay value!")
return false
end
if retries > 5 then
print("CaveBot[Travel]: too many tries, can't travel")
return false
end
local npc = getCreatureByName(data[1]:trim())
if not npc then
print("CaveBot[Travel]: NPC not found, can't travel")
return false
end
local pos = player:getPosition()
local npcPos = npc:getPosition()
if math.max(math.abs(pos.x - npcPos.x), math.abs(pos.y - npcPos.y)) > 3 then
CaveBot.walkTo(npcPos, 20, {ignoreNonPathable = true, precision=3})
delay(300)
return "retry"
end
NPC.say("hi")
schedule(waitVal, function() NPC.say(data[2]:trim()) end)
schedule(2*waitVal, function() NPC.say("yes") end)
delay(3*waitVal)
print("CaveBot[Travel]: travel action finished")
return true
end)
CaveBot.Editor.registerAction("travel", "travel", {
value="NPC name, city",
title="Travel",
description="NPC name, City name, delay in ms(optional)",
})
end

View File

@ -1,22 +0,0 @@
if type(storage.killedCreatures) ~= "table" then
storage.killedCreatures = {}
end
local regex = "Loot of ([a-z])* ([a-z A-Z]*):"
local regex2 = "Loot of ([a-z A-Z]*):"
onTextMessage(function(mode, text)
if not text:lower():find("loot of") then return end
local monster
if #regexMatch(text, regex) == 1 and #regexMatch(text, regex)[1] == 3 then
monster = regexMatch(text, regex)[1][3]
else
monster = regexMatch(text, regex2)[1][2]
end
if storage.killedCreatures[monster] then
storage.killedCreatures[monster] = storage.killedCreatures[monster] + 1
else
storage.killedCreatures[monster] = 1
end
end)

View File

@ -1,41 +0,0 @@
-- Magic wall & Wild growth timer
-- config
local magicWallId = 2129
local magicWallTime = 20000
local wildGrowthId = 2130
local wildGrowthTime = 45000
-- script
local activeTimers = {}
onAddThing(function(tile, thing)
if not thing:isItem() then
return
end
local timer = 0
if thing:getId() == magicWallId then
timer = magicWallTime
elseif thing:getId() == wildGrowthId then
timer = wildGrowthTime
else
return
end
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
if not activeTimers[pos] or activeTimers[pos] < now then
activeTimers[pos] = now + timer
end
tile:setTimer(activeTimers[pos] - now)
end)
onRemoveThing(function(tile, thing)
if not thing:isItem() then
return
end
if (thing:getId() == magicWallId or thing:getId() == wildGrowthId) and tile:getGround() then
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
activeTimers[pos] = nil
tile:setTimer(0)
end
end)

View File

@ -1,23 +0,0 @@
onTalk(function(name, level, mode, text, channelId, pos)
if mode == 34 then
if string.find(text, "world will suffer for") then
say("Are you ever going to fight or do you prefer talking!")
elseif string.find(text, "feet when they see me") then
say("Even before they smell your breath?")
elseif string.find(text, "from this plane") then
say("Too bad you barely exist at all!")
elseif string.find(text, "ESDO LO") then
say("SEHWO ASIMO, TOLIDO ESD")
elseif string.find(text, "will soon rule this world") then
say("Excuse me but I still do not get the message!")
elseif string.find(text, "honourable and formidable") then
say("Then why are we fighting alone right now?")
elseif string.find(text, "appear like a worm") then
say("How appropriate, you look like something worms already got the better of!")
elseif string.find(text, "will be the end of mortal") then
say("Then let me show you the concept of mortality before it!")
elseif string.find(text, "virtues of chivalry") then
say("Dare strike up a Minnesang and you will receive your last accolade!")
end
end
end)

View File

@ -1,9 +0,0 @@
local m = macro(1000, "Floor Change Delay", function() end)
onPlayerPositionChange(function(x,y)
if m.isOff() then return end
if CaveBot.isOff() then return end
if x.z ~= y.z then
TargetBot.delay(500)
end
end)

View File

@ -1,40 +0,0 @@
-- config
storage.shovel = 9596
storage.rope = 9596
storage.machete = 9596
storage.scythe = 9596
local useId = {34847, 1764, 21051, 30823, 6264, 5282, 20453, 20454, 20474, 11708, 11705, 6257, 6256, 2772, 27260, 2773, 1632, 1633, 1948, 435, 6252, 6253, 5007, 4911, 1629, 1630, 5108, 5107, 5281, 1968, 435, 1948, 5542, 31116, 31120, 30742, 31115, 31118, 20474, 5737, 5736, 5734, 5733, 31202, 31228, 31199, 31200, 33262, 30824, 5125, 5126, 5116, 5117, 8257, 8258, 8255, 8256}
local shovelId = {606, 593, 867}
local ropeId = {17238, 12202, 12935, 386, 421, 21966, 14238}
local macheteId = {2130, 3696}
local scytheId = {3653}
setDefaultTab("Tools")
-- script
hotkey("space", "Use All", function()
if not modules.game_walking.wsadWalking then return end
for _, tile in pairs(g_map.getTiles(posz())) do
if distanceFromPlayer(tile:getPosition()) < 2 then
for _, item in pairs(tile:getItems()) do
-- use
if table.find(useId, item:getId()) then
use(item)
return
elseif table.find(shovelId, item:getId()) then
useWith(storage.shovel, item)
return
elseif table.find(ropeId, item:getId()) then
useWith(storage.rope, item)
return
elseif table.find(macheteId, item:getId()) then
useWith(storage.machete, item)
return
elseif table.find(scytheId, item:getId()) then
useWith(storage.scythe, item)
return
end
end
end
end
end)

View File

@ -1,15 +0,0 @@
setDefaultTab("Tools")
local reUseToggle = macro(1000, "Click ReUse", "`", function() end)
local excluded = {268, 237, 238, 23373, 266, 236, 239, 7643, 23375, 7642, 23374, 5908, 5942, storage.shovel, storage.rope, storage.machete}
onUseWith(function(pos, itemId, target, subType)
if reUseToggle.isOn() and not table.find(excluded, itemId) then
schedule(50, function()
item = findItem(itemId)
if item then
modules.game_interface.startUseWith(item)
end
end)
end
end)

View File

@ -1,48 +0,0 @@
setDefaultTab("Tools")
local hotkey = "PageUp"
local candidates = {}
local m = macro(20, "Hold Mwall", function()
if #candidates == 0 then return end
for _, tile in pairs(candidates) do
if tile:canShoot() then
useWith(3180, tile:getTopUseThing())
end
end
end)
onRemoveThing(function(tile, thing)
if m.isOff() then return end
if thing:getId() ~= 2129 then return end
if tile:getText():len() > 0 then
table.insert(candidates, tile)
useWith(3180, tile:getTopUseThing())
end
end)
onAddThing(function(tile, thing)
if m.isOff() then return end
if thing:getId() ~= 2129 then return end
if tile:getText():len() > 0 then
table.remove(candidates, table.find(candidates,tile))
end
end)
onKeyPress(function(keys)
if m.isOff() then return end
if keys ~= hotkey then return end
local tile = getTileUnderCursor()
if not tile then return end
if tile:getText():len() > 0 then
tile:setText("")
else
tile:setText("MARKED")
table.insert(candidates, tile)
end
end)

View File

@ -1,27 +0,0 @@
setDefaultTab("Tools")
local toggle = macro(1000, "mwall step", "F12",function() end)
onPlayerPositionChange(function(newPos, oldPos)
if oldPos.z ~= posz() then return end
if oldPos then
local tile = g_map.getTile(oldPos)
if toggle.isOn() and tile:isWalkable() then
useWith(3180, tile:getTopUseThing())
toggle.setOff()
end
end
end)
local toggle2 = macro(1000, "mwall on target", "F11",function() end)
onCreaturePositionChange(function(creature, newPos, oldPos)
if creature == target() or creature == g_game.getFollowingCreature() then
if oldPos and oldPos.z == posz() then
local tile2 = g_map.getTile(oldPos)
if toggle2.isOn() and tile2:isWalkable() then
useWith(3180, tile2:getTopUseThing())
toggle2.setOff()
end
end
end
end)

View File

@ -1,10 +0,0 @@
macro(50, function()
if not g_game.isAttacking() then return end
if target() and target():isNpc() then
NPC.say("hi")
NPC.say("trade")
end
delay(950)
end)

View File

@ -1,46 +0,0 @@
-- [[ script made by Ruu ]] --
-- [[ http://otclient.net/showthread.php?tid=358 ]] --
-- [[ small mod, added many doors id's and diagonal walking and switch ]] --
local wsadWalking = modules.game_walking.wsadWalking
local doorsIds = { 5007, 8265, 1629, 1632, 5129, 6252, 6249, 7715, 7712, 7714, 7719, 6256, 1669, 1672, 5125, 5115, 5124, 17701, 17710, 1642, 6260, 5107, 4912, 6251, 5291, 1683, 1696, 1692, 5006, 2179, 5116, 11705, 30772, 30774 }
setDefaultTab("Tools")
local m = macro(1000, "Auto open doors", function() end)
function checkForDoors(pos)
local tile = g_map.getTile(pos)
if tile then
local useThing = tile:getTopUseThing()
if useThing and table.find(doorsIds, useThing:getId()) then
g_game.use(useThing)
end
end
end
onKeyPress(function(keys)
if m.isOff() then return end
local pos = player:getPosition()
if keys == 'Up' or (wsadWalking and keys == 'W') then
pos.y = pos.y - 1
elseif keys == 'Down' or (wsadWalking and keys == 'S') then
pos.y = pos.y + 1
elseif keys == 'Left' or (wsadWalking and keys == 'A') then
pos.x = pos.x - 1
elseif keys == 'Right' or (wsadWalking and keys == 'D') then
pos.x = pos.x + 1
elseif wsadWalking and keys == "Q" then
pos.y = pos.y - 1
pos.x = pos.x - 1
elseif wsadWalking and keys == "E" then
pos.y = pos.y - 1
pos.x = pos.x + 1
elseif wsadWalking and keys == "Z" then
pos.y = pos.y + 1
pos.x = pos.x - 1
elseif wsadWalking and keys == "C" then
pos.y = pos.y + 1
pos.x = pos.x + 1
end
checkForDoors(pos)
end)

View File

@ -1,31 +0,0 @@
setDefaultTab("Cave")
UI.Separator()
local knifeBodies = {4272, 4173, 4011, 4025, 4047, 4052, 4057, 4062, 4112, 4212, 4321, 4324, 4327, 10352, 10356, 10360, 10364}
local stakeBodies = {4097, 4137, 8738, 18958}
local fishingBodies = {9582}
macro(500,"Stake Bodies", function()
if not CaveBot.isOn() then return end
for i, tile in ipairs(g_map.getTiles(posz())) do
for u,item in ipairs(tile:getItems()) do
if table.find(knifeBodies, item:getId()) and findItem(5908) then
CaveBot.delay(550)
useWith(5908, item)
return
end
if table.find(stakeBodies, item:getId()) and findItem(5942) then
CaveBot.delay(550)
useWith(5942, item)
return
end
if table.find(fishingBodies, item:getId()) and findItem(3483) then
CaveBot.delay(550)
useWith(3483, item)
return
end
end
end
end)

View File

@ -1,9 +0,0 @@
setDefaultTab("Cave")
macro(500, "TargetBot off if low supply", function()
if TargetBot.isOff() then return end
if CaveBot.isOff() then return end
if not hasSupplies() then
TargetBot.setOff()
end
end)

View File

@ -0,0 +1,57 @@
-- load all otui files, order doesn't matter
local configName = modules.game_bot.contentsPanel.config:getCurrentOption().text
local configFiles = g_resources.listDirectoryFiles("/bot/" .. configName .."/vBot/", true, false)
for i, file in ipairs(configFiles) do
local ext = file:split(".")
if ext[#ext]:lower() == "ui" or ext[#ext]:lower() == "otui" then
g_ui.importStyle(file)
end
end
local function loadScript(name)
return dofile("/vBot/" .. name .. ".lua")
end
-- here you can set manually order of scripts
-- libraries should be loaded first
local luaFiles = {
"main",
"vlib",
"new_cavebot_lib",
"configs", -- do not change this and above
"extras",
"playerlist",
"BotServer",
"alarms",
"Conditions",
"pushmax",
"combo",
"HealBot",
"Sio",
"AttackBot", -- last of major modules
"ingame_editor",
"items_management",
"quiver_manager",
"tools",
"antiRs",
"cavebot",
"depot_withdraw",
"eat_food",
"equip",
"exeta",
"info",
"items",
"jewellery_equipper",
"spy_level",
"supplies"
}
for i, file in ipairs(luaFiles) do
loadScript(file)
end
setDefaultTab("Main")
UI.Separator()
UI.Label("Private Scripts:")
UI.Separator()

View File

@ -40,26 +40,17 @@ CaveBot.Extensions.Bank.setup = function()
return false
end
local pos = player:getPosition()
local npcPos = npc:getPosition()
if math.max(math.abs(pos.x - npcPos.x), math.abs(pos.y - npcPos.y)) > 3 then
CaveBot.walkTo(npcPos, 20, {ignoreNonPathable = true, precision=3})
delay(300)
if not CaveBot.ReachNPC(npcName) then
return "retry"
end
if actionType == "deposit" then
NPC.say("hi")
schedule(waitVal, function() NPC.say("deposit all") end)
schedule(waitVal*2, function() NPC.say("yes") end)
CaveBot.delay(waitVal*3)
CaveBot.Conversation("hi", "deposit all", "yes")
CaveBot.delay(storage.extras.talkDelay*3)
return true
else
NPC.say("hi")
schedule(waitVal, function() NPC.say("withdraw") end)
schedule(waitVal*2, function() NPC.say(value) end)
schedule(waitVal*3, function() NPC.say("yes") end)
CaveBot.delay(waitVal*4)
CaveBot.Conversation("hi", "withdraw", value, "yes")
CaveBot.delay(storage.extras.talkDelay*4)
return true
end
end)

View File

@ -0,0 +1,87 @@
CaveBot.Extensions.BuySupplies = {}
CaveBot.Extensions.BuySupplies.setup = function()
CaveBot.registerAction("BuySupplies", "#C300FF", function(value, retries)
local supplies = SuppliesConfig[suppliesPanelName]
local item1Count = itemAmount(supplies.item1)
local item2Count = itemAmount(supplies.item2)
local item3Count = itemAmount(supplies.item3)
local item4Count = itemAmount(supplies.item4)
local item5Count = itemAmount(supplies.item5)
local item6Count = itemAmount(supplies.item6)
local item7Count = itemAmount(supplies.item7)
local possibleItems = {}
local val = string.split(value, ",")
local waitVal
if #val == 0 or #val > 2 then
warn("CaveBot[BuySupplies]: incorrect BuySupplies value")
return false
elseif #val == 2 then
waitVal = tonumber(val[2]:trim())
end
local npcName = val[1]:trim()
local npc = getCreatureByName(npcName)
if not npc then
print("CaveBot[BuySupplies]: NPC not found")
return false
end
if not waitVal and #val == 2 then
warn("CaveBot[BuySupplies]: incorrect delay values!")
elseif waitVal and #val == 2 then
delay(waitVal)
end
if retries > 50 then
print("CaveBot[BuySupplies]: Too many tries, can't buy")
return false
end
if not CaveBot.ReachNPC(npcName) then
return "retry"
end
local itemList = {
item1 = {ID = supplies.item1, maxAmount = supplies.item1Max, currentAmount = item1Count},
item2 = {ID = supplies.item2, maxAmount = supplies.item2Max, currentAmount = item2Count},
item3 = {ID = supplies.item3, maxAmount = supplies.item3Max, currentAmount = item3Count},
item4 = {ID = supplies.item4, maxAmount = supplies.item4Max, currentAmount = item4Count},
item5 = {ID = supplies.item5, maxAmount = supplies.item5Max, currentAmount = item5Count},
item6 = {ID = supplies.item6, maxAmount = supplies.item6Max, currentAmount = item6Count},
item7 = {ID = supplies.item7, maxAmount = supplies.item7Max, currentAmount = item7Count}
}
if not NPC.isTrading() then
CaveBot.OpenNpcTrade()
CaveBot.delay(storage.extras.talkDelay*2)
return "retry"
end
-- get items from npc
local npcItems = NPC.getBuyItems()
for i,v in pairs(npcItems) do
table.insert(possibleItems, v.id)
end
for i, item in pairs(itemList) do
if item["ID"] and item["ID"] > 100 and table.find(possibleItems, item["ID"]) then
local amountToBuy = item["maxAmount"] - item["currentAmount"]
if amountToBuy > 0 then
NPC.buy(item["ID"], math.min(100, amountToBuy))
print("CaveBot[BuySupplies]: bought " .. math.min(100, amountToBuy) .. "x " .. item["ID"])
return "retry"
end
end
end
print("CaveBot[BuySupplies]: bought everything, proceeding")
return true
end)
CaveBot.Editor.registerAction("buysupplies", "buy supplies", {
value="NPC name",
title="Buy Supplies",
description="NPC Name, delay(in ms, optional)",
})
end

View File

@ -2,18 +2,26 @@ CaveBot.Extensions.ClearTile = {}
CaveBot.Extensions.ClearTile.setup = function()
CaveBot.registerAction("ClearTile", "#00FFFF", function(value, retries)
local pos = regexMatch(value, "\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)")
if not pos[1] then
local data = string.split(value, ",")
local pos = {x=tonumber(data[1]), y=tonumber(data[2]), z=tonumber(data[3])}
local doors
if #data == 4 then
doors = true
end
if not #pos == 3 then
warn("CaveBot[ClearTile]: invalid value. It should be position (x,y,z), is: " .. value)
return false
end
if retries >= 20 then
print("CaveBot[ClearTile]: too many tries, can't open doors")
print("CaveBot[ClearTile]: too many tries, can't clear it")
return false -- tried 20 times, can't clear it
end
pos = {x=tonumber(pos[1][2]), y=tonumber(pos[1][3]), z=tonumber(pos[1][4])}
if getDistanceBetween(player:getPosition(), pos) == 0 then
print("CaveBot[ClearTile]: tile reached, proceeding")
return true
end
local tile = g_map.getTile(pos)
if not tile then
print("CaveBot[ClearTile]: can't find tile or tile is unreachable, skipping")
@ -21,16 +29,13 @@ CaveBot.Extensions.ClearTile.setup = function()
end
-- no items on tile and walkability means we are done
if tile:isWalkable() and tile:getTopUseThing():isNotMoveable() and not tile:hasCreature() then
if tile:isWalkable() and tile:getTopUseThing():isNotMoveable() and not tile:hasCreature() and not doors then
print("CaveBot[ClearTile]: tile clear, proceeding")
return true
end
local pPos = player:getPosition()
local tPos = tile:getPosition()
if math.max(math.abs(pPos.x - tPos.x), math.abs(pPos.y - tPos.y)) ~= 1 then
CaveBot.walkTo(tPos, 20, {ignoreNonPathable = true, precision=3})
delay(300)
if not CaveBot.MatchPosition(tPos, 3) then
CaveBot.GoTo(tPos, 3)
return "retry"
end
@ -43,7 +48,7 @@ CaveBot.Extensions.ClearTile.setup = function()
local c = tile:getCreatures()[1]
if c:isMonster() then
attack(c)
return "retry"
-- ok here we will find tile to push player, random
elseif c:isPlayer() then
local candidates = {}
@ -63,19 +68,24 @@ CaveBot.Extensions.ClearTile.setup = function()
end
end
end
if #tile:getItems() > 1 then
local item = tile:getTopUseThing()
print("CaveBot[ClearTile]: moving item... " .. item:getId().. " from tile")
g_game.move(item, pPos, item:getCount())
for i, item in ipairs(tile:getItems()) do
if not item:isNotMoveable() then
print("CaveBot[ClearTile]: moving item... " .. item:getId().. " from tile")
g_game.move(item, pPos, item:getCount())
return "retry"
end
end
if doors then
use(tile:getTopUseThing())
return "retry"
end
return "retry"
end)
CaveBot.Editor.registerAction("cleartile", "clear tile", {
value=function() return posx() .. "," .. posy() .. "," .. posz() end,
title="position of tile to clear",
description="tile position (x,y,z)",
multiline=false,
validation="^\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)$"
description="tile position (x,y,z), optional true if open doors",
multiline=false
})
end

View File

@ -150,7 +150,7 @@ CaveBot.Extensions.InWithdraw.setup = function()
local destination
for i, container in pairs(getContainers()) do
if container:getCapacity() > #container:getItems() and not string.find(container:getName():lower(), "depot") and not string.find(container:getName():lower(), "loot") and not string.find(container:getName():lower(), "inbox") then
if container:getCapacity() > #container:getItems() and not string.find(container:getName():lower(), "quiver") and not string.find(container:getName():lower(), "depot") and not string.find(container:getName():lower(), "loot") and not string.find(container:getName():lower(), "inbox") then
destination = container
end
end

View File

@ -1,7 +1,6 @@
CaveBot.Extensions.PosCheck = {}
storage.posCheckRetries = 0
local posCheckRetries = 0
CaveBot.Extensions.PosCheck.setup = function()
CaveBot.registerAction("PosCheck", "#00FFFF", function(value, retries)
local tilePos
@ -17,16 +16,16 @@ CaveBot.Extensions.PosCheck.setup = function()
tilePos.y = tonumber(data[4])
tilePos.z = tonumber(data[5])
if storage.posCheckRetries > 10 then
storage.posCheckRetries = 0
if posCheckRetries > 10 then
posCheckRetries = 0
print("CaveBot[CheckPos]: waypoints locked, too many tries, unclogging cavebot and proceeding")
return false
elseif (tilePos.z == player:getPosition().z) and (getDistanceBetween(player:getPosition(), tilePos) <= tonumber(data[2])) then
storage.posCheckRetries = 0
posCheckRetries = 0
print("CaveBot[CheckPos]: position reached, proceeding")
return true
else
storage.posCheckRetries = storage.posCheckRetries + 1
posCheckRetries = posCheckRetries + 1
CaveBot.gotoLabel(data[1])
print("CaveBot[CheckPos]: position not-reached, going back to label: " .. data[1])
return false
@ -36,7 +35,7 @@ CaveBot.Extensions.PosCheck.setup = function()
end)
CaveBot.Editor.registerAction("poscheck", "pos check", {
value=function() return "label" .. "," .. "distance" .. "," .. posx() .. "," .. posy() .. "," .. posz() end,
value=function() return "label" .. "," .. "10" .. "," .. posx() .. "," .. posy() .. "," .. posz() end,
title="Location Check",
description="label name, accepted dist from coordinates, x, y, z",
multiline=false,

View File

@ -1,6 +1,6 @@
CaveBot.Extensions.SellAll = {}
storage.sellAllCap = 0
local sellAllCap = 0
CaveBot.Extensions.SellAll.setup = function()
CaveBot.registerAction("SellAll", "#C300FF", function(value, retries)
local val = string.split(value, ",")
@ -16,7 +16,8 @@ CaveBot.Extensions.SellAll.setup = function()
wait = false
end
local npc = getCreatureByName(val[1])
local npcName = val[1]
local npc = getCreatureByName(npcName)
if not npc then
print("CaveBot[SellAll]: NPC not found! skipping")
return false
@ -27,27 +28,22 @@ CaveBot.Extensions.SellAll.setup = function()
return false
end
if freecap() == storage.sellAllCap then
storage.sellAllCap = 0
if freecap() == sellAllCap then
sellAllCap = 0
print("CaveBot[SellAll]: Sold everything, proceeding")
return true
end
delay(800)
local pos = player:getPosition()
local npcPos = npc:getPosition()
if math.max(math.abs(pos.x - npcPos.x), math.abs(pos.y - npcPos.y)) > 3 then
CaveBot.walkTo(npcPos, 20, {ignoreNonPathable = true, precision=3})
delay(300)
if not CaveBot.ReachNPC(npcName) then
return "retry"
end
if not NPC.isTrading() then
NPC.say("hi")
schedule(500, function() NPC.say("trade") end)
CaveBot.OpenNpcTrade()
delay(storage.extras.talkDelay*2)
else
storage.sellAllCap = freecap()
sellAllCap = freecap()
end
NPC.sellAll(wait)

View File

@ -0,0 +1,71 @@
CaveBot.Extensions.SupplyCheck = {}
SuppliesConfig.supplyRetries = 0
CaveBot.Extensions.SupplyCheck.setup = function()
CaveBot.registerAction("supplyCheck", "#db5a5a", function(value)
local supplies = SuppliesConfig[suppliesPanelName]
local softCount = itemAmount(6529) + itemAmount(3549)
local totalItem1 = itemAmount(supplies.item1)
local totalItem2 = itemAmount(supplies.item2)
local totalItem3 = itemAmount(supplies.item3)
local totalItem4 = itemAmount(supplies.item4)
local totalItem5 = itemAmount(supplies.item5)
local totalItem6 = itemAmount(supplies.item6)
if SuppliesConfig.supplyRetries > 50 then
print("CaveBot[SupplyCheck]: Round limit reached, going back on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (supplies.imbues and player:getSkillLevel(11) == 0) then
print("CaveBot[SupplyCheck]: Imbues ran out. Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (supplies.staminaSwitch and stamina() < tonumber(supplies.staminaValue)) then
print("CaveBot[SupplyCheck]: Stamina ran out. Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (softCount < 1 and supplies.SoftBoots) then
print("CaveBot[SupplyCheck]: No soft boots left. Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem1 < tonumber(supplies.item1Min) and supplies.item1 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item1 .. "(only " .. totalItem1 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem2 < tonumber(supplies.item2Min) and supplies.item2 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item2 .. "(only " .. totalItem2 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem3 < tonumber(supplies.item3Min) and supplies.item3 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item3 .. "(only " .. totalItem3 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem4 < tonumber(supplies.item4Min) and supplies.item4 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item4 .. "(only " .. totalItem4 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem5 < tonumber(supplies.item5Min) and supplies.item5 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item5 .. "(only " .. totalItem5 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (totalItem6 < tonumber(supplies.item6Min) and supplies.item6 > 100) then
print("CaveBot[SupplyCheck]: Not enough item: " .. supplies.item6 .. "(only " .. totalItem6 .. " left). Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
elseif (freecap() < tonumber(supplies.capValue) and supplies.capSwitch) then
print("CaveBot[SupplyCheck]: Not enough capacity. Going on refill.")
SuppliesConfig.supplyRetries = 0
return false
else
print("CaveBot[SupplyCheck]: Enough supplies. Hunting. Round (" .. SuppliesConfig.supplyRetries .. "/50)")
SuppliesConfig.supplyRetries = SuppliesConfig.supplyRetries + 1
return CaveBot.gotoLabel(value)
end
end)
CaveBot.Editor.registerAction("supplycheck", "supply check", {
value="startHunt",
title="Supply check label",
description="Insert here hunting start label",
})
end

View File

@ -6,7 +6,7 @@ local dataValidationFailed = function()
end
-- miniconfig
local talkDelay = 300 -- default delay between npc messages
local talkDelay = storage.extras.talkDelay
if not storage.caveBotTasker then
storage.caveBotTasker = {
inProgress = false,
@ -80,10 +80,7 @@ CaveBot.Extensions.Tasker.setup = function()
-- let's cover markers now
if marker == 1 then -- starting task
NPC.say("hi")
scheduleNpcSay("task", talkDelay)
scheduleNpcSay(taskName, talkDelay*2)
scheduleNpcSay("yes", talkDelay*3)
NPC.Conversation("hi", "task", taskName, "yes")
delay(talkDelay*4)
storage.caveBotTasker.monster = monster
@ -117,9 +114,7 @@ CaveBot.Extensions.Tasker.setup = function()
elseif marker == 3 then -- reporting task
NPC.say("hi")
scheduleNpcSay("report", talkDelay)
scheduleNpcSay("task", talkDelay*2)
NPC.Conversation("hi", "report", "task")
delay(talkDelay*3)
resetTaskData()

View File

@ -0,0 +1,40 @@
CaveBot.Extensions.Travel = {}
CaveBot.Extensions.Travel.setup = function()
CaveBot.registerAction("Travel", "#db5a5a", function(value, retries)
local data = string.split(value, ",")
if #data < 2 then
warn("CaveBot[Travel]: incorrect travel value!")
return false
end
local npcName = data[1]:trim()
local dest = data[2]:trim()
if retries > 5 then
print("CaveBot[Travel]: too many tries, can't travel")
return false
end
local npc = getCreatureByName(npcName)
if not npc then
print("CaveBot[Travel]: NPC not found, can't travel")
return false
end
if not CaveBot.ReachNPC(npcName) then
return "retry"
end
CaveBot.Travel(dest)
delay(storage.extras.talkDelay*3)
print("CaveBot[Travel]: travel action finished")
return true
end)
CaveBot.Editor.registerAction("travel", "travel", {
value="NPC name, city",
title="Travel",
description="NPC name, City name, delay in ms(default is 200ms)",
})
end

View File

@ -186,7 +186,7 @@ CaveBot.Extensions.Withdraw.setup = function()
local destination
for i, container in pairs(getContainers()) do
if container:getCapacity() > #container:getItems() and not string.find(container:getName():lower(), "depot") and not string.find(container:getName():lower(), "loot") and not string.find(container:getName():lower(), "inbox") then
if container:getCapacity() > #container:getItems() and not string.find(container:getName():lower(), "quiver") and not string.find(container:getName():lower(), "depot") and not string.find(container:getName():lower(), "loot") and not string.find(container:getName():lower(), "inbox") then
destination = container
end
end

View File

@ -1,3 +1,9 @@
local targetBotLure = false
local targetCount = 0
local delayValue = 0
local lureMax = 0
local delayedLure = false
TargetBot.Creature.attack = function(params, targets, isLooting) -- params {config, creature, danger, priority}
if player:isWalking() then
lastWalk = now
@ -63,9 +69,6 @@ TargetBot.Creature.attack = function(params, targets, isLooting) -- params {conf
end
end
if not storage.targetBotTargets then
storage.targetBotTargets = 0
end
TargetBot.Creature.walk = function(creature, config, targets)
local cpos = creature:getPosition()
local pos = player:getPosition()
@ -81,27 +84,27 @@ TargetBot.Creature.walk = function(creature, config, targets)
end
-- data for external dynamic lure
if config.lureMin and config.lureMax then
if config.lureMin and config.lureMax and config.dynamicLure then
if config.lureMin >= targets then
storage.TargetBotLure = true
targetBotLure = true
elseif targets >= config.lureMax then
storage.TargetBotLure = false
targetBotLure = false
end
end
storage.targetBotTargets = targets
storage.targetBotDynamicLureDelayValue = config.lureDelay
delayedLure = config.dynamicLureDelay
targetCount = targets
delayValue = config.lureDelay
if not storage.targetBotLureMax then
storage.targetBotLureMax = 0
end
if config.lureMax then
storage.targetBotLureMax = config.lureMax
lureMax = config.lureMax
end
-- luring
if TargetBot.canLure() and (config.lure or config.lureCavebot or config.dynamicLure) and not (config.chase and creature:getHealthPercent() < 5) and not isTrapped then
local monsters = 0
if storage.TargetBotLure then
if targetBotLure then
return TargetBot.allowCaveBot(150)
else
if targets < config.lureCount then
@ -175,8 +178,11 @@ end
onPlayerPositionChange(function(newPos, oldPos)
if CaveBot.isOff() then return end
if TargetBot.isOff() then return end
if not storage.targetBotLureMax then return end
if storage.targetBotTargets < storage.targetBotLureMax/2 or not target() then return end
if not lureMax then return end
if storage.TargetBotDelayWhenPlayer then return end
if not delayedLure then return end
CaveBot.delay(storage.targetBotDynamicLureDelayValue or 0)
if targetCount < lureMax/2 or not target() then return end
CaveBot.delay(delayValue or 0)
end)

View File

@ -94,4 +94,5 @@ TargetBot.Creature.edit = function(config, callback) -- callback = function(newC
addCheckBox("avoidAttacks", "Avoid wave attacks", false)
addCheckBox("dynamicLure", "Dynamic lure", false)
addCheckBox("dynamicLureDelay", "Dynamic lure delay", false)
addCheckBox("diamondArrows", "D-Arrows priority", false)
end

View File

@ -64,7 +64,7 @@ TargetBotCreatureEditorCheckBox < BotSwitch
TargetBotCreatureEditorWindow < MainWindow
text: TargetBot creature editor
width: 500
height: 400
height: 425
$mobile:
height: 300

View File

@ -18,9 +18,23 @@ TargetBot.Creature.calculatePriority = function(creature, config, path)
-- extra priority for close distance
local path_length = #path
if path_length == 1 then
priority = priority + 3
priority = priority + 10
elseif path_length <= 3 then
priority = priority + 1
priority = priority + 5
end
-- extra priority for paladin diamond arrows
if config.diamondArrows then
local mobCount = getCreaturesInArea(creature:getPosition(), diamondArrowArea, 2)
if mobCount > 5 then
priority = priority + 4
elseif mobCount > 4 then
priority = priority + 3
elseif mobCount > 3 then
priority = priority + 2
elseif mobCount > 2 then
priority = priority + 1
end
end
-- extra priority for low health

View File

@ -132,7 +132,8 @@ TargetBot.Looting.process = function(targets, dangerLevel)
local pos = player:getPosition()
local dist = math.max(math.abs(pos.x-loot.pos.x), math.abs(pos.y-loot.pos.y))
if loot.tries > 30 or loot.pos.z ~= pos.z or dist > 20 then
local maxRange = storage.extras.looting or 40
if loot.tries > 30 or loot.pos.z ~= pos.z or dist > maxRange then
table.remove(TargetBot.Looting.list, 1)
return true
end

View File

@ -3,7 +3,8 @@ local config = nil
local lastAction = 0
local cavebotAllowance = 0
local lureEnabled = true
storage.targebotDanger = 0
local dangerValue = 0
local looterStatus = ""
-- ui
local configWidget = UI.Config()
@ -69,8 +70,8 @@ targetbotMacro = macro(100, function()
-- looting
local looting = TargetBot.Looting.process(targets, dangerLevel)
local lootingStatus = TargetBot.Looting.getStatus()
storage.lootStatus = TargetBot.Looting.getStatus()
storage.targebotDanger = dangerLevel
looterStatus = TargetBot.Looting.getStatus()
dangerValue = dangerLevel
ui.danger.right:setText(dangerLevel)
if highestPriorityParams and not isInPz() then
@ -217,11 +218,11 @@ TargetBot.enableLuring = function()
end
TargetBot.Danger = function()
return storage.dangerLevel or 0
return dangerValue
end
TargetBot.lootStatus = function()
return storage.lootStatus or ""
return looterStatus
end

View File

@ -90,8 +90,8 @@ local pvpDedicated = false
local item = false
-- create blank profiles
if not storage[attackPanelName] or not storage[attackPanelName][1] or #storage[attackPanelName] ~= 5 then
storage[attackPanelName] = {
if not AttackBotConfig[attackPanelName] or not AttackBotConfig[attackPanelName][1] or #AttackBotConfig[attackPanelName] ~= 5 then
AttackBotConfig[attackPanelName] = {
[1] = {
enabled = false,
attackTable = {},
@ -170,15 +170,15 @@ if not storage[attackPanelName] or not storage[attackPanelName][1] or #storage[a
}
end
if not storage.currentBotProfile or storage.currentBotProfile == 0 or storage.currentBotProfile > 5 then
storage.currentBotProfile = 1
if not AttackBotConfig.currentBotProfile or AttackBotConfig.currentBotProfile == 0 or AttackBotConfig.currentBotProfile > 5 then
AttackBotConfig.currentBotProfile = 1
end
-- finding correct table, manual unfortunately
local currentSettings
local setActiveProfile = function()
local n = storage.currentBotProfile
currentSettings = storage[attackPanelName][n]
local n = AttackBotConfig.currentBotProfile
currentSettings = AttackBotConfig[attackPanelName][n]
end
setActiveProfile()
@ -188,7 +188,7 @@ end
local activeProfileColor = function()
for i=1,5 do
if i == storage.currentBotProfile then
if i == AttackBotConfig.currentBotProfile then
ui[i]:setColor("green")
else
ui[i]:setColor("white")
@ -252,6 +252,7 @@ local pattern = {
ui.title.onClick = function(widget)
currentSettings.enabled = not currentSettings.enabled
widget:setOn(currentSettings.enabled)
vBotConfigSave("atk")
end
ui.settings.onClick = function(widget)
@ -262,7 +263,7 @@ end
rootWidget = g_ui.getRootWidget()
if rootWidget then
attackWindow = g_ui.createWidget('AttackWindow', rootWidget)
attackWindow = UI.createWindow('AttackWindow', rootWidget)
attackWindow:hide()
-- functions
@ -325,6 +326,7 @@ if rootWidget then
--buttons
attackWindow.CloseButton.onClick = function(widget)
attackWindow:hide()
vBotConfigSave("atk")
end
local inputTypeToggle = function()
@ -467,7 +469,7 @@ if rootWidget then
child:destroy()
end
for _, entry in pairs(currentSettings.attackTable) do
local label = g_ui.createWidget("AttackEntry", attackWindow.attackList)
local label = UI.createWidget("AttackEntry", attackWindow.attackList)
label.enabled:setChecked(entry.enabled)
label.enabled.onClick = function(widget)
entry.enabled = not entry.enabled
@ -587,7 +589,7 @@ if rootWidget then
attackWindow.PvpMode:setChecked(currentSettings.pvpMode)
attackWindow.PvpSafe:setChecked(currentSettings.PvpSafe)
attackWindow.BlackListSafe:setChecked(currentSettings.BlackListSafe)
attackWindow.AntiRsRange:setValue(currentSettings.AntiRsRnage)
attackWindow.AntiRsRange:setValue(currentSettings.AntiRsRange)
end
loadSettings()
@ -595,13 +597,14 @@ if rootWidget then
setActiveProfile()
activeProfileColor()
loadSettings()
vBotConfigSave("atk")
end
-- profile buttons
for i=1,5 do
local button = ui[i]
button.onClick = function()
storage.currentBotProfile = i
AttackBotConfig.currentBotProfile = i
profileChange()
end
end
@ -612,7 +615,7 @@ if rootWidget then
currentSettings.ignoreMana = true
currentSettings.Kills = false
currentSettings.Rotate = false
currentSettings.name = "Profile #" .. storage.currentBotProfile
currentSettings.name = "Profile #" .. AttackBotConfig.currentBotProfile
currentSettings.Cooldown = true
currentSettings.Visible = true
currentSettings.pvpMode = false
@ -647,22 +650,24 @@ if rootWidget then
AttackBot.setOff = function()
currentSettings.enabled = false
ui.title:setOn(currentSettings.enabled)
vBotConfigSave("atk")
end
AttackBot.setOn = function()
currentSettings.enabled = true
ui.title:setOn(currentSettings.enabled)
vBotConfigSave("atk")
end
AttackBot.getActiveProfile = function()
return storage.currentBotProfile -- returns number 1-5
return AttackBotConfig.currentBotProfile -- returns number 1-5
end
AttackBot.setActiveProfile = function(n)
if not n or not tonumber(n) or n < 1 or n > 5 then
return error("[AttackBot] wrong profile parameter! should be 1 to 5 is " .. n)
else
storage.currentBotProfile = n
AttackBotConfig.currentBotProfile = n
profileChange()
end
end
@ -950,7 +955,7 @@ macro(100, function()
cast(entry.attack, entry.cd)
return
else
if not storage.isUsing and target():canShoot() then
if not AttackBotConfig.isUsing and target():canShoot() then
g_game.useInventoryItemWith(entry.attack, target())
return
end
@ -960,7 +965,7 @@ macro(100, function()
if entry.category == 6 or entry.category == 7 then
if getMonsters(4) >= entry.minMonsters then
if type(entry.attack) == "number" then
if not storage.isUsing then
if not AttackBotConfig.isUsing then
g_game.useInventoryItemWith(entry.attack, target())
return
end
@ -972,7 +977,7 @@ macro(100, function()
else
if (g_game.getClientVersion() < 960 or not currentSettings.Kills or killsToRs() > currentSettings.KillsAmount) and (not currentSettings.BlackListSafe or not isBlackListedPlayerInRange(currentSettings.AntiRsRange)) then
if entry.category == 8 then
bestTile = getBestTileByPatern(patterns[5], 2, entry.dist, not currentSettings.PvpSafe)
bestTile = getBestTileByPatern(patterns[5], 2, entry.dist, currentSettings.PvpSafe)
end
if entry.category == 4 and (not currentSettings.PvpSafe or isSafe(2, false)) and bestSide >= entry.minMonsters then
cast(entry.attack, entry.cd)
@ -987,7 +992,7 @@ macro(100, function()
cast(entry.attack, entry.cd)
return
elseif entry.category == 8 and bestTile and bestTile.count >= entry.minMonsters then
if not storage.isUsing then
if not AttackBotConfig.isUsing then
g_game.useInventoryItemWith(entry.attack, bestTile.pos:getTopUseThing())
end
return
@ -998,7 +1003,7 @@ macro(100, function()
if entry.category == 6 or entry.category == 7 then
if getMonsters(4) >= entry.minMonsters then
if type(entry.attack) == "number" then
if not storage.isUsing then
if not AttackBotConfig.isUsing then
g_game.useInventoryItemWith(entry.attack, target())
return
end
@ -1013,7 +1018,7 @@ macro(100, function()
if entry.category == 6 or entry.category == 7 then
if getMonsters(4) >= entry.minMonsters then
if type(entry.attack) == "number" then
if not storage.isUsing then
if not AttackBotConfig.isUsing then
g_game.useInventoryItemWith(entry.attack, target())
return
end

View File

@ -27,7 +27,6 @@ AttackEntry < Label
AttackWindow < MainWindow
!text: tr('AttackBot')
size: 800 350
@onEscape: self:hide()
TextList
id: attackList

View File

@ -122,7 +122,6 @@ onAddThing(function(tile, thing)
storage[BotPanelName].mwalls[pos] = now + 20000
BotServer.send("mwall", {pos=pos, duration=20000})
end
tile:setTimer(storage[BotPanelName].mwalls[pos] - now)
end
end
end)

View File

@ -0,0 +1,247 @@
setDefaultTab("HP")
local conditionPanelName = "ConditionPanel"
local ui = setupUI([[
Panel
height: 19
BotSwitch
id: title
anchors.top: parent.top
anchors.left: parent.left
text-align: center
width: 130
!text: tr('Conditions')
Button
id: conditionList
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
margin-left: 3
height: 17
text: Setup
]])
ui:setId(conditionPanelName)
if not HealBotConfig[conditionPanelName] then
HealBotConfig[conditionPanelName] = {
enabled = false,
curePosion = false,
poisonCost = 20,
cureCurse = false,
curseCost = 80,
cureBleed = false,
bleedCost = 45,
cureBurn = false,
burnCost = 30,
cureElectrify = false,
electrifyCost = 22,
cureParalyse = false,
paralyseCost = 40,
paralyseSpell = "utani hur",
holdHaste = false,
hasteCost = 40,
hasteSpell = "utani hur",
holdUtamo = false,
utamoCost = 40,
holdUtana = false,
utanaCost = 440,
holdUtura = false,
uturaType = "",
uturaCost = 100,
ignoreInPz = true,
stopHaste = false
}
end
ui.title:setOn(HealBotConfig[conditionPanelName].enabled)
ui.title.onClick = function(widget)
HealBotConfig[conditionPanelName].enabled = not HealBotConfig[conditionPanelName].enabled
widget:setOn(HealBotConfig[conditionPanelName].enabled)
vBotConfigSave("heal")
end
ui.conditionList.onClick = function(widget)
conditionsWindow:show()
conditionsWindow:raise()
conditionsWindow:focus()
end
local rootWidget = g_ui.getRootWidget()
if rootWidget then
conditionsWindow = UI.createWindow('ConditionsWindow', rootWidget)
conditionsWindow:hide()
-- text edits
conditionsWindow.Cure.PoisonCost:setText(HealBotConfig[conditionPanelName].poisonCost)
conditionsWindow.Cure.PoisonCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].poisonCost = tonumber(text)
end
conditionsWindow.Cure.CurseCost:setText(HealBotConfig[conditionPanelName].curseCost)
conditionsWindow.Cure.CurseCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].curseCost = tonumber(text)
end
conditionsWindow.Cure.BleedCost:setText(HealBotConfig[conditionPanelName].bleedCost)
conditionsWindow.Cure.BleedCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].bleedCost = tonumber(text)
end
conditionsWindow.Cure.BurnCost:setText(HealBotConfig[conditionPanelName].burnCost)
conditionsWindow.Cure.BurnCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].burnCost = tonumber(text)
end
conditionsWindow.Cure.ElectrifyCost:setText(HealBotConfig[conditionPanelName].electrifyCost)
conditionsWindow.Cure.ElectrifyCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].electrifyCost = tonumber(text)
end
conditionsWindow.Cure.ParalyseCost:setText(HealBotConfig[conditionPanelName].paralyseCost)
conditionsWindow.Cure.ParalyseCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].paralyseCost = tonumber(text)
end
conditionsWindow.Cure.ParalyseSpell:setText(HealBotConfig[conditionPanelName].paralyseSpell)
conditionsWindow.Cure.ParalyseSpell.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].paralyseSpell = text
end
conditionsWindow.Hold.HasteSpell:setText(HealBotConfig[conditionPanelName].hasteSpell)
conditionsWindow.Hold.HasteSpell.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].hasteSpell = text
end
conditionsWindow.Hold.HasteCost:setText(HealBotConfig[conditionPanelName].hasteCost)
conditionsWindow.Hold.HasteCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].hasteCost = tonumber(text)
end
conditionsWindow.Hold.UtamoCost:setText(HealBotConfig[conditionPanelName].utamoCost)
conditionsWindow.Hold.UtamoCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].utamoCost = tonumber(text)
end
conditionsWindow.Hold.UtanaCost:setText(HealBotConfig[conditionPanelName].utanaCost)
conditionsWindow.Hold.UtanaCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].utanaCost = tonumber(text)
end
conditionsWindow.Hold.UturaCost:setText(HealBotConfig[conditionPanelName].uturaCost)
conditionsWindow.Hold.UturaCost.onTextChange = function(widget, text)
HealBotConfig[conditionPanelName].uturaCost = tonumber(text)
end
-- combo box
conditionsWindow.Hold.UturaType:setOption(HealBotConfig[conditionPanelName].uturaType)
conditionsWindow.Hold.UturaType.onOptionChange = function(widget)
HealBotConfig[conditionPanelName].uturaType = widget:getCurrentOption().text
end
-- checkboxes
conditionsWindow.Cure.CurePoison:setChecked(HealBotConfig[conditionPanelName].curePoison)
conditionsWindow.Cure.CurePoison.onClick = function(widget)
HealBotConfig[conditionPanelName].curePoison = not HealBotConfig[conditionPanelName].curePoison
widget:setChecked(HealBotConfig[conditionPanelName].curePoison)
end
conditionsWindow.Cure.CureCurse:setChecked(HealBotConfig[conditionPanelName].cureCurse)
conditionsWindow.Cure.CureCurse.onClick = function(widget)
HealBotConfig[conditionPanelName].cureCurse = not HealBotConfig[conditionPanelName].cureCurse
widget:setChecked(HealBotConfig[conditionPanelName].cureCurse)
end
conditionsWindow.Cure.CureBleed:setChecked(HealBotConfig[conditionPanelName].cureBleed)
conditionsWindow.Cure.CureBleed.onClick = function(widget)
HealBotConfig[conditionPanelName].cureBleed = not HealBotConfig[conditionPanelName].cureBleed
widget:setChecked(HealBotConfig[conditionPanelName].cureBleed)
end
conditionsWindow.Cure.CureBurn:setChecked(HealBotConfig[conditionPanelName].cureBurn)
conditionsWindow.Cure.CureBurn.onClick = function(widget)
HealBotConfig[conditionPanelName].cureBurn = not HealBotConfig[conditionPanelName].cureBurn
widget:setChecked(HealBotConfig[conditionPanelName].cureBurn)
end
conditionsWindow.Cure.CureElectrify:setChecked(HealBotConfig[conditionPanelName].cureElectrify)
conditionsWindow.Cure.CureElectrify.onClick = function(widget)
HealBotConfig[conditionPanelName].cureElectrify = not HealBotConfig[conditionPanelName].cureElectrify
widget:setChecked(HealBotConfig[conditionPanelName].cureElectrify)
end
conditionsWindow.Cure.CureParalyse:setChecked(HealBotConfig[conditionPanelName].cureParalyse)
conditionsWindow.Cure.CureParalyse.onClick = function(widget)
HealBotConfig[conditionPanelName].cureParalyse = not HealBotConfig[conditionPanelName].cureParalyse
widget:setChecked(HealBotConfig[conditionPanelName].cureParalyse)
end
conditionsWindow.Hold.HoldHaste:setChecked(HealBotConfig[conditionPanelName].holdHaste)
conditionsWindow.Hold.HoldHaste.onClick = function(widget)
HealBotConfig[conditionPanelName].holdHaste = not HealBotConfig[conditionPanelName].holdHaste
widget:setChecked(HealBotConfig[conditionPanelName].holdHaste)
end
conditionsWindow.Hold.HoldUtamo:setChecked(HealBotConfig[conditionPanelName].holdUtamo)
conditionsWindow.Hold.HoldUtamo.onClick = function(widget)
HealBotConfig[conditionPanelName].holdUtamo = not HealBotConfig[conditionPanelName].holdUtamo
widget:setChecked(HealBotConfig[conditionPanelName].holdUtamo)
end
conditionsWindow.Hold.HoldUtana:setChecked(HealBotConfig[conditionPanelName].holdUtana)
conditionsWindow.Hold.HoldUtana.onClick = function(widget)
HealBotConfig[conditionPanelName].holdUtana = not HealBotConfig[conditionPanelName].holdUtana
widget:setChecked(HealBotConfig[conditionPanelName].holdUtana)
end
conditionsWindow.Hold.HoldUtura:setChecked(HealBotConfig[conditionPanelName].holdUtura)
conditionsWindow.Hold.HoldUtura.onClick = function(widget)
HealBotConfig[conditionPanelName].holdUtura = not HealBotConfig[conditionPanelName].holdUtura
widget:setChecked(HealBotConfig[conditionPanelName].holdUtura)
end
conditionsWindow.Hold.IgnoreInPz:setChecked(HealBotConfig[conditionPanelName].ignoreInPz)
conditionsWindow.Hold.IgnoreInPz.onClick = function(widget)
HealBotConfig[conditionPanelName].ignoreInPz = not HealBotConfig[conditionPanelName].ignoreInPz
widget:setChecked(HealBotConfig[conditionPanelName].ignoreInPz)
end
conditionsWindow.Hold.StopHaste:setChecked(HealBotConfig[conditionPanelName].stopHaste)
conditionsWindow.Hold.StopHaste.onClick = function(widget)
HealBotConfig[conditionPanelName].stopHaste = not HealBotConfig[conditionPanelName].stopHaste
widget:setChecked(HealBotConfig[conditionPanelName].stopHaste)
end
-- buttons
conditionsWindow.closeButton.onClick = function(widget)
conditionsWindow:hide()
vBotConfigSave("heal")
end
end
local utanaCast = nil
macro(500, function()
if not HealBotConfig[conditionPanelName].enabled or modules.game_cooldown.isGroupCooldownIconActive(2) then return end
if hppercent() > 95 then
if HealBotConfig[conditionPanelName].curePoison and mana() >= HealBotConfig[conditionPanelName].poisonCost and isPoisioned() then say("exana pox")
elseif HealBotConfig[conditionPanelName].cureCurse and mana() >= HealBotConfig[conditionPanelName].curseCost and isCursed() then say("exana mort")
elseif HealBotConfig[conditionPanelName].cureBleed and mana() >= HealBotConfig[conditionPanelName].bleedCost and isBleeding() then say("exana kor")
elseif HealBotConfig[conditionPanelName].cureBurn and mana() >= HealBotConfig[conditionPanelName].burnCost and isBurning() then say("exana flam")
elseif HealBotConfig[conditionPanelName].cureElectrify and mana() >= HealBotConfig[conditionPanelName].electrifyCost and isEnergized() then say("exana vis")
end
end
if (not HealBotConfig[conditionPanelName].ignoreInPz or not isInPz()) and HealBotConfig[conditionPanelName].holdUtura and mana() >= HealBotConfig[conditionPanelName].uturaCost and not hasPartyBuff() then say(HealBotConfig[conditionPanelName].uturaType)
elseif (not HealBotConfig[conditionPanelName].ignoreInPz or not isInPz()) and HealBotConfig[conditionPanelName].holdUtana and mana() >= HealBotConfig[conditionPanelName].utanaCost and (not utanaCast or (now - utanaCast > 120000)) then say("utana vid") utanaCast = now
end
end)
macro(50, function()
if not HealBotConfig[conditionPanelName].enabled then return end
if (not HealBotConfig[conditionPanelName].ignoreInPz or not isInPz()) and HealBotConfig[conditionPanelName].holdUtamo and mana() >= HealBotConfig[conditionPanelName].utamoCost and not hasManaShield() then say("utamo vita")
elseif (not HealBotConfig[conditionPanelName].ignoreInPz or not isInPz()) and HealBotConfig[conditionPanelName].holdHaste and mana() >= HealBotConfig[conditionPanelName].hasteCost and not hasHaste() and not getSpellCoolDown(HealBotConfig[conditionPanelName].hasteSpell) and (not target() or not HealBotConfig[conditionPanelName].stopHaste or TargetBot.isCaveBotActionAllowed()) then say(HealBotConfig[conditionPanelName].hasteSpell)
elseif HealBotConfig[conditionPanelName].cureParalyse and mana() >= HealBotConfig[conditionPanelName].paralyseCost and isParalyzed() and not getSpellCoolDown(HealBotConfig[conditionPanelName].paralyseSpell) then say(HealBotConfig[conditionPanelName].paralyseSpell)
end
end)

View File

@ -377,7 +377,6 @@ HoldConditions < Panel
ConditionsWindow < MainWindow
!text: tr('Condition Manager')
size: 445 280
@onEscape: self:hide()
CureConditions
id: Cure

View File

@ -75,8 +75,8 @@ Panel
]])
ui:setId(healPanelName)
if not storage[healPanelName] or not storage[healPanelName][1] or #storage[healPanelName] ~= 5 then
storage[healPanelName] = {
if not HealBotConfig[healPanelName] or not HealBotConfig[healPanelName][1] or #HealBotConfig[healPanelName] ~= 5 then
HealBotConfig[healPanelName] = {
[1] = {
enabled = false,
spellTable = {},
@ -140,21 +140,21 @@ if not storage[healPanelName] or not storage[healPanelName][1] or #storage[healP
}
end
if not storage.currentHealBotProfile or storage.currentHealBotProfile == 0 or storage.currentHealBotProfile > 5 then
storage.currentHealBotProfile = 1
if not HealBotConfig.currentHealBotProfile or HealBotConfig.currentHealBotProfile == 0 or HealBotConfig.currentHealBotProfile > 5 then
HealBotConfig.currentHealBotProfile = 1
end
-- finding correct table, manual unfortunately
local currentSettings
local setActiveProfile = function()
local n = storage.currentHealBotProfile
currentSettings = storage[healPanelName][n]
local n = HealBotConfig.currentHealBotProfile
currentSettings = HealBotConfig[healPanelName][n]
end
setActiveProfile()
local activeProfileColor = function()
for i=1,5 do
if i == storage.currentHealBotProfile then
if i == HealBotConfig.currentHealBotProfile then
ui[i]:setColor("green")
else
ui[i]:setColor("white")
@ -167,6 +167,7 @@ ui.title:setOn(currentSettings.enabled)
ui.title.onClick = function(widget)
currentSettings.enabled = not currentSettings.enabled
widget:setOn(currentSettings.enabled)
vBotConfigSave("heal")
end
ui.settings.onClick = function(widget)
@ -177,7 +178,7 @@ end
rootWidget = g_ui.getRootWidget()
if rootWidget then
healWindow = g_ui.createWidget('HealWindow', rootWidget)
healWindow = UI.createWindow('HealWindow', rootWidget)
healWindow:hide()
local setProfileName = function()
@ -218,7 +219,7 @@ if rootWidget then
child:destroy()
end
for _, entry in pairs(currentSettings.spellTable) do
local label = g_ui.createWidget("SpellEntry", healWindow.spells.spellList)
local label = UI.createWidget("SpellEntry", healWindow.spells.spellList)
label.enabled:setChecked(entry.enabled)
label.enabled.onClick = function(widget)
entry.enabled = not entry.enabled
@ -241,7 +242,7 @@ if rootWidget then
child:destroy()
end
for _, entry in pairs(currentSettings.itemTable) do
local label = g_ui.createWidget("SpellEntry", healWindow.items.itemList)
local label = UI.createWidget("SpellEntry", healWindow.items.itemList)
label.enabled:setChecked(entry.enabled)
label.enabled.onClick = function(widget)
entry.enabled = not entry.enabled
@ -462,6 +463,7 @@ if rootWidget then
healWindow.closeButton.onClick = function(widget)
healWindow:hide()
vBotConfigSave("heal")
end
local loadSettings = function()
@ -483,6 +485,7 @@ if rootWidget then
setActiveProfile()
activeProfileColor()
loadSettings()
vBotConfigSave("heal")
end
local resetSettings = function()
@ -495,14 +498,14 @@ if rootWidget then
currentSettings.MessageDelay = false
currentSettings.Interval = true
currentSettings.Conditions = true
currentSettings.name = "Profile #" .. storage.currentBotProfile
currentSettings.name = "Profile #" .. HealBotConfig.currentBotProfile
end
-- profile buttons
for i=1,5 do
local button = ui[i]
button.onClick = function()
storage.currentHealBotProfile = i
HealBotConfig.currentHealBotProfile = i
profileChange()
end
end
@ -527,22 +530,24 @@ if rootWidget then
HealBot.setOff = function()
currentSettings.enabled = false
ui.title:setOn(currentSettings.enabled)
vBotConfigSave("atk")
end
HealBot.setOn = function()
currentSettings.enabled = true
ui.title:setOn(currentSettings.enabled)
vBotConfigSave("atk")
end
HealBot.getActiveProfile = function()
return storage.currentHealBotProfile -- returns number 1-5
return HealBotConfig.currentHealBotProfile -- returns number 1-5
end
HealBot.setActiveProfile = function(n)
if not n or not tonumber(n) or n < 1 or n > 5 then
return error("[HealBot] wrong profile parameter! should be 1 to 5 is " .. n)
else
storage.currentHealBotProfile = n
HealBotConfig.currentHealBotProfile = n
profileChange()
end
end
@ -553,7 +558,7 @@ macro(100, function()
if not currentSettings.enabled or modules.game_cooldown.isGroupCooldownIconActive(2) or #currentSettings.spellTable == 0 then return end
for _, entry in pairs(currentSettings.spellTable) do
if canCast(entry.spell, not currentSettings.Conditions, currentSettings.Cooldown) and entry.enabled and entry.cost < mana() then
if canCast(entry.spell, not currentSettings.Conditions, not currentSettings.Cooldown) and entry.enabled and entry.cost < mana() then
if entry.origin == "HP%" then
if entry.sign == "=" and hppercent() == entry.value then
say(entry.spell)
@ -617,8 +622,8 @@ end)
-- items
macro(100, function()
if not currentSettings.enabled or #currentSettings.itemTable == 0 then return end
if currentSettings.Delay and storage.isUsing then return end
if currentSettings.MessageDelay and storage.isUsingPotion then return end
if currentSettings.Delay and HealBotConfig.isUsing then return end
if currentSettings.MessageDelay and HealBotConfig.isUsingPotion then return end
if not currentSettings.MessageDelay then
delay(400)

View File

@ -285,7 +285,6 @@ ItemHealing < Panel
HealWindow < MainWindow
!text: tr('Self Healer')
size: 800 350
@onEscape: self:hide()
SpellHealing
id: spells

View File

@ -38,7 +38,7 @@ Panel
rootWidget = g_ui.getRootWidget()
sioListWindow = g_ui.createWidget('SioListWindow', rootWidget)
sioListWindow = UI.createWindow('SioListWindow', rootWidget)
sioListWindow:hide()
ui.title:setOn(storage[panelName].enabled)

View File

@ -46,7 +46,7 @@ end
rootWidget = g_ui.getRootWidget()
if rootWidget then
alarmsWindow = g_ui.createWidget('AlarmsWindow', rootWidget)
alarmsWindow = UI.createWindow('AlarmsWindow', rootWidget)
alarmsWindow:hide()
alarmsWindow.closeButton.onClick = function(widget)

View File

@ -5,12 +5,10 @@ local cavebotTab = "Cave"
local targetingTab = "Target"
setDefaultTab(cavebotTab)
CaveBot = {} -- global namespace
CaveBot.Extensions = {}
importStyle("/cavebot/cavebot.otui")
importStyle("/cavebot/config.otui")
importStyle("/cavebot/editor.otui")
importStyle("/cavebot/supply.otui")
dofile("/cavebot/actions.lua")
dofile("/cavebot/config.lua")
dofile("/cavebot/editor.lua")
@ -23,8 +21,6 @@ dofile("/cavebot/sell_all.lua")
dofile("/cavebot/depositor.lua")
dofile("/cavebot/buy_supplies.lua")
dofile("/cavebot/d_withdraw.lua")
dofile("/cavebot/depositer.lua")
dofile("/cavebot/supply.lua")
dofile("/cavebot/supply_check.lua")
dofile("/cavebot/travel.lua")
dofile("/cavebot/doors.lua")
@ -33,8 +29,6 @@ dofile("/cavebot/withdraw.lua")
dofile("/cavebot/inbox_withdraw.lua")
dofile("/cavebot/lure.lua")
dofile("/cavebot/bank.lua")
dofile("/cavebot/depositer.lua")
dofile("/cavebot/supply.lua")
dofile("/cavebot/clear_tile.lua")
dofile("/cavebot/tasker.lua")
-- main cavebot file, must be last

View File

@ -1,3 +1,4 @@
setDefaultTab("Main")
ComboPanelName = "combobot"
local ui = setupUI([[
Panel
@ -63,7 +64,7 @@ end
rootWidget = g_ui.getRootWidget()
if rootWidget then
comboWindow = g_ui.createWidget('ComboWindow', rootWidget)
comboWindow = UI.createWindow('ComboWindow', rootWidget)
comboWindow:hide()
-- bot item

View File

@ -0,0 +1,82 @@
-- [[ test config part ]] --
configName = modules.game_bot.contentsPanel.config:getCurrentOption().text
-- make vBot config dir
if not g_resources.directoryExists("/bot/".. configName .."/vBot_configs/") then
g_resources.makeDir("/bot/".. configName .."/vBot_configs/")
end
HealBotConfig = {}
local healBotFile = "/bot/" .. configName .. "/vBot_configs/".. name() .. " HealBot.json"
AttackBotConfig = {}
local attackBotFile = "/bot/" .. configName .. "/vBot_configs/".. name() .. " AttackBot.json"
SuppliesConfig = {}
local suppliesFile = "/bot/" .. configName .. "/vBot_configs/".. name() .. " Supplies.json"
--healbot
if g_resources.fileExists(healBotFile) then
local status, result = pcall(function()
return json.decode(g_resources.readFileContents(healBotFile))
end)
if not status then
return onError("Error while reading config file (" .. healBotFile .. "). To fix this problem you can delete HealBot.json. Details: " .. result)
end
HealBotConfig = result
end
--attackbot
if g_resources.fileExists(attackBotFile) then
local status, result = pcall(function()
return json.decode(g_resources.readFileContents(attackBotFile))
end)
if not status then
return onError("Error while reading config file (" .. attackBotFile .. "). To fix this problem you can delete HealBot.json. Details: " .. result)
end
AttackBotConfig = result
end
--supplies
if g_resources.fileExists(suppliesFile) then
local status, result = pcall(function()
return json.decode(g_resources.readFileContents(suppliesFile))
end)
if not status then
return onError("Error while reading config file (" .. suppliesFile .. "). To fix this problem you can delete HealBot.json. Details: " .. result)
end
SuppliesConfig = result
end
function vBotConfigSave(file)
-- file can be either
--- heal
--- atk
--- supply
local configFile
local configTable
if not file then return end
file = file:lower()
if file == "heal" then
configFile = healBotFile
configTable = HealBotConfig
elseif file == "atk" then
configFile = attackBotFile
configTable = AttackBotConfig
elseif file == "supply" then
configFile = suppliesFile
configTable = SuppliesConfig
end
local status, result = pcall(function()
return json.encode(configTable, 2)
end)
if not status then
return onError("Error while saving config. it won't be saved. Details: " .. result)
end
if result:len() > 100 * 1024 * 1024 then
return onError("config file is too big, above 100MB, it won't be saved")
end
g_resources.writeFileContents(configFile, result)
end

View File

@ -0,0 +1,434 @@
setDefaultTab("Main")
-- securing storage namespace
panelName = "extras"
if not storage[panelName] then
storage[panelName] = {}
end
local settings = storage[panelName]
-- basic elements
extrasWindow = UI.createWindow('ExtrasWindow', rootWidget)
extrasWindow:hide()
extrasWindow.closeButton.onClick = function(widget)
extrasWindow:hide()
end
-- available options for dest param
local rightPanel = extrasWindow.content.right
local leftPanel = extrasWindow.content.left
-- objects made by Kondrah - taken from creature editor, minor changes to adapt
local addCheckBox = function(id, title, defaultValue, dest)
local widget = UI.createWidget('ExtrasCheckBox', dest)
widget.onClick = function()
widget:setOn(not widget:isOn())
settings[id] = widget:isOn()
end
widget:setText(title)
if settings[id] == nil then
widget:setOn(defaultValue)
else
widget:setOn(settings[id])
end
settings[id] = widget:isOn()
end
local addItem = function(id, title, defaultItem, dest)
local widget = UI.createWidget('ExtrasItem', dest)
widget.text:setText(title)
widget.item:setItemId(settings[id] or defaultItem)
widget.item.onItemChange = function(widget)
settings[id] = widget:getItemId()
end
settings[id] = settings[id] or defaultItem
end
local addTextEdit = function(id, title, defaultValue, dest)
local widget = UI.createWidget('ExtrasTextEdit', dest)
widget.text:setText(title)
widget.textEdit:setText(settings[id] or defaultValue or "")
widget.textEdit.onTextChange = function(widget,text)
settings[id] = text
end
settings[id] = settings[id] or defaultValue or ""
end
local addScrollBar = function(id, title, min, max, defaultValue, dest)
local widget = UI.createWidget('ExtrasScrollBar', dest)
widget.scroll.onValueChange = function(scroll, value)
widget.text:setText(title .. ": " .. value)
if value == 0 then
value = 1
end
settings[id] = value
end
widget.scroll:setRange(min, max)
if max-min > 1000 then
widget.scroll:setStep(100)
elseif max-min > 100 then
widget.scroll:setStep(10)
end
widget.scroll:setValue(settings[id] or defaultValue)
widget.scroll.onValueChange(widget.scroll, widget.scroll:getValue())
end
UI.Button("vBot Settings and Scripts", function()
extrasWindow:show()
extrasWindow:raise()
extrasWindow:focus()
end)
UI.Separator()
-- to remain order, add options right after another:
--- add object
--- add variables for function (optional)
--- add callback (optional)
--- optionals should be addionaly sandboxed (if true then end)
addItem("rope", "Rope Item", 9596, leftPanel)
addItem("shovel", "Shovel Item", 9596, leftPanel)
addItem("machete", "Machete Item", 9596, leftPanel)
addItem("scythe", "Scythe Item", 9596, leftPanel)
addScrollBar("talkDelay", "Global NPC Talk Delay", 0, 2000, 1000, leftPanel)
addScrollBar("looting", "Max Loot Distance", 0, 50, 40, leftPanel)
addCheckBox("title", "Custom Window Title", true, rightPanel)
if true then
local vocText = ""
if voc() == 1 or voc() == 11 then
vocText = "- EK"
elseif voc() == 2 or voc() == 12 then
vocText = "- RP"
elseif voc() == 3 or voc() == 13 then
vocText = "- MS"
elseif voc() == 4 or voc() == 14 then
vocText = "- ED"
end
macro(2000, function()
if settings.title then
if hppercent() > 0 then
g_window.setTitle("Tibia - " .. name() .. " - " .. lvl() .. "lvl " .. vocText)
else
g_window.setTitle("Tibia - " .. name() .. " - DEAD")
end
else
g_window.setTitle("Tibia - " .. name())
end
end)
end
addTextEdit("useAll", "Use All Hotkey", "space", rightPanel)
if true then
local useId = {34847, 1764, 21051, 30823, 6264, 5282, 20453, 20454, 20474, 11708, 11705,
6257, 6256, 2772, 27260, 2773, 1632, 1633, 1948, 435, 6252, 6253, 5007, 4911,
1629, 1630, 5108, 5107, 5281, 1968, 435, 1948, 5542, 31116, 31120, 30742, 31115,
31118, 20474, 5737, 5736, 5734, 5733, 31202, 31228, 31199, 31200, 33262, 30824,
5125, 5126, 5116, 5117, 8257, 8258, 8255, 8256}
local shovelId = {606, 593, 867}
local ropeId = {17238, 12202, 12935, 386, 421, 21966, 14238}
local macheteId = {2130, 3696}
local scytheId = {3653}
setDefaultTab("Tools")
-- script
if settings.useAll and settings.useAll:len() > 0 then
hotkey(settings.useAll, function()
if not modules.game_walking.wsadWalking then return end
for _, tile in pairs(g_map.getTiles(posz())) do
if distanceFromPlayer(tile:getPosition()) < 2 then
for _, item in pairs(tile:getItems()) do
-- use
if table.find(useId, item:getId()) then
use(item)
return
elseif table.find(shovelId, item:getId()) then
useWith(settings.shovel, item)
return
elseif table.find(ropeId, item:getId()) then
useWith(settings.rope, item)
return
elseif table.find(macheteId, item:getId()) then
useWith(settings.machete, item)
return
elseif table.find(scytheId, item:getId()) then
useWith(settings.scythe, item)
return
end
end
end
end
end)
end
end
addCheckBox("timers", "MW & WG Timers", true, rightPanel)
if true then
local activeTimers = {}
onAddThing(function(tile, thing)
if not settings.timers then return end
if not thing:isItem() then
return
end
local timer = 0
if thing:getId() == 2129 then -- mwall id
timer = 20000 -- mwall time
elseif thing:getId() == 2130 then -- wg id
timer = 45000 -- wg time
else
return
end
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
if not activeTimers[pos] or activeTimers[pos] < now then
activeTimers[pos] = now + timer
end
tile:setTimer(activeTimers[pos] - now)
end)
onRemoveThing(function(tile, thing)
if not settings.timers then return end
if not thing:isItem() then
return
end
if (thing:getId() == 2129 or thing:getId() == 2130) and tile:getGround() then
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
activeTimers[pos] = nil
tile:setTimer(0)
end
end)
end
addCheckBox("antiKick", "Anti - Kick", true, rightPanel)
if true then
macro(60*1000, function()
if not settings.antiKick then return end
local dir = player:getDirection()
turn((dir + 1) % 4)
schedule(50, function() turn(dir) end)
end)
end
addCheckBox("stake", "Skin Monsters", false, leftPanel)
if true then
local knifeBodies = {4272, 4173, 4011, 4025, 4047, 4052, 4057, 4062, 4112, 4212, 4321, 4324, 4327, 10352, 10356, 10360, 10364}
local stakeBodies = {4097, 4137, 8738, 18958}
local fishingBodies = {9582}
macro(500, function()
if not CaveBot.isOn() or not settings.stake then return end
for i, tile in ipairs(g_map.getTiles(posz())) do
for u,item in ipairs(tile:getItems()) do
if table.find(knifeBodies, item:getId()) and findItem(5908) then
CaveBot.delay(550)
useWith(5908, item)
return
end
if table.find(stakeBodies, item:getId()) and findItem(5942) then
CaveBot.delay(550)
useWith(5942, item)
return
end
if table.find(fishingBodies, item:getId()) and findItem(3483) then
CaveBot.delay(550)
useWith(3483, item)
return
end
end
end
end)
end
addCheckBox("oberon", "Auto Reply Oberon", true, rightPanel)
if true then
onTalk(function(name, level, mode, text, channelId, pos)
if not settings.oberon then return end
if mode == 34 then
if string.find(text, "world will suffer for") then
say("Are you ever going to fight or do you prefer talking!")
elseif string.find(text, "feet when they see me") then
say("Even before they smell your breath?")
elseif string.find(text, "from this plane") then
say("Too bad you barely exist at all!")
elseif string.find(text, "ESDO LO") then
say("SEHWO ASIMO, TOLIDO ESD")
elseif string.find(text, "will soon rule this world") then
say("Excuse me but I still do not get the message!")
elseif string.find(text, "honourable and formidable") then
say("Then why are we fighting alone right now?")
elseif string.find(text, "appear like a worm") then
say("How appropriate, you look like something worms already got the better of!")
elseif string.find(text, "will be the end of mortal") then
say("Then let me show you the concept of mortality before it!")
elseif string.find(text, "virtues of chivalry") then
say("Dare strike up a Minnesang and you will receive your last accolade!")
end
end
end)
end
addCheckBox("autoOpenDoors", "Auto Open Doors", true, rightPanel)
if true then
local wsadWalking = modules.game_walking.wsadWalking
local doorsIds = { 5007, 8265, 1629, 1632, 5129, 6252, 6249, 7715, 7712, 7714,
7719, 6256, 1669, 1672, 5125, 5115, 5124, 17701, 17710, 1642,
6260, 5107, 4912, 6251, 5291, 1683, 1696, 1692, 5006, 2179, 5116,
1632, 11705, 30772, 30774, 6248, 5735, 5732 }
function checkForDoors(pos)
local tile = g_map.getTile(pos)
if tile then
local useThing = tile:getTopUseThing()
if useThing and table.find(doorsIds, useThing:getId()) then
g_game.use(useThing)
end
end
end
onKeyPress(function(keys)
if not settings.autoOpenDoors then return end
local pos = player:getPosition()
if keys == 'Up' or (wsadWalking and keys == 'W') then
pos.y = pos.y - 1
elseif keys == 'Down' or (wsadWalking and keys == 'S') then
pos.y = pos.y + 1
elseif keys == 'Left' or (wsadWalking and keys == 'A') then
pos.x = pos.x - 1
elseif keys == 'Right' or (wsadWalking and keys == 'D') then
pos.x = pos.x + 1
elseif wsadWalking and keys == "Q" then
pos.y = pos.y - 1
pos.x = pos.x - 1
elseif wsadWalking and keys == "E" then
pos.y = pos.y - 1
pos.x = pos.x + 1
elseif wsadWalking and keys == "Z" then
pos.y = pos.y + 1
pos.x = pos.x - 1
elseif wsadWalking and keys == "C" then
pos.y = pos.y + 1
pos.x = pos.x + 1
end
checkForDoors(pos)
end)
end
addCheckBox("bless", "Buy bless at login", true, rightPanel)
if true then
if settings.bless then
if player:getBlessings() == 0 then
say("!bless")
schedule(2000, function()
if g_game.getClientVersion() > 1000 then
if player:getBlessings() == 0 then
warn("!! Blessings not bought !!")
end
end
end)
end
end
end
addCheckBox("reUse", "Keep Crosshair", false, rightPanel)
if true then
local excluded = {268, 237, 238, 23373, 266, 236, 239, 7643, 23375, 7642, 23374, 5908, 5942}
onUseWith(function(pos, itemId, target, subType)
if settings.reUse and not table.find(excluded, itemId) then
schedule(50, function()
item = findItem(itemId)
if item then
modules.game_interface.startUseWith(item)
end
end)
end
end)
end
addCheckBox("suppliesControl", "TargetBot off if low supply", false, leftPanel)
if true then
macro(500, function()
if not settings.suppliesControl then return end
if TargetBot.isOff() then return end
if CaveBot.isOff() then return end
if not hasSupplies() then
TargetBot.setOff()
end
end)
end
addCheckBox("holdMwall", "Hold MW/WG [ , ][ . ]", true, rightPanel)
if true then
local mwHot = ","
local wgHot = "."
local candidates = {}
local m = macro(20, function()
if not settings.holdMwall then return end
if #candidates == 0 then return end
for i, tile in pairs(candidates) do
if tile:getText():len() == 0 then
table.remove(candidates, i)
end
local rune = tile:getText() == "HOLD MW" and 3180 or 3156
if tile:canShoot() and not isInPz() and tile:isWalkable() and tile:getTopUseThing():getId() ~= 2130 then
return useWith(rune, tile:getTopUseThing())
end
end
end)
onRemoveThing(function(tile, thing)
if not settings.holdMwall then return end
if thing:getId() ~= 2129 then return end
if tile:getText():len() > 0 then
table.insert(candidates, tile)
useWith(3180, tile:getTopUseThing())
end
end)
onAddThing(function(tile, thing)
if not settings.holdMwall then return end
if m.isOff() then return end
if thing:getId() ~= 2129 then return end
if tile:getText():len() > 0 then
table.remove(candidates, table.find(candidates,tile))
end
end)
onKeyPress(function(keys)
local wsadWalking = modules.game_walking.wsadWalking
if not wsadWalking then return end
if not settings.holdMwall then return end
if m.isOff() then return end
if keys ~= mwHot and keys ~= wgHot then return end
local tile = getTileUnderCursor()
if not tile then return end
if tile:getText():len() > 0 then
tile:setText("")
else
if keys == mwHot then
tile:setText("HOLD MW")
else
tile:setText("HOLD WG")
end
table.insert(candidates, tile)
end
end)
end

View File

@ -0,0 +1,147 @@
ExtrasScrollBar < Panel
height: 28
margin-top: 3
Label
id: text
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-align: center
HorizontalScrollBar
id: scroll
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
minimum: 0
maximum: 10
step: 1
ExtrasTextEdit < Panel
height: 40
margin-top: 7
Label
id: text
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-align: center
TextEdit
id: textEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
minimum: 0
maximum: 10
step: 1
ExtrasItem < Panel
height: 34
margin-top: 7
margin-left: 25
margin-right: 25
Label
id: text
anchors.left: parent.left
anchors.verticalCenter: next.verticalCenter
BotItem
id: item
anchors.top: parent.top
anchors.right: parent.right
ExtrasCheckBox < BotSwitch
height: 20
margin-top: 7
ExtrasWindow < MainWindow
!text: tr('Extras')
size: 440 360
padding: 25
Label
anchors.left: parent.left
anchors.right: parent.horizontalCenter
anchors.top: parent.top
text-align: center
text: < CaveBot >
Label
anchors.left: parent.horizontalCenter
anchors.right: parent.right
anchors.top: parent.top
text-align: center
text: < Miscellaneous >
VerticalScrollBar
id: contentScroll
anchors.top: prev.bottom
margin-top: 3
anchors.right: parent.right
anchors.bottom: separator.top
step: 28
pixels-scroll: true
margin-right: -10
margin-top: 5
margin-bottom: 5
ScrollablePanel
id: content
anchors.top: prev.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: separator.top
vertical-scrollbar: contentScroll
margin-bottom: 10
Panel
id: left
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.horizontalCenter
margin-top: 5
margin-left: 10
margin-right: 10
layout:
type: verticalBox
fit-children: true
Panel
id: right
anchors.top: parent.top
anchors.left: parent.horizontalCenter
anchors.right: parent.right
margin-top: 5
margin-left: 10
margin-right: 10
layout:
type: verticalBox
fit-children: true
VerticalSeparator
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.horizontalCenter
HorizontalSeparator
id: separator
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: closeButton.top
margin-bottom: 8
Button
id: closeButton
!text: tr('Close')
font: cipsoftFont
anchors.right: parent.right
anchors.bottom: parent.bottom
size: 45 21
margin-right: 5

View File

@ -1,5 +1,4 @@
setDefaultTab("Main")
-- first, the variables
local launchTime = now
local startExp = exp()
@ -202,20 +201,31 @@ macro(500, function()
end
end)
UI.Label("Session Analyzers")
UI.Separator()
UI.Button("Reset Session", function() resetSessionData() end)
UI.Separator()
-- visuals
local ui = setupUI([[
Panel
height: 270
height: 320
padding: 5
BotButton
id: toggle
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
text: Session Analyzer
BotButton
id: reset
anchors.top: prev.bottom
margin-top: 5
anchors.left: parent.left
anchors.right: parent.right
text: Reset Session
Label
id: SessionLabel
anchors.top: parent.top
anchors.top: prev.bottom
margin-top: 3
anchors.left: parent.left
text: Session:
@ -430,6 +440,24 @@ Panel
]])
ui:setId("analyzers")
local function toggleHeight()
local h = ui:getHeight()
if h == 320 then
ui:setHeight(28)
else
ui:setHeight(320)
end
end
toggleHeight()
ui.reset.onClick = function(widget)
resetSessionData()
end
ui.toggle.onClick = function(widget)
toggleHeight()
end
macro(500, function()
-- refresh part
ui.one:setText(sessionTime())

View File

@ -0,0 +1,23 @@
setDefaultTab("Tools")
-- allows to test/edit bot lua scripts ingame, you can have multiple scripts like this, just change storage.ingame_lua
UI.Button("Ingame script editor", function(newText)
UI.MultilineEditorWindow(storage.ingame_hotkeys or "", {title="Hotkeys editor", description="You can add your custom scrupts here"}, function(text)
storage.ingame_hotkeys = text
reload()
end)
end)
UI.Separator()
for _, scripts in pairs({storage.ingame_hotkeys}) do
if type(scripts) == "string" and scripts:len() > 3 then
local status, result = pcall(function()
assert(load(scripts, "ingame_editor"))()
end)
if not status then
error("Ingame edior error:\n" .. result)
end
end
end
UI.Separator()

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
setDefaultTab("Tools")
UI.Separator()
UI.Label("Items Management")
UI.Separator()

View File

@ -300,6 +300,8 @@ Panel
safeRingVal = manapercent()
end
-- [[ condition list ]] --
local ringEnabled = storage[panelName].ringEnabled
local ringEquipped = getFinger() and (getFinger():getId() == storage[panelName].ringId or getFinger():getId() == getActiveItemId(storage[panelName].ringId))

View File

@ -1,4 +1,3 @@
-- main tab
UI.Label("vBot 1.3 \n Vithrax#5814")
UI.Label("vBot 2.0 \n Vithrax#5814")
UI.Button("Official OTCv8 Discord!", function() g_platform.openUrl("https://discord.gg/yhqBE4A") end)
UI.Separator()

View File

@ -0,0 +1,456 @@
CaveBot = {} -- global namespace
-------------------------------------------------------------------
-- CaveBot lib 1.0
-- Contains a universal set of functions to be used in CaveBot
----------------------[[ basic assumption ]]-----------------------
-- in general, functions cannot be slowed from within, only externally, by event calls, delays etc.
-- considering that and the fact that there is no while loop, every function return action
-- thus, functions will need to be verified outside themselfs or by another function
-- overall tips to creating extension:
-- - functions return action(nil) or true(done)
-- - extensions are controlled by retries var
-------------------------------------------------------------------
-- local variables, constants and functions, used by global functions
local LOCKERS_LIST = {3497, 3498, 3499, 3500}
local function CaveBotConfigParse()
local name = storage["_configs"]["targetbot_configs"]["selected"]
local file = configDir .. "/targetbot_configs/" .. name .. ".json"
local data = g_resources.readFileContents(file)
return Config.parse(data)['looting']
end
local function getNearTiles(pos)
if type(pos) ~= "table" then
pos = pos:getPosition()
end
local tiles = {}
local dirs = {
{-1, 1},
{0, 1},
{1, 1},
{-1, 0},
{1, 0},
{-1, -1},
{0, -1},
{1, -1}
}
for i = 1, #dirs do
local tile =
g_map.getTile(
{
x = pos.x - dirs[i][1],
y = pos.y - dirs[i][2],
z = pos.z
}
)
if tile then
table.insert(tiles, tile)
end
end
return tiles
end
-- ##################### --
-- [[ Information class ]] --
-- ##################### --
--- global variable to reflect current CaveBot status
CaveBot.Status = "waiting"
--- Parses config and extracts loot list.
-- @return table
function CaveBot.GetLootItems()
local t = CaveBotConfigParse()["items"]
local returnTable = {}
for i, item in pairs(t) do
table.insert(returnTable, item["id"])
end
return returnTable
end
--- Parses config and extracts loot containers.
-- @return table
function CaveBot.GetLootContainers()
local t = CaveBotConfigParse()["containers"]
local returnTable = {}
for i, container in pairs(t) do
table.insert(returnTable, container["id"])
end
return returnTable
end
--- Information about open containers.
-- @param amount is boolean
-- @return table or integer
function CaveBot.GetOpenedLootContainers(containerTable)
local containers = CaveBot.GetLootContainers()
local t = {}
for i, container in pairs(getContainers()) do
local containerId = container:getContainerItem():getId()
if table.find(containers, containerId) then
table.insert(t, container)
end
end
return containerTable and t or #t
end
--- Some actions needs to be additionally slowed down in case of high ping.
-- Maximum at 2000ms in case of lag spike.
-- @param multiplayer is integer
-- @return void
function CaveBot.PingDelay(multiplayer)
multiplayer = multiplayer or 1
if ping() and ping() > 150 then -- in most cases ping above 150 affects CaveBot
local value = math.min(ping() * multiplayer, 2000)
return delay(value)
end
end
-- ##################### --
-- [[ Container class ]] --
-- ##################### --
--- Closes any loot container that is open.
-- @return void or boolean
function CaveBot.CloseLootContainer()
local containers = CaveBot.GetLootContainers()
for i, container in pairs(getContainers()) do
local containerId = container:getContainerItem():getId()
if table.find(containers, containerId) then
return g_game.close(container)
end
end
return true
end
--- Opens any loot container that isn't already opened.
-- @return void or boolean
function CaveBot.OpenLootContainer()
local containers = CaveBot.GetLootContainers()
local t = {}
for i, container in pairs(getContainers()) do
local containerId = container:getContainerItem():getId()
table.insert(t, containerId)
end
for _, container in pairs(getContainers()) do
for _, item in pairs(container:getItems()) do
local id = item:getId()
if table.find(containers, id) and not table.find(t, id) then
test()
return g_game.open(item)
end
end
end
return true
end
-- ##################### --
-- [[[ Position class ]] --
-- ##################### --
--- Compares distance between player position and given pos.
-- @param position is table
-- @param distance is integer
-- @return boolean
function CaveBot.MatchPosition(position, distance)
local pPos = player:getPosition()
distance = distance or 1
return getDistanceBetween(pPos, position) <= distance
end
--- Stripped down to take less space.
-- Use only to safe position, like pz movement or reaching npc.
-- Needs to be called between 200-500ms to achieve fluid movement.
-- @param position is table
-- @param distance is integer
-- @return void
function CaveBot.GoTo(position, precision)
if not precision then
precision = 3
end
return CaveBot.walkTo(position, 20, {ignoreNonPathable = true, precision = precision})
end
--- Finds position of npc by name and reaches its position.
-- @return void(acion) or boolean
function CaveBot.ReachNPC(name)
name = name:lower()
local npc = nil
for i, spec in pairs(getSpectators()) do
if spec:isNpc() and spec:getName():lower() == name then
npc = spec
end
end
if not CaveBot.MatchPosition(npc:getPosition(), 3) then
CaveBot.GoTo(npc:getPosition())
else
return true
end
end
-- ##################### --
-- [[[[ Depot class ]]]] --
-- ##################### --
--- Reaches closest locker.
-- @return void(acion) or boolean
function CaveBot.ReachDepot()
local pPos = player:getPosition()
local tiles = getNearTiles(player:getPosition())
for i, tile in pairs(tiles) do
for i, item in pairs(tile:getItems()) do
if table.find(LOCKERS_LIST, item:getId()) then
return true -- if near locker already then return function
end
end
end
local candidate = {}
for i, tile in pairs(g_map.getTiles(posz())) do
local tPos = tile:getPosition()
local distance = getDistanceBetween(pPos, tPos)
for i, item in pairs(tile:getItems()) do
if table.find(LOCKERS_LIST, item:getId()) then
if findPath(pos(), tPos, 10, {ignoreNonPathable = true, precision = 1}) then
if #candidate == 0 or candidate.dist < distance then
candidate = {pos = tPos, dist = distance}
end
end
end
end
end
if candidate.pos then
if not CaveBot.MatchPosition(candidate.pos) then
CaveBot.GoTo(candidate.pos, 1)
else
return true
end
end
end
--- Opens locker item.
-- @return void(acion) or boolean
function CaveBot.OpenLocker()
local pPos = player:getPosition()
local tiles = getNearTiles(player:getPosition())
local locker = getContainerByName("Locker")
if not locker then
for i, tile in pairs(tiles) do
for i, item in pairs(tile:getItems()) do
if table.find(LOCKERS_LIST, item:getId()) then
local topThing = tile:getTopUseThing()
if not topThing:isNotMoveable() then
g_game.move(topThing, pPos, topThing:getCount())
else
return g_game.open(item)
end
end
end
end
else
return true
end
end
--- Opens depot chest.
-- @return void(acion) or boolean
function CaveBot.OpenDepotChest()
local depot = getContainerByName("Depot chest")
if not depot then
local locker = getContainerByName("Locker")
if not locker then
return CaveBot.OpenLocker()
end
for i, item in pairs(locker:getItems()) do
if item:getId() == 3502 then
return g_game.open(item, locker)
end
end
else
return true
end
end
--- Opens inbox inside locker.
-- @return void(acion) or boolean
function CaveBot.OpenInbox()
local inbox = getContainerByName("Your inbox")
if not inbox then
local locker = getContainerByName("Locker")
if not locker then
return CaveBot.OpenLocker()
end
for i, item in pairs(locker:getItems()) do
if item:getId() == 12902 then
return g_game.open(item)
end
end
else
return true
end
end
--- Opens depot box of given number.
-- @param index is integer
-- @return void or boolean
function CaveBot.OpenDepotBox(index)
local depot = getContainerByName("Depot chest")
if not depot then
return CaveBot.OpenDepotChest()
end
local foundParent = false
for i, container in pairs(getContainers()) do
if container:getName():lower():find("depot box") then
foundParent = container
break
end
end
if foundParent then return true end
for i, container in pairs(depot:getItems()) do
if i == index then
return g_game.open(container)
end
end
end
--- Reaches and opens depot.
-- Combined for shorthand usage.
-- @return boolean whether succeed to reach and open depot
function CaveBot.ReachAndOpenDepot()
if CaveBot.ReachDepot() and CaveBot.OpenDepotChest() then
return true
end
return false
end
--- Reaches and opens imbox.
-- Combined for shorthand usage.
-- @return boolean whether succeed to reach and open depot
function CaveBot.ReachAndOpenInbox()
if CaveBot.ReachDepot() and CaveBot.OpenInbox() then
return true
end
return false
end
--- Stripped down function to stash item.
-- @param item is object
-- @param index is integer
-- @param destination is object
-- @return void
function CaveBot.StashItem(item, index, destination)
local depotContainer
if not destination then
depotContainer = getContainerByName("Depot chest")
end
if not depotContainer then return false end
return g_game.move(item, depotContainer:getSlotPosition(index), item:getCount())
end
--- Withdraws item from depot chest or mail inbox.
-- main function for depositer/withdrawer
-- @param id is integer
-- @param amount is integer
-- @param fromDepot is boolean or integer
-- @param destination is object
-- @return void
function CaveBot.WithdrawItem(id, amount, fromDepot, destination)
if destination and type(destination) == "string" then
destination = getContainerByName(destination)
end
local itemCount = itemAmount(id)
local depot
for i, container in pairs(getContainers()) do
if container:getName():lower():find("depot box") or container:getName():lower():find("your inbox") then
depot = container
break
end
end
if not depot then
if fromDepot then
if not CaveBot.OpenDepotBox(fromDepot) then return end
else
return CaveBot.ReachAndOpenInbox()
end
return
end
if not destination then
for i, container in pairs(getContainers()) do
if container:getCapacity() > #container:getItems() and not string.find(container:getName():lower(), "quiver") and not string.find(container:getName():lower(), "depot") and not string.find(container:getName():lower(), "loot") and not string.find(container:getName():lower(), "inbox") then
destination = container
end
end
end
if itemCount >= amount then
return true
end
local toMove = amount - itemCount
info(toMove)
for i, item in pairs(depot:getItems()) do
if item:getId() == id then
return g_game.move(item, destination:getSlotPosition(destination:getItemsCount()), math.min(toMove, item:getCount()))
end
end
end
-- ##################### --
-- [[[[[ Talk class ]]]] --
-- ##################### --
--- Controlled by event caller.
-- Simple way to build npc conversations instead of multiline overcopied code.
-- @return void
function CaveBot.Conversation(...)
local expressions = {...}
local delay = storage.extras.talkDelay or 1000
local talkDelay = 0
for i, expr in ipairs(expressions) do
schedule(talkDelay, function() NPC.say(expr) end)
talkDelay = talkDelay + delay
end
end
--- Says hi trade to NPC.
-- Used as shorthand to open NPC trade window.
-- @return void
function CaveBot.OpenNpcTrade()
return CaveBot.Conversation("hi", "trade")
end
--- Says hi destination yes to NPC.
-- Used as shorthand to travel.
-- @param destination is string
-- @return void
function CaveBot.Travel(destination)
return CaveBot.Conversation("hi", destination, "yes")
end

View File

@ -1,3 +1,4 @@
setDefaultTab("Main")
local listPanelName = "playerList"
local ui = setupUI([[
Panel
@ -8,6 +9,7 @@ Panel
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
background: #292A2A
height: 18
text: Player Lists
]], parent)
@ -81,7 +83,6 @@ Panel
end
label:setText(friendName)
playerListWindow.FriendName:setText('')
refreshStatus()
end
end
@ -107,7 +108,6 @@ Panel
end
label:setText(friendName)
playerListWindow.FriendName:setText('')
refreshStatus()
end
end
@ -122,7 +122,6 @@ Panel
end
label:setText(enemyName)
playerListWindow.EnemyName:setText('')
refreshStatus()
end
end
@ -150,20 +149,20 @@ Panel
playerListWindow:hide()
end
function refreshStatus()
local refreshStatus = function()
for _, spec in ipairs(getSpectators()) do
if spec:isPlayer() and not spec:isLocalPlayer() then
if storage[listPanelName].outfits then
specOutfit = spec:getOutfit()
if isEnemy(spec:getName()) then
spec:setMarked('#FF0000')
specOutfit.head = 112
specOutfit.body = 112
specOutfit.legs = 112
specOutfit.feet = 112
spec:setOutfit(specOutfit)
elseif isFriend(spec:getName()) then
local specOutfit = spec:getOutfit()
if isFriend(spec:getName()) then
spec:setMarked('#0000FF')
specOutfit.head = 88
specOutfit.body = 88
specOutfit.legs = 88
specOutfit.feet = 88
spec:setOutfit(specOutfit)
elseif isEnemy(spec:getName()) then
spec:setMarked('#FF0000')
specOutfit.head = 94
specOutfit.body = 94
specOutfit.legs = 94
@ -176,8 +175,37 @@ function refreshStatus()
end
refreshStatus()
local checkStatus = function(creature)
if not creature:isPlayer() or creature:isLocalPlayer() then return end
local specName = creature:getName()
local specOutfit = creature:getOutfit()
if isFriend(specName) then
creature:setMarked('#0000FF')
specOutfit.head = 88
specOutfit.body = 88
specOutfit.legs = 88
specOutfit.feet = 88
creature:setOutfit(specOutfit)
elseif isEnemy(specName) then
creature:setMarked('#FF0000')
specOutfit.head = 94
specOutfit.body = 94
specOutfit.legs = 94
specOutfit.feet = 94
creature:setOutfit(specOutfit)
end
end
onCreatureAppear(function(creature)
if creature:isPlayer() then
refreshStatus()
checkStatus(creature)
end)
onPlayerPositionChange(function(x,y)
if x.z ~= y.z then
schedule(20, function()
refreshStatus()
end)
end
end)

View File

@ -0,0 +1,217 @@
setDefaultTab("Main")
local panelName = "pushmax"
local ui = setupUI([[
Panel
height: 19
BotSwitch
id: title
anchors.top: parent.top
anchors.left: parent.left
text-align: center
width: 130
!text: tr('PUSHMAX')
Button
id: push
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
margin-left: 3
height: 17
text: Setup
]])
ui:setId(panelName)
if not storage[panelName] then
storage[panelName] = {
enabled = true,
pushDelay = 1060,
pushMaxRuneId = 3188,
mwallBlockId = 2128,
pushMaxKey = "PageUp"
}
end
ui.title:setOn(storage[panelName].enabled)
ui.title.onClick = function(widget)
storage[panelName].enabled = not storage[panelName].enabled
widget:setOn(storage[panelName].enabled)
end
ui.push.onClick = function(widget)
pushWindow:show()
pushWindow:raise()
pushWindow:focus()
end
rootWidget = g_ui.getRootWidget()
if rootWidget then
pushWindow = UI.createWindow('PushMaxWindow', rootWidget)
pushWindow:hide()
pushWindow.closeButton.onClick = function(widget)
pushWindow:hide()
end
local updateDelayText = function()
pushWindow.delayText:setText("Push Delay: ".. storage[panelName].pushDelay)
end
updateDelayText()
pushWindow.delay.onValueChange = function(scroll, value)
storage[panelName].pushDelay = value
updateDelayText()
end
pushWindow.delay:setValue(storage[panelName].pushDelay)
pushWindow.runeId.onItemChange = function(widget)
storage[panelName].pushMaxRuneId = widget:getItemId()
end
pushWindow.runeId:setItemId(storage[panelName].pushMaxRuneId)
pushWindow.mwallId.onItemChange = function(widget)
storage[panelName].mwallBlockId = widget:getItemId()
end
pushWindow.mwallId:setItemId(storage[panelName].mwallBlockId)
pushWindow.hotkey.onTextChange = function(widget, text)
storage[panelName].pushMaxKey = text
end
pushWindow.hotkey:setText(storage[panelName].pushMaxKey)
end
-- variables for config
local config = storage[panelName]
local pushDelay = tonumber(config.pushDelay)
local rune = tonumber(config.pushMaxRuneId)
local customMwall = config.mwallBlockId
local key = config.pushMaxKey
local enabled = config.enabled
local fieldTable = {2118, 105, 2122}
-- scripts
local targetTile
local pushTarget
local targetid
local resetData = function()
for i, tile in pairs(g_map.getTiles(posz())) do
if tile:getText() == "TARGET" or tile:getText() == "DEST" then
tile:setText('')
end
end
pushTarget = nil
targetTile = nil
targetId = nil
end
local getCreatureById = function(id)
for i, spec in ipairs(getSpectators()) do
if spec:getId() == id then
return spec
end
end
return false
end
local isNotOk = function(t,tile)
local tileItems = {}
for i, item in pairs(tile:getItems()) do
table.insert(tileItems, item:getId())
end
for i, field in ipairs(t) do
if table.find(tileItems, field) then
return true
end
end
return false
end
local isOk = function(a,b)
return getDistanceBetween(a,b) == 1
end
-- to mark
onKeyDown(function(keys)
if not enabled then return end
if keys ~= key then return end
local tile = getTileUnderCursor()
if not tile then return end
if pushTarget and targetTile then
resetData()
return
end
local creature = tile:getCreatures()[1]
if not pushTarget and creature then
pushTarget = creature
targetId = creature:getId()
if pushTarget then
tile:setText('TARGET')
pushTarget:setMarked('#00FF00')
end
elseif not targetTile and pushTarget then
if pushTarget and getDistanceBetween(tile:getPosition(),pushTarget:getPosition()) ~= 1 then
resetData()
return
else
tile:setText('DEST')
targetTile = tile
end
end
end)
onCreaturePositionChange(function(creature, newPos, oldPos)
if not enabled then return end
if creature == player then
resetData()
end
if not pushTarget or not targetTile then return end
if creature == pushTarget and newPos == targetTile then
resetData()
end
end)
macro(20, function()
if not enabled then return end
if not pushTarget or not targetTile then return end
tilePos = targetTile:getPosition()
targetPos = pushTarget:getPosition()
if not isOk(tilePos,targetPos) then return end
local tileOfTarget = g_map.getTile(targetPos)
if not targetTile:isWalkable() then
local topThing = targetTile:getTopUseThing():getId()
if topThing == 2129 or topThing == 2130 or topThing == customMwall then
if targetTile:getTimer() < pushDelay+500 then
storage.isUsing = true
schedule(pushDelay+700, function()
storage.isUsing = false
end)
end
if targetTile:getTimer() > pushDelay then
return
end
else
return resetData()
end
end
if not tileOfTarget:getTopUseThing():isNotMoveable() then
return useWith(rune, pushTarget)
end
if isNotOk(fieldTable, targetTile) then
if targetTile:canShoot() then
return useWith(3148, targetTile:getTopUseThing())
else
return
end
end
g_game.move(pushTarget,tilePos)
delay(2000)
end)

View File

@ -67,18 +67,6 @@ PushMaxWindow < MainWindow
margin-top: 5
text-align: center
Label
id: label
anchors.top: hotkey.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin-top: 10
text-align: center
text: Made by Frosty
font: cipsoftFont
image-source: /images/ui/window
image-border: 1
width: 100
HorizontalSeparator
id: separator
anchors.right: parent.right

View File

@ -4,22 +4,8 @@ function SuppliesPanel(parent)
parent = panel
end
local ui = setupUI([[
Panel
height: 21
Button
id: supplies
anchors.left: parent.left
anchors.right: parent.right
text-align: center
!text: tr('Supplies')
]])
ui:setId(suppliesPanelName)
if not storage[suppliesPanelName] then
storage[suppliesPanelName] = {
if not SuppliesConfig[suppliesPanelName] then
SuppliesConfig[suppliesPanelName] = {
item1 = 0,
item2 = 0,
item3 = 0,
@ -58,232 +44,233 @@ if rootWidget then
SuppliesWindow = g_ui.createWidget('SuppliesWindow', rootWidget)
SuppliesWindow:hide()
SuppliesWindow.capSwitch:setOn(storage[suppliesPanelName].capSwitch)
SuppliesWindow.capSwitch:setOn(SuppliesConfig[suppliesPanelName].capSwitch)
SuppliesWindow.capSwitch.onClick = function(widget)
storage[suppliesPanelName].capSwitch = not storage[suppliesPanelName].capSwitch
widget:setOn(storage[suppliesPanelName].capSwitch)
SuppliesConfig[suppliesPanelName].capSwitch = not SuppliesConfig[suppliesPanelName].capSwitch
widget:setOn(SuppliesConfig[suppliesPanelName].capSwitch)
end
SuppliesWindow.SoftBoots:setOn(storage[suppliesPanelName].SoftBoots)
SuppliesWindow.SoftBoots:setOn(SuppliesConfig[suppliesPanelName].SoftBoots)
SuppliesWindow.SoftBoots.onClick = function(widget)
storage[suppliesPanelName].SoftBoots = not storage[suppliesPanelName].SoftBoots
widget:setOn(storage[suppliesPanelName].SoftBoots)
SuppliesConfig[suppliesPanelName].SoftBoots = not SuppliesConfig[suppliesPanelName].SoftBoots
widget:setOn(SuppliesConfig[suppliesPanelName].SoftBoots)
end
SuppliesWindow.imbues:setOn(storage[suppliesPanelName].imbues)
SuppliesWindow.imbues:setOn(SuppliesConfig[suppliesPanelName].imbues)
SuppliesWindow.imbues.onClick = function(widget)
storage[suppliesPanelName].imbues = not storage[suppliesPanelName].imbues
widget:setOn(storage[suppliesPanelName].imbues)
SuppliesConfig[suppliesPanelName].imbues = not SuppliesConfig[suppliesPanelName].imbues
widget:setOn(SuppliesConfig[suppliesPanelName].imbues)
end
SuppliesWindow.staminaSwitch:setOn(storage[suppliesPanelName].staminaSwitch)
SuppliesWindow.staminaSwitch:setOn(SuppliesConfig[suppliesPanelName].staminaSwitch)
SuppliesWindow.staminaSwitch.onClick = function(widget)
storage[suppliesPanelName].staminaSwitch = not storage[suppliesPanelName].staminaSwitch
widget:setOn(storage[suppliesPanelName].staminaSwitch)
SuppliesConfig[suppliesPanelName].staminaSwitch = not SuppliesConfig[suppliesPanelName].staminaSwitch
widget:setOn(SuppliesConfig[suppliesPanelName].staminaSwitch)
end
SuppliesWindow.SortSupplies:setOn(storage[suppliesPanelName].sortSupplies)
SuppliesWindow.SortSupplies:setOn(SuppliesConfig[suppliesPanelName].sortSupplies)
SuppliesWindow.SortSupplies.onClick = function(widget)
storage[suppliesPanelName].sortSupplies = not storage[suppliesPanelName].sortSupplies
widget:setOn(storage[suppliesPanelName].sortSupplies)
SuppliesConfig[suppliesPanelName].sortSupplies = not SuppliesConfig[suppliesPanelName].sortSupplies
widget:setOn(SuppliesConfig[suppliesPanelName].sortSupplies)
end
-- bot items
SuppliesWindow.item1:setItemId(storage[suppliesPanelName].item1)
SuppliesWindow.item1:setItemId(SuppliesConfig[suppliesPanelName].item1)
SuppliesWindow.item1.onItemChange = function(widget)
storage[suppliesPanelName].item1 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item1 = widget:getItemId()
end
SuppliesWindow.item2:setItemId(storage[suppliesPanelName].item2)
SuppliesWindow.item2:setItemId(SuppliesConfig[suppliesPanelName].item2)
SuppliesWindow.item2.onItemChange = function(widget)
storage[suppliesPanelName].item2 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item2 = widget:getItemId()
end
SuppliesWindow.item3:setItemId(storage[suppliesPanelName].item3)
SuppliesWindow.item3:setItemId(SuppliesConfig[suppliesPanelName].item3)
SuppliesWindow.item3.onItemChange = function(widget)
storage[suppliesPanelName].item3 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item3 = widget:getItemId()
end
SuppliesWindow.item4:setItemId(storage[suppliesPanelName].item4)
SuppliesWindow.item4:setItemId(SuppliesConfig[suppliesPanelName].item4)
SuppliesWindow.item4.onItemChange = function(widget)
storage[suppliesPanelName].item4 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item4 = widget:getItemId()
end
SuppliesWindow.item5:setItemId(storage[suppliesPanelName].item5)
SuppliesWindow.item5:setItemId(SuppliesConfig[suppliesPanelName].item5)
SuppliesWindow.item5.onItemChange = function(widget)
storage[suppliesPanelName].item5 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item5 = widget:getItemId()
end
SuppliesWindow.item6:setItemId(storage[suppliesPanelName].item6)
SuppliesWindow.item6:setItemId(SuppliesConfig[suppliesPanelName].item6)
SuppliesWindow.item6.onItemChange = function(widget)
storage[suppliesPanelName].item6 = widget:getItemId()
SuppliesConfig[suppliesPanelName].item6 = widget:getItemId()
end
SuppliesWindow.PotionBp:setItemId(storage[suppliesPanelName].potionBp)
SuppliesWindow.PotionBp:setItemId(SuppliesConfig[suppliesPanelName].potionBp)
SuppliesWindow.PotionBp.onItemChange = function(widget)
storage[suppliesPanelName].potionBp = widget:getItemId()
SuppliesConfig[suppliesPanelName].potionBp = widget:getItemId()
end
SuppliesWindow.RuneBp:setItemId(storage[suppliesPanelName].runeBp)
SuppliesWindow.RuneBp:setItemId(SuppliesConfig[suppliesPanelName].runeBp)
SuppliesWindow.RuneBp.onItemChange = function(widget)
storage[suppliesPanelName].runeBp = widget:getItemId()
SuppliesConfig[suppliesPanelName].runeBp = widget:getItemId()
end
SuppliesWindow.AmmoBp:setItemId(storage[suppliesPanelName].ammoBp)
SuppliesWindow.AmmoBp:setItemId(SuppliesConfig[suppliesPanelName].ammoBp)
SuppliesWindow.AmmoBp.onItemChange = function(widget)
storage[suppliesPanelName].ammoBp = widget:getItemId()
SuppliesConfig[suppliesPanelName].ammoBp = widget:getItemId()
end
-- text windows
SuppliesWindow.capValue:setText(storage[suppliesPanelName].capValue)
SuppliesWindow.capValue:setText(SuppliesConfig[suppliesPanelName].capValue)
SuppliesWindow.capValue.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.capValue:getText())
if not value then
SuppliesWindow.capValue:setText(0)
end
storage[suppliesPanelName].capValue = text
SuppliesConfig[suppliesPanelName].capValue = text
end
SuppliesWindow.item1Min:setText(storage[suppliesPanelName].item1Min)
SuppliesWindow.item1Min:setText(SuppliesConfig[suppliesPanelName].item1Min)
SuppliesWindow.item1Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item1Min:getText())
if not value then
SuppliesWindow.item1Min:setText(0)
end
storage[suppliesPanelName].item1Min = text
SuppliesConfig[suppliesPanelName].item1Min = text
end
SuppliesWindow.item1Max:setText(storage[suppliesPanelName].item1Max)
SuppliesWindow.item1Max:setText(SuppliesConfig[suppliesPanelName].item1Max)
SuppliesWindow.item1Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item1Max:getText())
if not value then
SuppliesWindow.item1Max:setText(0)
end
storage[suppliesPanelName].item1Max = text
SuppliesConfig[suppliesPanelName].item1Max = text
end
SuppliesWindow.item2Min:setText(storage[suppliesPanelName].item2Min)
SuppliesWindow.item2Min:setText(SuppliesConfig[suppliesPanelName].item2Min)
SuppliesWindow.item2Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item2Min:getText())
if not value then
SuppliesWindow.item2Min:setText(0)
end
storage[suppliesPanelName].item2Min = text
SuppliesConfig[suppliesPanelName].item2Min = text
end
SuppliesWindow.item2Max:setText(storage[suppliesPanelName].item2Max)
SuppliesWindow.item2Max:setText(SuppliesConfig[suppliesPanelName].item2Max)
SuppliesWindow.item2Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item2Max:getText())
if not value then
SuppliesWindow.item2Max:setText(0)
end
storage[suppliesPanelName].item2Max = text
SuppliesConfig[suppliesPanelName].item2Max = text
end
SuppliesWindow.item3Min:setText(storage[suppliesPanelName].item3Min)
SuppliesWindow.item3Min:setText(SuppliesConfig[suppliesPanelName].item3Min)
SuppliesWindow.item3Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item3Min:getText())
if not value then
SuppliesWindow.item3Min:setText(0)
end
storage[suppliesPanelName].item3Min = text
SuppliesConfig[suppliesPanelName].item3Min = text
end
SuppliesWindow.item3Max:setText(storage[suppliesPanelName].item3Max)
SuppliesWindow.item3Max:setText(SuppliesConfig[suppliesPanelName].item3Max)
SuppliesWindow.item3Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item3Max:getText())
if not value then
SuppliesWindow.item3Max:setText(0)
end
storage[suppliesPanelName].item3Max = text
SuppliesConfig[suppliesPanelName].item3Max = text
end
SuppliesWindow.item4Min:setText(storage[suppliesPanelName].item4Min)
SuppliesWindow.item4Min:setText(SuppliesConfig[suppliesPanelName].item4Min)
SuppliesWindow.item4Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item4Min:getText())
if not value then
SuppliesWindow.item4Min:setText(0)
end
storage[suppliesPanelName].item4Min = text
SuppliesConfig[suppliesPanelName].item4Min = text
end
SuppliesWindow.staminaValue:setText(storage[suppliesPanelName].staminaValue)
SuppliesWindow.staminaValue:setText(SuppliesConfig[suppliesPanelName].staminaValue)
SuppliesWindow.staminaValue.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.staminaValue:getText())
if not value then
SuppliesWindow.staminaValue:setText(0)
end
storage[suppliesPanelName].staminaValue = text
SuppliesConfig[suppliesPanelName].staminaValue = text
end
SuppliesWindow.item4Max:setText(storage[suppliesPanelName].item4Max)
SuppliesWindow.item4Max:setText(SuppliesConfig[suppliesPanelName].item4Max)
SuppliesWindow.item4Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item4Max:getText())
if not value then
SuppliesWindow.item4Max:setText(0)
end
storage[suppliesPanelName].item4Max = text
SuppliesConfig[suppliesPanelName].item4Max = text
end
SuppliesWindow.item5Min:setText(storage[suppliesPanelName].item5Min)
SuppliesWindow.item5Min:setText(SuppliesConfig[suppliesPanelName].item5Min)
SuppliesWindow.item5Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item5Min:getText())
if not value then
SuppliesWindow.item5Min:setText(0)
end
storage[suppliesPanelName].item5Min = text
SuppliesConfig[suppliesPanelName].item5Min = text
end
SuppliesWindow.item5Max:setText(storage[suppliesPanelName].item5Max)
SuppliesWindow.item5Max:setText(SuppliesConfig[suppliesPanelName].item5Max)
SuppliesWindow.item5Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item5Max:getText())
if not value then
SuppliesWindow.item5Max:setText(0)
end
storage[suppliesPanelName].item5Max = text
SuppliesConfig[suppliesPanelName].item5Max = text
end
SuppliesWindow.item6Min:setText(storage[suppliesPanelName].item6Min)
SuppliesWindow.item6Min:setText(SuppliesConfig[suppliesPanelName].item6Min)
SuppliesWindow.item6Min.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item6Min:getText())
if not value then
SuppliesWindow.item6Min:setText(0)
end
storage[suppliesPanelName].item6Min = text
SuppliesConfig[suppliesPanelName].item6Min = text
end
SuppliesWindow.item6Max:setText(storage[suppliesPanelName].item6Max)
SuppliesWindow.item6Max:setText(SuppliesConfig[suppliesPanelName].item6Max)
SuppliesWindow.item6Max.onTextChange = function(widget, text)
local value = tonumber(SuppliesWindow.item6Max:getText())
if not value then
SuppliesWindow.item6Max:setText(0)
end
storage[suppliesPanelName].item6Max = text
SuppliesConfig[suppliesPanelName].item6Max = text
end
end
ui.supplies.onClick = function(widget)
UI.Button("Supplies", function()
SuppliesWindow:show()
SuppliesWindow:raise()
SuppliesWindow:focus()
end
end)
SuppliesWindow.close.onClick = function(widget)
SuppliesWindow:hide()
vBotConfigSave("supply")
end
end
local potions = {268, 237, 238, 23373, 266, 236, 239, 7643, 7642, 23374}
local potions = {23375, 268, 237, 238, 23373, 266, 236, 239, 7643, 7642, 23374}
local runes = {3725, 3203, 3161, 3147, 3178, 3177, 3153, 3148, 3197, 3149, 3164, 3166, 3200, 3192, 3188, 3190, 3189, 3191, 3198, 3182, 3158, 3152, 3174, 3180, 3165, 3173, 3172, 3176, 3195, 3179, 3175, 3155, 3202, 3160, 3156}
local ammo = {23375, 3446, 16142, 6528, 7363, 3450, 16141, 25785, 14252, 3447, 3449, 15793, 25757, 774, 16143, 763, 761, 7365, 3448, 762, 21470, 7364, 14251, 7368, 25759, 3287, 7366, 3298, 25758}
local ammo = {3446, 16142, 6528, 7363, 3450, 16141, 25785, 14252, 3447, 3449, 15793, 25757, 774, 16143, 763, 761, 7365, 3448, 762, 21470, 7364, 14251, 7368, 25759, 3287, 7366, 3298, 25758}
macro(250, function()
if not storage[suppliesPanelName].sortSupplies then return end
local sortPotions = storage[suppliesPanelName].potionBp > 100
local sortRunes = storage[suppliesPanelName].runeBp > 100
local sortAmmo = storage[suppliesPanelName].ammoBp > 100
if not SuppliesConfig[suppliesPanelName].sortSupplies then return end
local sortPotions = SuppliesConfig[suppliesPanelName].potionBp > 100
local sortRunes = SuppliesConfig[suppliesPanelName].runeBp > 100
local sortAmmo = SuppliesConfig[suppliesPanelName].ammoBp > 100
local potionsContainer = nil
local runesContainer = nil
local ammoContainer = nil
@ -292,11 +279,11 @@ macro(250, function()
if not potionsContainer or not runesContainer or not ammoContainer then
for i, container in pairs(getContainers()) do
if not containerIsFull(container) then
if sortPotions and container:getContainerItem():getId() == storage[suppliesPanelName].potionBp then
if sortPotions and container:getContainerItem():getId() == SuppliesConfig[suppliesPanelName].potionBp then
potionsContainer = container
elseif sortRunes and container:getContainerItem():getId() == storage[suppliesPanelName].runeBp then
elseif sortRunes and container:getContainerItem():getId() == SuppliesConfig[suppliesPanelName].runeBp then
runesContainer = container
elseif sortAmmo and container:getContainerItem():getId() == storage[suppliesPanelName].ammoBp then
elseif sortAmmo and container:getContainerItem():getId() == SuppliesConfig[suppliesPanelName].ammoBp then
ammoContainer = container
end
end
@ -307,7 +294,7 @@ macro(250, function()
-- potions
if potionsContainer then
for i, container in pairs(getContainers()) do
if (container:getContainerItem():getId() ~= storage[suppliesPanelName].potionBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) then
if (container:getContainerItem():getId() ~= SuppliesConfig[suppliesPanelName].potionBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) then
for j, item in pairs(container:getItems()) do
if table.find(potions, item:getId()) then
return g_game.move(item, potionsContainer:getSlotPosition(potionsContainer:getItemsCount()), item:getCount())
@ -320,7 +307,7 @@ macro(250, function()
-- runes
if runesContainer then
for i, container in pairs(getContainers()) do
if (container:getContainerItem():getId() ~= storage[suppliesPanelName].runeBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) then
if (container:getContainerItem():getId() ~= SuppliesConfig[suppliesPanelName].runeBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) then
for j, item in pairs(container:getItems()) do
if table.find(runes, item:getId()) then
return g_game.move(item, runesContainer:getSlotPosition(runesContainer:getItemsCount()), item:getCount())
@ -333,7 +320,7 @@ macro(250, function()
-- ammo
if ammoContainer then
for i, container in pairs(getContainers()) do
if (container:getContainerItem():getId() ~= storage[suppliesPanelName].ammoBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) and not string.find(container:getName():lower(), "loot") then
if (container:getContainerItem():getId() ~= SuppliesConfig[suppliesPanelName].ammoBp and (string.find(container:getName(), "backpack") or string.find(container:getName(), "bag") or string.find(container:getName(), "chess"))) and not string.find(container:getName():lower(), "loot") then
for j, item in pairs(container:getItems()) do
if table.find(ammo, item:getId()) then
return g_game.move(item, ammoContainer:getSlotPosition(ammoContainer:getItemsCount()), item:getCount())

View File

@ -1,7 +1,6 @@
SuppliesWindow < MainWindow
!text: tr('Supplies')
size: 430 310
@onEscape: self:hide()
VerticalSeparator
id: sep

Some files were not shown because too many files have changed in this diff Show More