mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-12-16 00:49:46 +01:00
Updated to OTCv8 3.1 rev 118
This commit is contained in:
@@ -890,6 +890,10 @@ if rootWidget then
|
||||
currentSettings.PvpSafe = not currentSettings.PvpSafe
|
||||
settingsUI.PvpSafe:setChecked(currentSettings.PvpSafe)
|
||||
end
|
||||
settingsUI.Training.onClick = function(widget)
|
||||
currentSettings.Training = not currentSettings.Training
|
||||
settingsUI.Training:setChecked(currentSettings.Training)
|
||||
end
|
||||
settingsUI.BlackListSafe.onClick = function(widget)
|
||||
currentSettings.BlackListSafe = not currentSettings.BlackListSafe
|
||||
settingsUI.BlackListSafe:setChecked(currentSettings.BlackListSafe)
|
||||
@@ -950,7 +954,7 @@ if rootWidget then
|
||||
settingsUI.Rotate:setChecked(currentSettings.Rotate)
|
||||
settingsUI.Kills:setChecked(currentSettings.Kills)
|
||||
settingsUI.KillsAmount:setValue(currentSettings.KillsAmount)
|
||||
|
||||
settingsUI.Training:setChecked(currentSettings.Training)
|
||||
end
|
||||
loadSettings()
|
||||
|
||||
@@ -1038,7 +1042,7 @@ function getMonstersInArea(category, posOrCreature, pattern, minHp, maxHp, safeP
|
||||
|
||||
if safePattern then
|
||||
for i, spec in pairs(getSpectators(posOrCreature, safePattern)) do
|
||||
if spec ~= player and spec:isPlayer() then
|
||||
if spec ~= player and (spec:isPlayer() and not spec:isPartyMember()) then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
@@ -1100,6 +1104,8 @@ macro(100, function()
|
||||
if not currentSettings.enabled then return end
|
||||
if #currentSettings.attackTable == 0 or isInPz() or not target() or modules.game_cooldown.isGroupCooldownIconActive(1) then return end
|
||||
|
||||
if currentSettings.Training and target() and target():getName():lower():find("training") then return end
|
||||
|
||||
if g_game.getClientVersion() < 960 or not currentSettings.Cooldown then
|
||||
delay(400)
|
||||
end
|
||||
|
||||
@@ -504,6 +504,14 @@ SettingsPanel < Panel
|
||||
width: 245
|
||||
text: PVP safe
|
||||
|
||||
CheckBox
|
||||
id: Training
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: prev.left
|
||||
margin-top: 8
|
||||
width: 245
|
||||
text: Stop when attacking trainers
|
||||
|
||||
CheckBox
|
||||
id: BlackListSafe
|
||||
anchors.top: prev.bottom
|
||||
@@ -523,7 +531,7 @@ SettingsPanel < Panel
|
||||
minimum: 1
|
||||
maximum: 10
|
||||
focusable: true
|
||||
margin-left: 5
|
||||
margin-left: 5
|
||||
|
||||
AttackBotWindow < MainWindow
|
||||
size: 535 300
|
||||
|
||||
638
modules/game_bot/default_configs/vBot_4.0/vBot/Equipper.lua
Normal file
638
modules/game_bot/default_configs/vBot_4.0/vBot/Equipper.lua
Normal file
@@ -0,0 +1,638 @@
|
||||
local panelName = "EquipperPanel"
|
||||
local ui = setupUI([[
|
||||
Panel
|
||||
height: 19
|
||||
|
||||
BotSwitch
|
||||
id: switch
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text-align: center
|
||||
width: 130
|
||||
!text: tr('EQ Manager')
|
||||
|
||||
Button
|
||||
id: setup
|
||||
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 = false,
|
||||
rules = {}
|
||||
}
|
||||
end
|
||||
|
||||
local config = storage[panelName]
|
||||
|
||||
ui.switch:setOn(config.enabled)
|
||||
ui.switch.onClick = function(widget)
|
||||
config.enabled = not config.enabled
|
||||
widget:setOn(config.enabled)
|
||||
end
|
||||
|
||||
local conditions = { -- always add new conditions at the bottom
|
||||
"Item is available and not worn.", -- nothing 1
|
||||
"Monsters around is more than: ", -- spinbox 2
|
||||
"Monsters around is less than: ", -- spinbox 3
|
||||
"Health precent is below:", -- spinbox 4
|
||||
"Health precent is above:", -- spinbox 5
|
||||
"Mana precent is below:", -- spinbox 6
|
||||
"Mana precent is above:", -- spinbox 7
|
||||
"Target name is:", -- BotTextEdit 8
|
||||
"Hotkey is being pressed:", -- BotTextEdit 9
|
||||
"Player is paralyzed", -- nothing 10
|
||||
"Player is in protection zone", -- nothing 11
|
||||
"Players around is more than:", -- spinbox 12
|
||||
"Players around is less than:" -- spinbox 13
|
||||
}
|
||||
|
||||
local conditionNumber = 1
|
||||
local optionalConditionNumber = 2
|
||||
|
||||
local mainWindow = UI.createWindow("EquipWindow")
|
||||
mainWindow:hide()
|
||||
|
||||
ui.setup.onClick = function()
|
||||
mainWindow:show()
|
||||
mainWindow:raise()
|
||||
mainWindow:focus()
|
||||
end
|
||||
|
||||
mainWindow.closeButton.onClick = function()
|
||||
mainWindow:hide()
|
||||
resetFields()
|
||||
end
|
||||
|
||||
local inputPanel = mainWindow.inputPanel
|
||||
local listPanel = mainWindow.listPanel
|
||||
|
||||
inputPanel.optionalCondition:hide()
|
||||
inputPanel.useSecondCondition.onOptionChange = function(widget, option, data)
|
||||
if option ~= "-" then
|
||||
inputPanel.optionalCondition:show()
|
||||
else
|
||||
inputPanel.optionalCondition:hide()
|
||||
end
|
||||
end
|
||||
|
||||
inputPanel.unequip.onClick = function()
|
||||
local value = 115
|
||||
local panel = inputPanel.unequipPanel
|
||||
local height = panel:getHeight()
|
||||
if height == 0 then
|
||||
panel:setHeight(value)
|
||||
mainWindow:setHeight(mainWindow:getHeight()+value)
|
||||
inputPanel:setHeight(inputPanel:getHeight()+value)
|
||||
listPanel:setHeight(listPanel:getHeight()+value)
|
||||
else
|
||||
panel:setHeight(0)
|
||||
mainWindow:setHeight(mainWindow:getHeight()-value)
|
||||
inputPanel:setHeight(inputPanel:getHeight()-value)
|
||||
listPanel:setHeight(listPanel:getHeight()-value)
|
||||
end
|
||||
end
|
||||
|
||||
local function setCondition(first, n)
|
||||
local widget
|
||||
local spinBox
|
||||
local textEdit
|
||||
|
||||
if first then
|
||||
widget = inputPanel.condition.description.text
|
||||
spinBox = inputPanel.condition.spinbox
|
||||
textEdit = inputPanel.condition.text
|
||||
else
|
||||
widget = inputPanel.optionalCondition.description.text
|
||||
spinBox = inputPanel.optionalCondition.spinbox
|
||||
textEdit = inputPanel.optionalCondition.text
|
||||
end
|
||||
|
||||
-- reset values after change
|
||||
spinBox:setValue(0)
|
||||
textEdit:setText('')
|
||||
|
||||
if n == 1 or n == 10 or n == 11 then
|
||||
spinBox:hide()
|
||||
textEdit:hide()
|
||||
elseif n == 9 or n == 8 then
|
||||
spinBox:hide()
|
||||
textEdit:show()
|
||||
if n == 9 then
|
||||
textEdit:setWidth(75)
|
||||
else
|
||||
textEdit:setWidth(200)
|
||||
end
|
||||
else
|
||||
spinBox:show()
|
||||
textEdit:hide()
|
||||
end
|
||||
widget:setText(conditions[n])
|
||||
end
|
||||
|
||||
-- add default text & windows
|
||||
setCondition(true, 1)
|
||||
setCondition(false, 2)
|
||||
|
||||
-- in/de/crementation buttons
|
||||
inputPanel.condition.nex.onClick = function()
|
||||
local max = #conditions
|
||||
|
||||
if inputPanel.optionalCondition:isVisible() then
|
||||
if conditionNumber == max then
|
||||
if optionalConditionNumber == 1 then
|
||||
conditionNumber = 2
|
||||
else
|
||||
conditionNumber = 1
|
||||
end
|
||||
else
|
||||
local futureNumber = conditionNumber + 1
|
||||
local safeFutureNumber = conditionNumber + 2 > max and 1 or conditionNumber + 2
|
||||
conditionNumber = futureNumber ~= optionalConditionNumber and futureNumber or safeFutureNumber
|
||||
end
|
||||
else
|
||||
conditionNumber = conditionNumber == max and 1 or conditionNumber + 1
|
||||
if optionalConditionNumber == conditionNumber then
|
||||
optionalConditionNumber = optionalConditionNumber == max and 1 or optionalConditionNumber + 1
|
||||
setCondition(false, optionalConditionNumber)
|
||||
end
|
||||
end
|
||||
setCondition(true, conditionNumber)
|
||||
end
|
||||
|
||||
inputPanel.condition.pre.onClick = function()
|
||||
local max = #conditions
|
||||
|
||||
if inputPanel.optionalCondition:isVisible() then
|
||||
if conditionNumber == 1 then
|
||||
if optionalConditionNumber == max then
|
||||
conditionNumber = max-1
|
||||
else
|
||||
conditionNumber = max
|
||||
end
|
||||
else
|
||||
local futureNumber = conditionNumber - 1
|
||||
local safeFutureNumber = conditionNumber - 2 < 1 and max or conditionNumber - 2
|
||||
conditionNumber = futureNumber ~= optionalConditionNumber and futureNumber or safeFutureNumber
|
||||
end
|
||||
else
|
||||
conditionNumber = conditionNumber == 1 and max or conditionNumber - 1
|
||||
if optionalConditionNumber == conditionNumber then
|
||||
optionalConditionNumber = optionalConditionNumber == 1 and max or optionalConditionNumber - 1
|
||||
setCondition(false, optionalConditionNumber)
|
||||
end
|
||||
end
|
||||
setCondition(true, conditionNumber)
|
||||
end
|
||||
|
||||
inputPanel.optionalCondition.nex.onClick = function()
|
||||
local max = #conditions
|
||||
|
||||
if optionalConditionNumber == max then
|
||||
if conditionNumber == 1 then
|
||||
optionalConditionNumber = 2
|
||||
else
|
||||
optionalConditionNumber = 1
|
||||
end
|
||||
else
|
||||
local futureNumber = optionalConditionNumber + 1
|
||||
local safeFutureNumber = optionalConditionNumber + 2 > max and 1 or optionalConditionNumber + 2
|
||||
optionalConditionNumber = futureNumber ~= conditionNumber and futureNumber or safeFutureNumber
|
||||
end
|
||||
setCondition(false, optionalConditionNumber)
|
||||
end
|
||||
|
||||
inputPanel.optionalCondition.pre.onClick = function()
|
||||
local max = #conditions
|
||||
|
||||
if optionalConditionNumber == 1 then
|
||||
if conditionNumber == max then
|
||||
optionalConditionNumber = max-1
|
||||
else
|
||||
optionalConditionNumber = max
|
||||
end
|
||||
else
|
||||
local futureNumber = optionalConditionNumber - 1
|
||||
local safeFutureNumber = optionalConditionNumber - 2 < 1 and max or optionalConditionNumber - 2
|
||||
optionalConditionNumber = futureNumber ~= conditionNumber and futureNumber or safeFutureNumber
|
||||
end
|
||||
setCondition(false, optionalConditionNumber)
|
||||
end
|
||||
|
||||
listPanel.up.onClick = function()
|
||||
local n = listPanel.list:getChildIndex(listPanel.list:getFocusedChild())
|
||||
local t = config.rules
|
||||
|
||||
t[n], t[n-1] = t[n-1], t[n]
|
||||
listPanel.up:setEnabled(false)
|
||||
listPanel.down:setEnabled(false)
|
||||
refreshRules()
|
||||
end
|
||||
|
||||
listPanel.down.onClick = function()
|
||||
local n = listPanel.list:getChildIndex(listPanel.list:getFocusedChild())
|
||||
local t = config.rules
|
||||
|
||||
t[n], t[n+1] = t[n+1], t[n]
|
||||
listPanel.up:setEnabled(false)
|
||||
listPanel.down:setEnabled(false)
|
||||
refreshRules()
|
||||
end
|
||||
|
||||
function getItemsFromBox()
|
||||
local t = {}
|
||||
|
||||
for i, child in ipairs(inputPanel.itemBox:getChildren()) do
|
||||
local id = child:getItemId()
|
||||
if id > 100 then
|
||||
table.insert(t, id)
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
function refreshItemBox(reset)
|
||||
local max = 8
|
||||
local box = inputPanel.itemBox
|
||||
local childAmount = box:getChildCount()
|
||||
|
||||
if reset then
|
||||
box:destroyChildren()
|
||||
local widget = UI.createWidget("BotItem", box)
|
||||
widget.onItemChange = function(widget)
|
||||
local id = widget:getItemId()
|
||||
local index = box:getChildIndex(widget)
|
||||
if id < 100 or (table.find(getItemsFromBox(), id) ~= index) then
|
||||
widget:destroy()
|
||||
end
|
||||
refreshItemBox()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if childAmount == 0 then
|
||||
local widget = UI.createWidget("BotItem", box)
|
||||
widget.onItemChange = function(widget)
|
||||
local id = widget:getItemId()
|
||||
local index = box:getChildIndex(widget)
|
||||
if id < 100 or (table.find(getItemsFromBox(), id) ~= index) then
|
||||
widget:destroy()
|
||||
end
|
||||
refreshItemBox()
|
||||
refreshItemBox()
|
||||
end
|
||||
elseif box:getLastChild():getItemId() > 100 and childAmount < max then
|
||||
local widget = UI.createWidget("BotItem", box)
|
||||
widget.onItemChange = function(widget)
|
||||
local id = widget:getItemId()
|
||||
local index = box:getChildIndex(widget)
|
||||
if id < 100 or (table.find(getItemsFromBox(), id) ~= index) then
|
||||
widget:destroy()
|
||||
end
|
||||
refreshItemBox()
|
||||
refreshItemBox()
|
||||
end
|
||||
end
|
||||
end
|
||||
refreshItemBox()
|
||||
|
||||
local function resetFields()
|
||||
refreshItemBox(true)
|
||||
inputPanel.name:setText('')
|
||||
conditionNumber = 1
|
||||
optionalConditionNumber = 2
|
||||
setCondition(false, optionalConditionNumber)
|
||||
setCondition(true, conditionNumber)
|
||||
inputPanel.useSecondCondition:setCurrentOption("-")
|
||||
for i, child in pairs(inputPanel.unequipPanel:getChildren()) do
|
||||
child:setChecked(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- buttons disabled by default
|
||||
listPanel.up:setEnabled(false)
|
||||
listPanel.down:setEnabled(false)
|
||||
function refreshRules()
|
||||
local list = listPanel.list
|
||||
|
||||
list:destroyChildren()
|
||||
for i,v in pairs(config.rules) do
|
||||
local widget = UI.createWidget('Rule', list)
|
||||
widget:setText(v.name)
|
||||
widget.remove.onClick = function()
|
||||
widget:destroy()
|
||||
table.remove(config.rules, table.find(config.rules, v))
|
||||
listPanel.up:setEnabled(false)
|
||||
listPanel.down:setEnabled(false)
|
||||
refreshRules()
|
||||
end
|
||||
widget.visible:setColor(v.visible and "green" or "red")
|
||||
widget.visible.onClick = function()
|
||||
v.visible = not v.visible
|
||||
widget.visible:setColor(v.visible and "green" or "red")
|
||||
end
|
||||
widget.enabled:setChecked(v.enabled)
|
||||
widget.enabled.onClick = function()
|
||||
v.enabled = not v.enabled
|
||||
widget.enabled:setChecked(v.enabled)
|
||||
end
|
||||
local desc
|
||||
for i, v in ipairs(v.items) do
|
||||
if i == 1 then
|
||||
desc = "items: " .. v
|
||||
else
|
||||
desc = desc .. ", " .. v
|
||||
end
|
||||
end
|
||||
widget:setTooltip(desc)
|
||||
widget.onClick = function()
|
||||
local panel = listPanel
|
||||
if #panel.list:getChildren() == 1 then
|
||||
panel.up:setEnabled(false)
|
||||
panel.down:setEnabled(false)
|
||||
elseif panel.list:getChildIndex(panel.list:getFocusedChild()) == 1 then
|
||||
panel.up:setEnabled(false)
|
||||
panel.down:setEnabled(true)
|
||||
elseif panel.list:getChildIndex(panel.list:getFocusedChild()) == #panel.list:getChildren() then
|
||||
panel.up:setEnabled(true)
|
||||
panel.down:setEnabled(false)
|
||||
else
|
||||
panel.up:setEnabled(true)
|
||||
panel.down:setEnabled(true)
|
||||
end
|
||||
end
|
||||
widget.onDoubleClick = function()
|
||||
-- main
|
||||
conditionNumber = v.mainCondition
|
||||
setCondition(true, conditionNumber)
|
||||
if conditionNumber == 8 or conditionNumber == 9 then
|
||||
inputPanel.condition.text:setText(v.mainValue)
|
||||
elseif conditionNumber ~= 1 then
|
||||
inputPanel.condition.spinbox:setValue(v.mainValue)
|
||||
end
|
||||
-- relation
|
||||
inputPanel.useSecondCondition:setCurrentOption(v.relation)
|
||||
-- optional
|
||||
if v.relation ~= "-" then
|
||||
optionalConditionNumber = v.optionalCondition
|
||||
setCondition(false, optionalConditionNumber)
|
||||
if optionalConditionNumber == 8 or optionalConditionNumber == 9 then
|
||||
inputPanel.optionalCondition.text:setText(v.optValue)
|
||||
elseif optionalConditionNumber ~= 1 then
|
||||
inputPanel.optionalCondition.spinbox:setValue(v.optValue)
|
||||
end
|
||||
end
|
||||
-- name
|
||||
inputPanel.name:setText(v.name)
|
||||
-- items
|
||||
inputPanel.itemBox:destroyChildren()
|
||||
for i, item in ipairs(v.items) do
|
||||
local widget = UI.createWidget("BotItem", inputPanel.itemBox)
|
||||
widget:setItemId(item)
|
||||
widget.onItemChange = function(widget)
|
||||
local id = widget:getItemId()
|
||||
local index = box:getChildIndex(widget)
|
||||
if id < 100 or (table.find(getItemsFromBox(), id) ~= index) then
|
||||
widget:destroy()
|
||||
end
|
||||
refreshItemBox()
|
||||
end
|
||||
end
|
||||
-- unequip
|
||||
if type(v.unequip) == "table" then
|
||||
for i, tick in ipairs(v.unequip) do
|
||||
local checkbox = inputPanel.unequipPanel:getChildren()[i]
|
||||
checkbox:setChecked(tick)
|
||||
end
|
||||
end
|
||||
refreshItemBox()
|
||||
-- remove value
|
||||
table.remove(config.rules, table.find(config.rules, v))
|
||||
refreshRules()
|
||||
end
|
||||
end
|
||||
end
|
||||
refreshRules()
|
||||
|
||||
inputPanel.addButton.onClick = function()
|
||||
local mainVal
|
||||
local optVal
|
||||
local relation = inputPanel.useSecondCondition:getText()
|
||||
local name = inputPanel.name:getText()
|
||||
local items = getItemsFromBox()
|
||||
local unequip = {}
|
||||
|
||||
for i, child in pairs(inputPanel.unequipPanel:getChildren()) do
|
||||
if child:isChecked() then
|
||||
table.insert(unequip, true)
|
||||
else
|
||||
table.insert(unequip, false)
|
||||
end
|
||||
end
|
||||
|
||||
if conditionNumber == 1 then
|
||||
mainVal = nil
|
||||
elseif conditionNumber == 8 then
|
||||
mainVal = inputPanel.condition.text:getText()
|
||||
if mainVal:len() == 0 then
|
||||
return warn("[vBot Equipper] Please fill the name of the creature.")
|
||||
end
|
||||
elseif conditionNumber == 9 then
|
||||
mainVal = inputPanel.condition.text:getText()
|
||||
if mainVal:len() == 0 then
|
||||
return warn("[vBot Equipper] Please set correct hotkey.")
|
||||
end
|
||||
else
|
||||
mainVal = inputPanel.condition.spinbox:getValue()
|
||||
end
|
||||
|
||||
if relation ~= "-" then
|
||||
if optionalConditionNumber == 1 then
|
||||
optVal = nil
|
||||
elseif optionalConditionNumber == 8 then
|
||||
optVal = inputPanel.optionalCondition.text:getText()
|
||||
if optVal:len() == 0 then
|
||||
return warn("[vBot Equipper] Please fill the name of the creature.")
|
||||
end
|
||||
elseif optionalConditionNumber == 9 then
|
||||
optVal = inputPanel.optionalCondition.text:getText()
|
||||
if optVal:len() == 0 then
|
||||
return warn("[vBot Equipper] Please set correct hotkey.")
|
||||
end
|
||||
else
|
||||
optVal = inputPanel.optionalCondition.spinbox:getValue()
|
||||
end
|
||||
end
|
||||
|
||||
if #items == 0 then
|
||||
return warn("[vBot Equipper] Please add items.")
|
||||
end
|
||||
|
||||
if #name == 0 then
|
||||
return warn("[vBot Equipper] Please fill name of the profile.")
|
||||
end
|
||||
for i, child in pairs(listPanel.list:getChildren()) do
|
||||
if child:getText() == name then
|
||||
return warn("[vBot Equipper] There is already rule with this name! Choose different or remove old one.")
|
||||
end
|
||||
end
|
||||
|
||||
-- add
|
||||
table.insert(config.rules, {
|
||||
enabled = true,
|
||||
visible = true,
|
||||
mainCondition = conditionNumber,
|
||||
optionalCondition = optionalConditionNumber,
|
||||
mainValue = mainVal,
|
||||
optValue = optVal,
|
||||
relation = relation,
|
||||
items = items,
|
||||
name = name,
|
||||
unequip = unequip
|
||||
})
|
||||
|
||||
refreshRules()
|
||||
resetFields()
|
||||
end
|
||||
|
||||
--"Item is available and not worn.", -- nothing 1
|
||||
--"Monsters around is more than: ", -- spinbox 2
|
||||
--"Monsters around is less than: ", -- spinbox 3
|
||||
--"Health precent is below:", -- spinbox 4
|
||||
--"Health precent is above:", -- spinbox 5
|
||||
--"Mana precent is below:", -- spinbox 6
|
||||
--"Mana precent is above:", -- spinbox 7
|
||||
--"Target name is:", -- BotTextEdit 8
|
||||
--"Hotkey is being pressed:", -- Button 9
|
||||
--"Player is paralyzed", -- nothing 10
|
||||
|
||||
local pressedKey = ""
|
||||
onKeyPress(function(keys)
|
||||
pressedKey = keys
|
||||
end)
|
||||
|
||||
local function interpreteCondition(n, v)
|
||||
local hp = hppercent()
|
||||
local mp = manapercent()
|
||||
local mobs = getMonsters()
|
||||
local players = getPlayers()
|
||||
|
||||
if n == 1 then
|
||||
return true
|
||||
elseif n == 2 then
|
||||
return mobs > v
|
||||
elseif n == 3 then
|
||||
return mobs < v
|
||||
elseif n == 4 then
|
||||
return hp < v
|
||||
elseif n == 5 then
|
||||
return hp > v
|
||||
elseif n == 6 then
|
||||
return mp < v
|
||||
elseif n == 7 then
|
||||
return mp > v
|
||||
elseif n == 8 then
|
||||
return target() and target():getName():lower() == v:lower() or false
|
||||
elseif n == 9 then
|
||||
return pressedKey == v
|
||||
elseif n == 10 then
|
||||
return isParalyzed()
|
||||
elseif n == 11 then
|
||||
return isInPz()
|
||||
elseif n == 12 then
|
||||
return players > v
|
||||
elseif n == 13 then
|
||||
return players < v
|
||||
end
|
||||
end
|
||||
|
||||
local function finalCheck(first,relation,second)
|
||||
if relation == "-" then
|
||||
return first
|
||||
elseif relation == "and" then
|
||||
return first and second
|
||||
elseif relation == "or" then
|
||||
return first or second
|
||||
end
|
||||
end
|
||||
|
||||
local function isEquipped(id)
|
||||
local t = {getNeck(), getHead(), getBody(), getRight(), getLeft(), getLeg(), getFeet(), getFinger(), getAmmo()}
|
||||
local ids = {id, getInactiveItemId(id), getActiveItemId(id)}
|
||||
|
||||
for i, slot in pairs(t) do
|
||||
if slot and table.find(ids, slot:getId()) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function unequipItem(table)
|
||||
--[[
|
||||
head
|
||||
neck
|
||||
torso
|
||||
left
|
||||
right
|
||||
legs
|
||||
finger
|
||||
ammo slot
|
||||
boots
|
||||
]]
|
||||
local slots = {getHead(), getNeck(), getBody(), getLeft(), getRight(), getLeg(), getFinger(), getAmmo(), getFeet()}
|
||||
|
||||
if type(table) ~= "table" then return end
|
||||
for i, slot in pairs(table) do
|
||||
local physicalSlot = slots[i]
|
||||
|
||||
if slot and physicalSlot then
|
||||
g_game.equipItemId(physicalSlot:getId())
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
EquipManager = macro(50, function()
|
||||
if not config.enabled then return end
|
||||
if #config.rules == 0 then return end
|
||||
|
||||
for i, rule in ipairs(config.rules) do
|
||||
if rule.enabled then
|
||||
local firstCondition = interpreteCondition(rule.mainCondition, rule.mainValue)
|
||||
local optionalCondition = nil
|
||||
if rule.relation ~= "-" then
|
||||
optionalCondition = interpreteCondition(rule.optionalCondition, rule.optValue)
|
||||
end
|
||||
|
||||
if finalCheck(firstCondition, rule.relation, optionalCondition) then
|
||||
if unequipItem(rule.unequip) == true then
|
||||
delay(200)
|
||||
return
|
||||
end
|
||||
for i, item in ipairs(rule.items) do
|
||||
if not isEquipped(item) then
|
||||
if rule.visible then
|
||||
if itemAmount(item) > 0 then
|
||||
delay(200)
|
||||
return g_game.equipItemId(item)
|
||||
end
|
||||
else
|
||||
delay(200)
|
||||
return g_game.equipItemId(item)
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
pressedKey = ""
|
||||
end)
|
||||
@@ -11,7 +11,6 @@
|
||||
br, Vithrax
|
||||
]]
|
||||
|
||||
local rightPanelButtons = modules.game_buttons.buttonsWindow.contentsPanel.buttons
|
||||
local analyzerButton
|
||||
|
||||
--destroy old windows
|
||||
@@ -75,7 +74,8 @@ local toggleAnalyzer = function(window)
|
||||
end
|
||||
|
||||
-- create analyzers button
|
||||
analyzerButton = rightPanelButtons.botAnalyzersButton
|
||||
analyzerButton = modules.game_buttons.buttonsWindow.contentsPanel and modules.game_buttons.buttonsWindow.contentsPanel.buttons.botAnalyzersButton
|
||||
analyzerButton = analyzerButton or modules.client_topmenu.getButton("botAnalyzersButton")
|
||||
if analyzerButton then
|
||||
analyzerButton:destroy()
|
||||
end
|
||||
@@ -85,7 +85,6 @@ analyzerButton = modules.client_topmenu.addRightGameToggleButton('botAnalyzersBu
|
||||
analyzerButton:setOn(false)
|
||||
|
||||
--toggles window
|
||||
local button = mainWindow.contentsPanel
|
||||
mainWindow.contentsPanel.HuntingAnalyzer.onClick = function()
|
||||
toggleAnalyzer(huntingWindow)
|
||||
end
|
||||
@@ -901,6 +900,7 @@ onTextMessage(function(mode, text)
|
||||
end)
|
||||
|
||||
function hourVal(v)
|
||||
v = v or 0
|
||||
return (v/uptime)*3600
|
||||
end
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ dofile("/cavebot/lure.lua")
|
||||
dofile("/cavebot/bank.lua")
|
||||
dofile("/cavebot/clear_tile.lua")
|
||||
dofile("/cavebot/tasker.lua")
|
||||
dofile("/cavebot/imbuing.lua")
|
||||
-- main cavebot file, must be last
|
||||
dofile("/cavebot/cavebot.lua")
|
||||
|
||||
|
||||
374
modules/game_bot/default_configs/vBot_4.0/vBot/equipper.otui
Normal file
374
modules/game_bot/default_configs/vBot_4.0/vBot/equipper.otui
Normal file
@@ -0,0 +1,374 @@
|
||||
ConditionBoxPopupMenu < ComboBoxPopupMenu
|
||||
ConditionBoxPopupMenuButton < ComboBoxPopupMenuButton
|
||||
ConditionBox < ComboBox
|
||||
@onSetup: |
|
||||
self:addOption("-")
|
||||
self:addOption("and")
|
||||
self:addOption("or")
|
||||
|
||||
PreButton < PreviousButton
|
||||
background: #363636
|
||||
height: 15
|
||||
|
||||
NexButton < NextButton
|
||||
background: #363636
|
||||
height: 15
|
||||
|
||||
CondidionLabel < FlatPanel
|
||||
padding: 1
|
||||
height: 15
|
||||
|
||||
Label
|
||||
id: text
|
||||
anchors.fill: parent
|
||||
text-align: center
|
||||
font: verdana-11px-rounded
|
||||
background: #363636
|
||||
|
||||
Rule < UIWidget
|
||||
background-color: alpha
|
||||
text-offset: 18 2
|
||||
focusable: true
|
||||
height: 16
|
||||
text-align: left
|
||||
font: verdana-11px-rounded
|
||||
|
||||
CheckBox
|
||||
id: enabled
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 15
|
||||
height: 15
|
||||
margin-top: 2
|
||||
margin-left: 3
|
||||
tooltip: Entry enabled/disabled
|
||||
|
||||
$focus:
|
||||
background-color: #00000055
|
||||
|
||||
Button
|
||||
id: remove
|
||||
text: X
|
||||
anchors.right: parent.right
|
||||
margin-right: 15
|
||||
width: 14
|
||||
height: 14
|
||||
text-align: center
|
||||
tooltip: Remove entry
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Button
|
||||
id: visible
|
||||
text: V
|
||||
anchors.right: prev.left
|
||||
margin-right: 3
|
||||
width: 14
|
||||
height: 14
|
||||
text-align: center
|
||||
tooltip: Items must be visible
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
|
||||
ConditionPanel < Panel
|
||||
height: 55
|
||||
|
||||
NexButton
|
||||
id: nex
|
||||
anchors.top: parent.top
|
||||
margin-top: 5
|
||||
anchors.right: parent.right
|
||||
|
||||
PreButton
|
||||
id: pre
|
||||
anchors.top: parent.top
|
||||
margin-top: 5
|
||||
anchors.left: parent.left
|
||||
|
||||
CondidionLabel
|
||||
id: description
|
||||
anchors.top: parent.top
|
||||
margin-top: 5
|
||||
anchors.left: prev.right
|
||||
anchors.right: nex.left
|
||||
margin-left: 3
|
||||
margin-right: 3
|
||||
|
||||
SpinBox
|
||||
id: spinbox
|
||||
anchors.top: description.bottom
|
||||
margin-top: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: 100
|
||||
text-align: center
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
focusable: true
|
||||
|
||||
BotTextEdit
|
||||
id: text
|
||||
anchors.top: description.bottom
|
||||
margin-top: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: 200
|
||||
text-align: center
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ListPanel < FlatPanel
|
||||
size: 270 265
|
||||
padding-left: 10
|
||||
padding-right: 10
|
||||
padding-bottom: 10
|
||||
|
||||
Label
|
||||
id: title
|
||||
anchors.verticalCenter: parent.top
|
||||
anchors.left: parent.left
|
||||
text: Rules List
|
||||
font: verdana-11px-rounded
|
||||
color: #FABD02
|
||||
|
||||
Label
|
||||
id: mainLabel
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
margin-top: 10
|
||||
margin-left: 2
|
||||
!text: tr('More important methods come first.')
|
||||
text-align: left
|
||||
font: verdana-11px-rounded
|
||||
color: #aeaeae
|
||||
|
||||
TextList
|
||||
id: list
|
||||
anchors.fill: parent
|
||||
margin-top: 25
|
||||
margin-bottom: 18
|
||||
vertical-scrollbar: listScrollBar
|
||||
padding: 2
|
||||
|
||||
VerticalScrollBar
|
||||
id: listScrollBar
|
||||
anchors.top: list.top
|
||||
anchors.bottom: list.bottom
|
||||
anchors.right: list.right
|
||||
step: 14
|
||||
pixels-scroll: true
|
||||
|
||||
Button
|
||||
id: up
|
||||
anchors.right: parent.right
|
||||
anchors.top: list.bottom
|
||||
size: 60 17
|
||||
text: Move Up
|
||||
text-align: center
|
||||
font: cipsoftFont
|
||||
margin-top: 5
|
||||
|
||||
Button
|
||||
id: down
|
||||
anchors.right: prev.left
|
||||
anchors.verticalCenter: prev.verticalCenter
|
||||
size: 60 17
|
||||
margin-right: 5
|
||||
text: Move Down
|
||||
text-align: center
|
||||
font: cipsoftFont
|
||||
|
||||
|
||||
|
||||
Unequip < Panel
|
||||
height: 0
|
||||
padding: 5
|
||||
layout:
|
||||
type: verticalBox
|
||||
|
||||
CheckBox
|
||||
text: Head Slot
|
||||
|
||||
CheckBox
|
||||
text: Neck Slot
|
||||
|
||||
CheckBox
|
||||
text: Torso Slot
|
||||
|
||||
CheckBox
|
||||
text: Left Hand Slot
|
||||
|
||||
CheckBox
|
||||
text: Right Hand Slot
|
||||
|
||||
CheckBox
|
||||
text: Legs Slot
|
||||
|
||||
CheckBox
|
||||
text: Finger Slot
|
||||
|
||||
CheckBox
|
||||
text: Ammo Slot
|
||||
|
||||
CheckBox
|
||||
text: Feet Slot
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
InputPanel < FlatPanel
|
||||
size: 270 265
|
||||
padding-left: 10
|
||||
padding-right: 10
|
||||
padding-bottom: 10
|
||||
|
||||
Label
|
||||
id: title
|
||||
anchors.verticalCenter: parent.top
|
||||
anchors.left: parent.left
|
||||
text: Input Panel
|
||||
font: verdana-11px-rounded
|
||||
color: #FF0000
|
||||
|
||||
Panel
|
||||
id: itemBox
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
margin-top: 10
|
||||
height: 40
|
||||
layout:
|
||||
type: grid
|
||||
cell-size: 34 34
|
||||
cell-spacing: 2
|
||||
num-columns: 9
|
||||
|
||||
Button
|
||||
id: unequip
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
text: Unequip
|
||||
height: 16
|
||||
width: 70
|
||||
|
||||
Label
|
||||
id: mainLabel
|
||||
anchors.left: prev.right
|
||||
anchors.right: parent.right
|
||||
margin-top: 2
|
||||
anchors.verticalCenter: prev.verticalCenter
|
||||
margin-left: 2
|
||||
!text: tr('& Equip above item(s) when:')
|
||||
text-align: center
|
||||
font: verdana-11px-rounded
|
||||
color: #aeaeae
|
||||
|
||||
Unequip
|
||||
id: unequipPanel
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
HorizontalSeparator
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 4
|
||||
|
||||
ConditionPanel
|
||||
id: condition
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: unequipPanel.bottom
|
||||
margin-top: 8
|
||||
|
||||
HorizontalSeparator
|
||||
anchors.verticalCenter: next.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
ConditionBox
|
||||
id: useSecondCondition
|
||||
anchors.top: condition.bottom
|
||||
margin-top: 3
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: 50
|
||||
|
||||
ConditionPanel
|
||||
id: optionalCondition
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 8
|
||||
|
||||
HorizontalSeparator
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
|
||||
BotTextEdit
|
||||
id: name
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
width: 175
|
||||
|
||||
Label
|
||||
anchors.horizontalCenter: prev.horizontalCenter
|
||||
anchors.bottom: prev.top
|
||||
margin-bottom: 2
|
||||
text-align: center
|
||||
text: Profile Name
|
||||
font: verdana-11px-rounded
|
||||
color: #aeaeae
|
||||
|
||||
Button
|
||||
id: addButton
|
||||
anchors.top: name.top
|
||||
anchors.bottom: name.bottom
|
||||
anchors.left: name.right
|
||||
margin-left: 3
|
||||
anchors.right: parent.right
|
||||
text: Add
|
||||
tooltip: On add above rule will be listed as Profile name - use friendly one!
|
||||
|
||||
EquipWindow < MainWindow
|
||||
size: 600 345
|
||||
text: Equipment Manager
|
||||
@onEscape: self:hide()
|
||||
|
||||
ListPanel
|
||||
id: listPanel
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
|
||||
VerticalSeparator
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: bottomSep.top
|
||||
margin-bottom: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
InputPanel
|
||||
id: inputPanel
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
|
||||
HorizontalSeparator
|
||||
id: bottomSep
|
||||
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
|
||||
@@ -93,7 +93,7 @@ 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)
|
||||
addScrollBar("huntRoutes", "Hunting Routes Limit", 0, 300, 50, leftPanel)
|
||||
addScrollBar("killUnder", "Kill monsters below", 0, 100, 30, leftPanel)
|
||||
addScrollBar("killUnder", "Kill monsters below", 0, 100, 1, leftPanel)
|
||||
addScrollBar("gotoMaxDistance", "Max GoTo Distance", 0, 127, 30, leftPanel)
|
||||
addCheckBox("lootLast", "Start loot from last corpse", true, leftPanel)
|
||||
addCheckBox("joinBot", "Join TargetBot and CaveBot", false, leftPanel)
|
||||
|
||||
@@ -930,7 +930,7 @@ LootItems = {
|
||||
["sickle"] = 3,
|
||||
["sight of surrender's eye"] = 3000,
|
||||
["signet ring"] = 480000,
|
||||
["silencer claws"] = 25000,
|
||||
["silencer claws"] = 390,
|
||||
["silencer resonating chamber"] = 600,
|
||||
["silken bookmark"] = 1300,
|
||||
["silkweaver bow"] = 12000,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
UI.Label("vBot v4.0 \n Vithrax#5814")
|
||||
UI.Label("vBot v4.1 \n Vithrax#5814")
|
||||
UI.Button("Official OTCv8 Discord!", function() g_platform.openUrl("https://discord.gg/yhqBE4A") end)
|
||||
UI.Separator()
|
||||
@@ -86,13 +86,6 @@ end
|
||||
|
||||
|
||||
-- variables for config
|
||||
|
||||
local config = config
|
||||
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}
|
||||
local cleanTile = nil
|
||||
|
||||
@@ -142,8 +135,8 @@ end
|
||||
-- to mark
|
||||
local hold = 0
|
||||
onKeyDown(function(keys)
|
||||
if not enabled then return end
|
||||
if keys ~= key then return end
|
||||
if not config.enabled then return end
|
||||
if keys ~= config.pushMaxKey then return end
|
||||
hold = now
|
||||
local tile = getTileUnderCursor()
|
||||
if not tile then return end
|
||||
@@ -171,8 +164,8 @@ end)
|
||||
|
||||
-- mark tile to throw anything from it
|
||||
onKeyPress(function(keys)
|
||||
if not enabled then return end
|
||||
if keys ~= key then return end
|
||||
if not config.enabled then return end
|
||||
if keys ~= config.pushMaxKey then return end
|
||||
local tile = getTileUnderCursor()
|
||||
if not tile then return end
|
||||
|
||||
@@ -188,7 +181,7 @@ onKeyPress(function(keys)
|
||||
end)
|
||||
|
||||
onCreaturePositionChange(function(creature, newPos, oldPos)
|
||||
if not enabled then return end
|
||||
if not config.enabled then return end
|
||||
if creature == player then
|
||||
resetData()
|
||||
end
|
||||
@@ -199,7 +192,11 @@ onCreaturePositionChange(function(creature, newPos, oldPos)
|
||||
end)
|
||||
|
||||
macro(50, function()
|
||||
if not enabled then return end
|
||||
if not config.enabled then return end
|
||||
|
||||
local pushDelay = tonumber(config.pushDelay)
|
||||
local rune = tonumber(config.pushMaxRuneId)
|
||||
local customMwall = config.mwallBlockId
|
||||
|
||||
if cleanTile then
|
||||
local tilePos = cleanTile:getPosition()
|
||||
|
||||
Reference in New Issue
Block a user