Updated to OTCv8 3.1 rev 112

This commit is contained in:
OTCv8 2021-11-25 23:32:26 +00:00
parent dbe70e787a
commit bbcb7c2168
228 changed files with 3376 additions and 12584 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -103,6 +103,13 @@ function clear()
widget:destroy()
end
end
for _, widget in pairs({modules.game_interface.getRightPanel(), modules.game_interface.getLeftPanel()}) do
for i, child in pairs(widget:getChildren()) do
if child.botWidget then
child:destroy()
end
end
end
local gameMapPanel = modules.game_interface.getMapPanel()
if gameMapPanel then
@ -478,6 +485,11 @@ function initCallbacks()
onImbuementWindow = botImbuementWindow,
onModalDialog = botModalDialog,
onAttackingCreatureChange = botAttackingCreatureChange,
onAddItem = botContainerAddItem,
onRemoveItem = botContainerRemoveItem,
onGameEditText = botGameEditText,
onSpellCooldown = botSpellCooldown,
onSpellGroupCooldown = botGroupSpellCooldown
})
connect(Tile, {
@ -508,6 +520,7 @@ function initCallbacks()
onClose = botContainerClose,
onUpdateItem = botContainerUpdateItem,
onAddItem = botContainerAddItem,
onRemoveItem = botContainerRemoveItem,
})
connect(g_map, {
@ -536,7 +549,10 @@ function terminateCallbacks()
onChannelEvent = botChannelEvent,
onImbuementWindow = botImbuementWindow,
onModalDialog = botModalDialog,
onAttackingCreatureChange = botAttackingCreatureChange
onAttackingCreatureChange = botAttackingCreatureChange,
onGameEditText = botGameEditText,
onSpellCooldown = botSpellCooldown,
onSpellGroupCooldown = botGroupSpellCooldown
})
disconnect(Tile, {
@ -567,6 +583,7 @@ function terminateCallbacks()
onClose = botContainerClose,
onUpdateItem = botContainerUpdateItem,
onAddItem = botContainerAddItem,
onRemoveItem = botContainerRemoveItem
})
disconnect(g_map, {
@ -726,6 +743,11 @@ function botModalDialog(id, title, message, buttons, enterButton, escapeButton,
safeBotCall(function() botExecutor.callbacks.onModalDialog(id, title, message, buttons, enterButton, escapeButton, choices, priority) end)
end
function botGameEditText(id, itemId, maxLength, text, writer, time)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onGameEditText(id, itemId, maxLength, text, writer, time) end)
end
function botAttackingCreatureChange(creature, oldCreature)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onAttackingCreatureChange(creature,oldCreature) end)
@ -741,7 +763,22 @@ function botStatesChange(states, oldStates)
safeBotCall(function() botExecutor.callbacks.onStatesChange(states, oldStates) end)
end
function botContainerAddItem(container, slot, item)
function botContainerAddItem(container, slot, item, oldItem)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onAddItem(container, slot, item) end)
safeBotCall(function() botExecutor.callbacks.onAddItem(container, slot, item, oldItem) end)
end
function botContainerRemoveItem(container, slot, item)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onRemoveItem(container, slot, item) end)
end
function botSpellCooldown(iconId, duration)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onSpellCooldown(iconId, duration) end)
end
function botGroupSpellCooldown(iconId, duration)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onGroupSpellCooldown(iconId, duration) end)
end

View File

@ -1,105 +0,0 @@
AlarmsWindow < MainWindow
!text: tr('Alarms')
size: 270 200
@onEscape: self:hide()
BotSwitch
id: playerAttack
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-align: center
text: Player Attack
BotSwitch
id: playerDetected
anchors.left: parent.left
anchors.right: parent.horizontalCenter
anchors.top: prev.bottom
margin-top: 4
text-align: center
text: Player Detected
CheckBox
id: playerDetectedLogout
anchors.top: playerDetected.top
anchors.left: parent.horizontalCenter
anchors.right: parent.right
margin-top: 3
margin-left: 4
text: Logout
BotSwitch
id: creatureDetected
anchors.left: parent.left
anchors.right: parent.right
anchors.top: playerDetected.bottom
margin-top: 4
text-align: center
text: Creature Detected
BotSwitch
id: healthBelow
anchors.left: parent.left
anchors.top: prev.bottom
anchors.right: parent.horizontalCenter
text-align: center
margin-top: 4
text: Health < 50%
HorizontalScrollBar
id: healthValue
anchors.left: parent.horizontalCenter
anchors.right: parent.right
anchors.top: healthBelow.top
margin-left: 3
margin-top: 2
minimum: 1
maximum: 100
step: 1
BotSwitch
id: manaBelow
anchors.left: parent.left
anchors.top: healthBelow.bottom
anchors.right: parent.horizontalCenter
text-align: center
margin-top: 4
text: Mana < 50%
HorizontalScrollBar
id: manaValue
anchors.left: parent.horizontalCenter
anchors.right: parent.right
anchors.top: manaBelow.top
margin-left: 3
margin-top: 2
minimum: 1
maximum: 100
step: 1
BotSwitch
id: privateMessage
anchors.left: parent.left
anchors.top: manaBelow.bottom
anchors.right: parent.right
text-align: center
margin-top: 4
text: Private Message
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-top: 15
margin-right: 5

View File

@ -1,437 +0,0 @@
setDefaultTab("Main")
-- first, the variables
local launchTime = now
local startExp = exp()
local dmgTable = {}
local healTable = {}
local expTable = {}
local totalDmg = 0
local totalHeal = 0
local dmgDistribution = {}
local first = "-"
local second = "-"
local third = "-"
local bestHit = 0
local bestHeal = 0
local lootedItems = {}
local useData = {}
local usedItems ={}
local resetSessionData = function()
launchTime = now
startExp = exp()
dmgTable = {}
healTable = {}
expTable = {}
totalDmg = 0
totalHeal = 0
dmgDistribution = {}
first = "-"
second = "-"
third = "-"
bestHit = 0
bestHeal = 0
lootedItems = {}
useData = {}
usedItems ={}
refreshLoot()
refreshWaste()
end
function format_thousand(v)
if not v then return 0 end
local s = string.format("%d", math.floor(v))
local pos = string.len(s) % 3
if pos == 0 then pos = 3 end
return string.sub(s, 1, pos)
.. string.gsub(string.sub(s, pos+1), "(...)", ".%1")
end
local expGained = function()
return exp() - startExp
end
local expLeft = function()
local level = lvl()+1
return math.floor((50*level*level*level)/3 - 100*level*level + (850*level)/3 - 200) - exp()
end
local niceTimeFormat = function(v) -- v in seconds
local hours = string.format("%02.f", math.floor(v/3600))
local mins = string.format("%02.f", math.floor(v/60 - (hours*60)))
return hours .. ":" .. mins .. "h"
end
local uptime
local sessionTime = function()
uptime = math.floor((now - launchTime)/1000)
return niceTimeFormat(uptime)
end
sessionTime()
local expPerHour = function(calculation)
local r = 0
if #expTable > 0 then
r = exp() - expTable[1]
else
return "-"
end
if uptime < 15*60 then
r = math.ceil((r/uptime)*60*60)
else
r = math.ceil(r*8)
end
if calculation then
return r
else
return format_thousand(r)
end
end
local timeToLevel = function()
local t = 0
if expPerHour(true) == 0 or expPerHour() == "-" then
return "-"
else
t = expLeft()/expPerHour(true)
return niceTimeFormat(math.ceil(t*60*60))
end
end
local sumT = function(t)
local s = 0
for i,v in pairs(t) do
s = s + v.d
end
return s
end
local valueInSeconds = function(t)
local d = 0
local time = 0
if #t > 0 then
for i, v in ipairs(t) do
if now - v.t <= 3000 then
if time == 0 then
time = v.t
end
d = d + v.d
else
table.remove(t, 1)
end
end
end
return math.ceil(d/((now-time)/1000))
end
local regex = "You lose ([0-9]*) hitpoints due to an attack by ([a-z]*) ([a-z A-z-]*)"
onTextMessage(function(mode, text)
if mode == 21 then -- damage dealt
totalDmg = totalDmg + getFirstNumberInText(text)
table.insert(dmgTable, {d = getFirstNumberInText(text), t = now})
if getFirstNumberInText(text) > bestHit then
bestHit = getFirstNumberInText(text)
end
end
if mode == 23 then -- healing
totalHeal = totalHeal + getFirstNumberInText(text)
table.insert(healTable, {d = getFirstNumberInText(text), t = now})
if getFirstNumberInText(text) > bestHeal then
bestHeal = getFirstNumberInText(text)
end
end
-- damage distribution part
if text:find("You lose") then
local data = regexMatch(text, regex)[1]
if data then
local monster = data[4]
local val = data[2]
table.insert(dmgDistribution, {v=val,m=monster,t=now})
end
end
end)
-- tables maintance
macro(500, function()
local dmgFinal = {}
local labelTable = {}
local dmgSum = 0
table.insert(expTable, exp())
if #expTable > 15*60 then
for i,v in pairs(expTable) do
if i == 1 then
table.remove(expTable, i)
end
end
end
for i,v in pairs(dmgDistribution) do
if now - v.t > 60*1000*10 then
table.remove(dmgDistribution, i)
else
dmgSum = dmgSum + v.v
if not dmgFinal[v.m] then
dmgFinal[v.m] = v.v
else
dmgFinal[v.m] = dmgFinal[v.m] + v.v
end
end
end
if not dmgFinal[1] then
first = "-"
end
if not dmgFinal[2] then
second = "-"
end
if not dmgFinal[3] then
third = "-"
end
local iter = 0
for k,v in pairs(dmgFinal) do
table.insert(labelTable, {m=k, d=tonumber(v)})
end
table.sort(labelTable, function(a,b) return a.d > b.d end)
for i,v in pairs(labelTable) do
local label = v.m .. ": " .. math.floor((v.d/dmgSum)*100) .. "%"
if i == 1 then
first = label
elseif i == 2 then
second = label
elseif i == 3 then
third = label
end
end
end)
-- visuals
UI.Separator()
local main = UI.createWidget("MainAnalyzer")
local ui = UI.createWidget("HuntingAnalyzer")
local ui2 = UI.createWidget("LootAnalyzer")
ui:hide()
ui2:hide()
function refreshLoot()
for i, child in pairs(ui2.List:getChildren()) do
child:destroy()
end
for k,v in pairs(lootedItems) do
local label = g_ui.createWidget("LootItemLabel", ui2.List)
label:setText(v .. "x " .. k)
end
end
function refreshWaste()
for i, child in pairs(ui2.supplyList:getChildren()) do
child:destroy()
end
for k,v in pairs(usedItems) do
local label = g_ui.createWidget("LootItemLabel", ui2.supplyList)
label:setText(v .. "x " .. k)
end
end
-- loot analyzer
-- adding
local containers = CaveBot.GetLootContainers()
local lastCap = freecap()
onAddItem(function(container, slot, item, oldItem)
if not table.find(containers, container:getContainerItem():getId()) then return end
if isInPz() then return end
if slot > 0 then return end
if freecap() >= lastCap then return end
local name = item:getId() == 3031 and "gold coin" or item:getId() == 3035 and "platinum coin" or item:getId() == 3043 and "crystal coin" or item:getMarketData().name
if not lootedItems[name] then
lootedItems[name] = item:getCount()
else
lootedItems[name] = lootedItems[name] + item:getCount()
end
refreshLoot()
end)
onContainerUpdateItem(function(container, slot, item, oldItem)
if not table.find(containers, container:getContainerItem():getId()) then return end
if not oldItem then return end
if isInPz() then return end
if freecap() == lastCap then return end
local name = item:getId() == 3031 and "gold coin" or item:getId() == 3035 and "platinum coin" or item:getId() == 3043 and "crystal coin" or item:getMarketData().name
local amount = item:getCount() - oldItem:getCount()
if not lootedItems[name] then
lootedItems[name] = amount
else
lootedItems[name] = lootedItems[name] + amount
end
refreshLoot()
end)
-- waste
local regex3 = [[\d ([a-z A-Z]*)s...]]
useData = {}
usedItems = {}
onTextMessage(function(mode, text)
text = text:lower()
if not text:find("using one of") then return end
local amount = getFirstNumberInText(text)
local re = regexMatch(text, regex3)
local name = re[1][2]
if not useData[name] then
useData[name] = amount
else
if math.abs(useData[name]-amount) == 1 then
useData[name] = amount
if not usedItems[name] then
usedItems[name] = 1
else
usedItems[name] = usedItems[name] + 1
end
end
end
refreshWaste()
end)
function toggleBetween()
if ui:isVisible() then
ui:hide()
ui2:show()
main.change:setText("Hunt")
else
ui:show()
ui2:hide()
main.change:setText("Loot")
end
end
function hideAll()
if not ui:isVisible() and not ui2:isVisible() then
ui:show()
ui2:hide()
else
ui:hide()
ui2:hide()
end
end
main.reset.onClick = function(widget)
resetSessionData()
end
main.toggle.onClick = function(widget)
hideAll()
end
main.change.onClick = function(widget)
toggleBetween()
end
function hourVal(v)
return (v/uptime)*3600
end
local lootWorth
local wasteWorth
local balance
local balanceDesc
local hourDesc
local desc
local hour
function bottingStats()
lootWorth = 0
wasteWorth = 0
for k, v in pairs(lootedItems) do
if LootItems[k] then
lootWorth = lootWorth + (LootItems[k]*v)
end
end
for k, v in pairs(usedItems) do
if LootItems[k] then
wasteWorth = wasteWorth + (LootItems[k]*v)
end
end
balance = lootWorth - wasteWorth
return lootWorth, wasteWorth, balance
end
function bottingLabels(lootWorth, wasteWorth, balance)
balanceDesc = nil
hourDesc = nil
desc = nil
if balance >= 1000000 or balance <= -1000000 then
desc = balance / 1000000
balanceDesc = math.floor(desc) .. "." .. math.floor(desc * 10) % 10 .. "kk"
elseif balance >= 1000 or balance <= -1000 then
desc = balance / 1000
balanceDesc = math.floor(desc) .. "." .. math.floor(desc * 10) % 10 .."k"
else
balanceDesc = balance .. "gp"
end
hour = hourVal(balance)
if hour >= 1000000 or hour <= -1000000 then
desc = balance / 1000000
hourDesc = math.floor(hourVal(desc)) .. "." .. math.floor(hourVal(desc) * 10) % 10 .. "kk/h"
elseif hour >= 1000 or hour <= -1000 then
desc = balance / 1000
hourDesc = math.floor(hourVal(desc)) .. "." .. math.floor(hourVal(desc) * 10) % 10 .. "k/h"
else
hourDesc = math.floor(hourVal(balance)) .. "gp/h"
end
return balanceDesc, hourDesc
end
function reportStats()
local lootWorth, wasteWorth, balance = bottingStats()
local balanceDesc, hourDesc = bottingLabels(lootWorth, wasteWorth, balance)
local a, b, c
a = "Session Time: " .. sessionTime() .. ", Exp Gained: " .. format_thousand(expGained()) .. ", Exp/h: " .. expPerHour()
b = " | Balance: " .. balanceDesc .. " (" .. hourDesc .. ")"
c = a..b
return c
end
macro(500, function()
local lootWorth, wasteWorth, balance = bottingStats()
local balanceDesc, hourDesc = bottingLabels(lootWorth, wasteWorth, balance)
-- hunting
ui.one:setText(sessionTime())
ui.two:setText(format_thousand(expGained()))
ui.three:setText(expPerHour())
ui.four:setText(timeToLevel())
ui.five:setText(format_thousand(burstDamageValue()))
ui.six:setText(format_thousand(totalDmg))
ui.seven:setText(format_thousand(valueInSeconds(dmgTable)))
ui.eight:setText(format_thousand(bestHit))
ui.nine:setText(format_thousand(totalHeal))
ui.ten:setText(format_thousand(valueInSeconds(healTable)))
ui.eleven:setText(format_thousand(bestHeal))
ui.dOne:setText(first)
ui.dTwo:setText(second)
ui.dThree:setText(third)
-- loot
ui2.loot:setText(format_thousand(lootWorth))
ui2.lootHour:setText(format_thousand(hourVal(lootWorth)))
ui2.supplies:setText(format_thousand(wasteWorth))
ui2.suppliesHour:setText(format_thousand(hourVal(wasteWorth)))
ui.balance:setColor(balance >= 0 and "green" or "red")
ui.balance:setText(balanceDesc .. " (" .. hourDesc .. ")")
end)

View File

@ -1,367 +0,0 @@
LootItemLabel < Label
opacity: 0.87
text-offset: 2 0
focusable: false
height: 16
MainAnalyzer < Panel
height: 45
padding: 4
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: 4
anchors.left: parent.left
anchors.right: parent.horizontalCenter
margin-right: 2
text: Reset
BotButton
id: change
anchors.top: toggle.bottom
margin-top: 4
anchors.left: parent.horizontalCenter
margin-left: 2
anchors.right: toggle.right
text-align: center
text: Loot
HuntingAnalyzer < Panel
height: 275
padding: 5
Label
id: SessionLabel
anchors.top: parent.top
anchors.left: parent.left
text: Session:
Label
id: XpGainLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: XP Gain:
Label
id: XpHourLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: XP/h:
Label
id: NextLevelLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Next Level:
Label
id: BalanceLabel
anchors.top: prev.bottom
margin-top: 5
anchors.left: parent.left
text: Balance
Label
id: BurstDamageLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Burst Damage:
Label
id: DamageDealtLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Damage Dealt:
Label
id: DPSLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: DPS:
Label
id: BestHitLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Best Hit:
Label
id: HealingDoneLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Healing Done:
Label
id: HPSLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: HPS:
Label
id: BestHealLabel
anchors.top: prev.bottom
anchors.left: parent.left
margin-top: 5
text: Best Heal:
Label
id: one
anchors.right: parent.right
anchors.verticalCenter: SessionLabel.verticalCenter
text-align: right
text: 00:00h
width: 150
Label
id: two
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: three
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: -
width: 150
Label
id: four
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: -
width: 150
Label
id: balance
anchors.top: prev.bottom
anchors.right: parent.right
margin-top: 5
text: 0
text-align: right
width: 150
Label
id: five
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: six
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: -
width: 150
Label
id: seven
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: eight
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: nine
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: ten
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
Label
id: eleven
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
text-align: right
text: 0
width: 150
HorizontalSeparator
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 3
Label
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 3
text-align: center
text: Damage Distribution
Label
id: dOne
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 5
text-align: center
text: -
Label
id: dTwo
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 5
text-align: center
text: -
Label
id: dThree
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 5
text-align: center
text: -
LootAnalyzer < Panel
height: 275
padding: 4
Label
id: first
anchors.top: parent.top
anchors.left: parent.left
text: Supplies
Label
anchors.top: prev.bottom
margin-top: 5
anchors.left: parent.left
text: Supplies/h
TextList
id: supplyList
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 3
height: 50
vertical-scrollbar: supplyListScrollBar
Label
id: second
anchors.top: prev.bottom
margin-top: 5
anchors.left: parent.left
text: Loot
Label
anchors.top: prev.bottom
margin-top: 5
anchors.left: parent.left
text: Loot/h
Label
id: supplies
anchors.top: parent.top
anchors.right: parent.right
width: 150
text: 0
text-align: right
Label
id: suppliesHour
anchors.top: prev.bottom
anchors.right: parent.right
margin-top: 5
text: 0
text-align: right
width: 150
Label
id: loot
anchors.top: second.top
anchors.right: parent.right
width: 150
text: 0
text-align: right
Label
id: lootHour
anchors.top: prev.bottom
anchors.right: parent.right
margin-top: 5
text: 0
text-align: right
width: 150
TextList
id: List
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 3
height: 120
vertical-scrollbar: ListScrollBar
VerticalScrollBar
id: ListScrollBar
anchors.top: List.top
anchors.bottom: List.bottom
anchors.right: List.right
step: 14
pixels-scroll: true
VerticalScrollBar
id: supplyListScrollBar
anchors.top: supplyList.top
anchors.bottom: supplyList.bottom
anchors.right: supplyList.right
step: 14
pixels-scroll: true

View File

@ -167,7 +167,7 @@ CaveBot.registerAction("goto", "green", function(value, retries, prev)
return true -- already at position
end
-- check if there's a path to that place, ignore creatures and fields
local path = findPath(playerPos, pos, maxDist, { ignoreNonPathable = true, precision = 1, ignoreCreatures = true })
local path = findPath(playerPos, pos, maxDist, { ignoreNonPathable = true, precision = 1, ignoreCreatures = true, allowUnseen = true, allowOnlyVisibleTiles = false })
if not path then
return false -- there's no way
end
@ -206,7 +206,7 @@ CaveBot.registerAction("goto", "green", function(value, retries, prev)
end
-- try to find path, don't ignore creatures, ignore fields
if CaveBot.walkTo(pos, maxDist, { ignoreNonPathable = true }) then
if CaveBot.walkTo(pos, maxDist, { ignoreNonPathable = true, allowUnseen = true, allowOnlyVisibleTiles = false }) then
return "retry"
end
@ -216,7 +216,7 @@ CaveBot.registerAction("goto", "green", function(value, retries, prev)
if stairs then
precison = 0
end
if CaveBot.walkTo(pos, 50, { ignoreNonPathable = true, precision = precison }) then
if CaveBot.walkTo(pos, 50, { ignoreNonPathable = true, precision = precison, allowUnseen = true, allowOnlyVisibleTiles = false }) then
return "retry"
end
end
@ -230,7 +230,7 @@ CaveBot.registerAction("goto", "green", function(value, retries, prev)
end
-- everything else failed, try to walk ignoring creatures, maybe will work
CaveBot.walkTo(pos, maxDist, { ignoreNonPathable = true, precision = 1, ignoreCreatures = true })
CaveBot.walkTo(pos, maxDist, { ignoreNonPathable = true, precision = 1, ignoreCreatures = true, allowUnseen = true, allowOnlyVisibleTiles = false })
return "retry"
end)

View File

@ -30,7 +30,7 @@ cavebotMacro = macro(20, function()
end
if CaveBot.doWalking() then
return -- executing walking
return -- executing walking3
end
local actions = ui.list:getChildCount()
@ -185,6 +185,20 @@ CaveBot.setOff = function(val)
config.setOff()
end
CaveBot.getCurrentProfile = function()
return storage._configs.cavebot_configs.selected
end
local botConfigName = modules.game_bot.contentsPanel.config:getCurrentOption().text
CaveBot.setCurrentProfile = function(name)
if not g_resources.fileExists("/bot/"..botConfigName.."/cavebot_configs/"..name..".cfg") then
return warn("there is no cavebot profile with that name!")
end
CaveBot.setOff()
storage._configs.cavebot_configs.selected = name
CaveBot.setOn()
end
CaveBot.delay = function(value)
cavebotMacro.delay = math.max(cavebotMacro.delay or 0, now + value)
end

View File

@ -1,13 +1,11 @@
CaveBot.Extensions.Depositor = {}
--local variables
local closedContainers = false
local reopenedContainers = false
local destination = nil
local lootTable = nil
local reopenedContainers = false
local function resetCache()
closedContainers = false
reopenedContainers = false
destination = nil
lootTable = nil
@ -41,21 +39,11 @@ CaveBot.Extensions.Depositor.setup = function()
-- backpacks etc
if value:lower() == "yes" then
-- reopening backpacks
if not reopenedContainers then
if not closedContainers then
if not CaveBot.CloseLootContainer() then
return "retry"
else
closedContainers = true
end
else
if not CaveBot.OpenLootContainer() then
return "retry"
else
reopenedContainers = true
end
end
CaveBot.CloseAllLootContainers()
delay(3000)
reopenedContainers = true
return "retry"
end
-- open next backpacks if no more loot
if not CaveBot.HasLootItems() then
@ -70,12 +58,14 @@ CaveBot.Extensions.Depositor.setup = function()
return "retry"
end
end
-- couldn't find next container, so we done
print("CaveBot[Depositor]: all items stashed, no backpack to open next, proceeding")
resetCache()
return true
end
end
-- couldn't find next container, so we done
print("CaveBot[Depositor]: all items stashed, no backpack to open next, proceeding")
CaveBot.CloseAllLootContainers()
delay(3000)
resetCache()
return true
end
end

View File

@ -35,7 +35,7 @@ end
]])
addExampleFunction("Check for stamina and imbues", [[
if stamina() < 900 or player:getSkillLevel(11) ~= 100 then CaveBot.setOff() return false else return true end
if stamina() < 900 or player:getSkillLevel(11) == 0 then CaveBot.setOff() return false else return true end
]])
addExampleFunction("buy 200 mana potion from npc Eryn", [[
@ -105,4 +105,10 @@ addExampleFunction("Logout", [[
g_game.safeLogout()
delay(1000)
return "retry"
]])
addExampleFunction("Close Loot Containers", [[
CaveBot.CloseAllLootContainers()
delay(3000)
return true
]])

View File

@ -5,6 +5,7 @@ local lureMax = 0
local anchorPosition = nil
local lastCall = now
local delayFrom = nil
local dynamicLureDelay = false
function getWalkableTilesCount(position)
local count = 0
@ -140,6 +141,7 @@ TargetBot.Creature.walk = function(creature, config, targets)
lureMax = config.lureMax
end
dynamicLureDelay = config.dynamicLureDelay
delayFrom = config.delayFrom
-- luring
@ -185,6 +187,7 @@ TargetBot.Creature.walk = function(creature, config, targets)
end
end
--target only movement
if config.avoidAttacks then
local diffx = cpos.x - pos.x
local diffy = cpos.y - pos.y
@ -235,6 +238,6 @@ onPlayerPositionChange(function(newPos, oldPos)
if not lureMax then return end
if storage.TargetBotDelayWhenPlayer then return end
if targetCount < (delayFrom or lureMax/2) or not target() then return end
if dynamicLureDelay and targetCount < (delayFrom or lureMax/2) or not target() then return end
CaveBot.delay(delayValue or 0)
end)

View File

@ -203,6 +203,20 @@ TargetBot.setOff = function(val)
config.setOff()
end
TargetBot.getCurrentProfile = function()
return storage._configs.targetbot_configs.selected
end
local botConfigName = modules.game_bot.contentsPanel.config:getCurrentOption().text
TargetBot.setCurrentProfile = function(name)
if not g_resources.fileExists("/bot/"..botConfigName.."/targetbot_configs/"..name..".json") then
return warn("there is no targetbot profile with that name!")
end
TargetBot.setOff()
storage._configs.targetbot_configs.selected = name
TargetBot.setOn()
end
TargetBot.delay = function(value)
targetbotMacro.delay = now + value
end

View File

@ -1075,7 +1075,7 @@ function getBestTileByPattern(pattern, minHp, maxHp, safePattern, monsterNamesTa
for i, tile in pairs(tiles) do
local tPos = tile:getPosition()
local distance = distanceFromPlayer(tPos)
if tile:canShoot() and tile:isWalkable() and (not safePattern or distance < 4) then
if tile:canShoot() and tile:isWalkable() and distance < 4 then
local amount = getMonstersInArea(2, tPos, pattern, minHp, maxHp, safePattern, monsterNamesTable)
if amount > targetTile.amount then
targetTile = {amount=amount,pos=tPos}
@ -1161,7 +1161,7 @@ macro(100, function()
if entry.enabled and manapercent() >= entry.mana then
if (entry.spell and canCast(entry.spell, not currentSettings.ignoreMana, not currentSettings.Cooldown)) or (entry.itemId > 100 and (not currentSettings.Visible or findItem(entry.itemId))) then
-- first PVP scenario
if currentSettings.pvpMode and target():getHealthPercent() >= entry.minHp and target():getHealthPercent() <= entry.maxHp then
if currentSettings.pvpMode and target():getHealthPercent() >= entry.minHp and target():getHealthPercent() <= entry.maxHp and target():canShoot() then
if entry.category == 2 then
return warn("[AttackBot] Area Runes cannot be used in PVP situation!")
else
@ -1186,7 +1186,7 @@ macro(100, function()
local anchorParam = (pattern == 2 or pattern == 6 or pattern == 7 or pattern > 9) and player or pos()
local safe = currentSettings.PvpSafe and spellPatterns[pCat][entry.pattern][2] or false
local monsterAmount = pCat ~= 8 and getMonstersInArea(entry.category, anchorParam, spellPatterns[pCat][entry.pattern][1], entry.minHp, entry.maxHp, safe, entry.monsters)
if (pattern ~= 8 and (entry.orMore and monsterAmount >= entry.count or not entry.orMore and monsterAmount == entry.count)) or pattern == 8 and bestSide >= entry.count then
if (pattern ~= 8 and (entry.orMore and monsterAmount >= entry.count or not entry.orMore and monsterAmount == entry.count)) or (pattern == 8 and bestSide >= entry.count and (not currentSettings.PvpSafe or getPlayers(2) == 0)) then
return executeAttackBotAction(entry.category, attackData, entry.cooldown)
end
elseif entry.category == 2 then

View File

@ -235,7 +235,7 @@ Panel
elseif config.cureElectrify and mana() >= config.electrifyCost and isEnergized() then say("exana vis")
end
end
if (not config.ignoreInPz or not isInPz()) and config.holdUtura and mana() >= config.uturaCost and not hasPartyBuff() then say(config.uturaType)
if (not config.ignoreInPz or not isInPz()) and config.holdUtura and mana() >= config.uturaCost and canCast(config.uturaType) and hppercent() < 90 then say(config.uturaType)
elseif (not config.ignoreInPz or not isInPz()) and config.holdUtana and mana() >= config.utanaCost and (not utanaCast or (now - utanaCast > 120000)) then say("utana vid") utanaCast = now
end
end)

View File

@ -441,19 +441,19 @@ end
onContainerOpen(function(container, previousContainer)
if renameContui.title:isOn() then
if not container.window then return end
local containerWindow = container.window
if not previousContainer then
if not container.window then return end
containerWindow = container.window
containerWindow:setContentHeight(34)
local storageVal = config.list
if storageVal and #storageVal > 0 then
for _, entry in pairs(storageVal) do
if entry.enabled and string.find(container:getContainerItem():getId(), entry.item) then
if entry.min then
containerWindow:minimize()
end
containerWindow:setText(entry.value)
end
local storageVal = config.list
if storageVal and #storageVal > 0 then
for _, entry in pairs(storageVal) do
if entry.enabled and string.find(container:getContainerItem():getId(), entry.item) then
if entry.min then
containerWindow:minimize()
end
containerWindow:setText(entry.value)
end
end
end
@ -476,7 +476,7 @@ local function properTable(t)
return r
end
macro(100, function()
macro(500, function()
if not config.sort and not config.purse then return end
local storageVal = config.list
@ -522,5 +522,5 @@ macro(100, function()
if config.purse and config.forceOpen and not getContainerByItem(23396) then
return use(getPurse())
end
delay(900)
delay(1500)
end)

View File

@ -1,3 +1,6 @@
local standBySpells = false
local standByItems = false
setDefaultTab("HP")
healPanelName = "healbot"
local ui = setupUI([[
@ -222,10 +225,14 @@ if rootWidget then
local label = UI.createWidget("SpellEntry", healWindow.spells.spellList)
label.enabled:setChecked(entry.enabled)
label.enabled.onClick = function(widget)
standBySpells = false
standByItems = false
entry.enabled = not entry.enabled
label.enabled:setChecked(entry.enabled)
end
label.remove.onClick = function(widget)
standBySpells = false
standByItems = false
table.removevalue(currentSettings.spellTable, entry)
reindexTable(currentSettings.spellTable)
label:destroy()
@ -245,10 +252,14 @@ if rootWidget then
local label = UI.createWidget("SpellEntry", healWindow.items.itemList)
label.enabled:setChecked(entry.enabled)
label.enabled.onClick = function(widget)
standBySpells = false
standByItems = false
entry.enabled = not entry.enabled
label.enabled:setChecked(entry.enabled)
end
label.remove.onClick = function(widget)
standBySpells = false
standByItems = false
table.removevalue(currentSettings.itemTable, entry)
reindexTable(currentSettings.itemTable)
label:destroy()
@ -414,6 +425,8 @@ if rootWidget then
healWindow.spells.spellValue:setText('')
healWindow.spells.manaCost:setText('')
end
standBySpells = false
standByItems = false
refreshSpells()
end
@ -455,6 +468,8 @@ if rootWidget then
if id > 100 then
table.insert(currentSettings.itemTable, {index = #currentSettings.itemTable+1,item = id, sign = equasion, origin = source, value = trigger, enabled = true})
standBySpells = false
standByItems = false
refreshItems()
healWindow.items.itemId:setItemId(0)
healWindow.items.itemValue:setText('')
@ -554,9 +569,6 @@ if rootWidget then
end
-- spells
local lastMana = mana()
local standBySpells = false
local iterationsSpells = 0
macro(100, function()
if standBySpells then return end
if not currentSettings.enabled or modules.game_cooldown.isGroupCooldownIconActive(2) or #currentSettings.spellTable == 0 then return end
@ -625,7 +637,6 @@ macro(100, function()
end)
-- items
local standByItems = false
macro(100, function()
if standByItems then return end
if not currentSettings.enabled or #currentSettings.itemTable == 0 then return end

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