mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-04-29 18:59:20 +02:00
Version 2.3.1 - bug fixes, hotkeys and anction bars work now in old tibia version (<780)
This commit is contained in:
parent
9a4ab2ae3b
commit
401eb76bba
@ -1,2 +1,2 @@
|
||||
GameButtonsWindow < MiniWindow
|
||||
height: 40
|
||||
height: 26
|
||||
|
@ -1,5 +1,5 @@
|
||||
GameButtonsWindow < HeadlessMiniWindow
|
||||
height: 52
|
||||
height: 26
|
||||
&forceOpen: true
|
||||
&autoOpen: 4
|
||||
|
||||
|
@ -135,7 +135,7 @@ function UIComboBox:onMousePress(mousePos, mouseButton)
|
||||
end
|
||||
|
||||
function UIComboBox:onMouseWheel(mousePos, direction)
|
||||
if not self.mouseScroll then
|
||||
if not self.mouseScroll or self.disableScroll then
|
||||
return false
|
||||
end
|
||||
if direction == MouseWheelUp and self.currentIndex > 1 then
|
||||
|
@ -254,7 +254,7 @@ function UIScrollBar:onGeometryChange()
|
||||
end
|
||||
|
||||
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
|
||||
if not self.mouseScroll or not self:isOn() then
|
||||
if not self.mouseScroll or not self:isOn() or self.disableScroll then
|
||||
return false
|
||||
end
|
||||
if mouseWheel == MouseWheelUp then
|
||||
|
@ -23,7 +23,7 @@ function UISpinBox:onSetup()
|
||||
end
|
||||
|
||||
function UISpinBox:onMouseWheel(mousePos, direction)
|
||||
if not self.mouseScroll then
|
||||
if not self.mouseScroll or self.disableScroll then
|
||||
return false
|
||||
end
|
||||
if direction == MouseWheelUp then
|
||||
|
@ -299,7 +299,7 @@ function actionOnMouseRelease(action, mousePosition, mouseButton)
|
||||
end
|
||||
|
||||
function actionOnItemChange(widget)
|
||||
updateAction(widget:getParent(), {text="", item=widget:getItemId(), count=widget:getItemCount()})
|
||||
updateAction(widget:getParent(), {text="", item=widget:getItemId(), count=widget:getItemCountOrSubType()})
|
||||
end
|
||||
|
||||
function onSpellCooldown(iconId, duration)
|
||||
@ -366,8 +366,8 @@ function executeAction(action, ticks)
|
||||
action.actionDelayTo = g_clock.millis() + actionDelay
|
||||
elseif action.item:getItemId() > 0 then
|
||||
if actionType == ActionTypes.USE then
|
||||
if g_game.getClientVersion() < 740 then
|
||||
local item = g_game.findPlayerItem(action.item:getItemId(), hotKey.subType or -1)
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
|
||||
if item then
|
||||
g_game.use(item)
|
||||
end
|
||||
@ -376,8 +376,8 @@ function executeAction(action, ticks)
|
||||
end
|
||||
action.actionDelayTo = g_clock.millis() + actionDelay
|
||||
elseif actionType == ActionTypes.USE_SELF then
|
||||
if g_game.getClientVersion() < 740 then
|
||||
local item = g_game.findPlayerItem(action.item:getItemId(), hotKey.subType or -1)
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
|
||||
if item then
|
||||
g_game.useWith(item, g_game.getLocalPlayer())
|
||||
end
|
||||
@ -389,7 +389,7 @@ function executeAction(action, ticks)
|
||||
local attackingCreature = g_game.getAttackingCreature()
|
||||
if not attackingCreature then
|
||||
local item = Item.create(action.item:getItemId())
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
|
||||
if not tmpItem then return end
|
||||
item = tmpItem
|
||||
@ -400,7 +400,7 @@ function executeAction(action, ticks)
|
||||
end
|
||||
|
||||
if not attackingCreature:getTile() then return end
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
|
||||
if item then
|
||||
g_game.useWith(item, attackingCreature, action.item:getItemSubType() or -1)
|
||||
@ -411,7 +411,7 @@ function executeAction(action, ticks)
|
||||
action.actionDelayTo = g_clock.millis() + actionDelay
|
||||
elseif actionType == ActionTypes.USE_WITH then
|
||||
local item = Item.create(action.item:getItemId())
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
|
||||
if not tmpItem then return true end
|
||||
item = tmpItem
|
||||
|
@ -7,6 +7,9 @@ CaveBot.addAction = function(action, value, focus)
|
||||
if not raction then
|
||||
return error("Invalid cavebot action: " .. action)
|
||||
end
|
||||
if type(value) == 'number' then
|
||||
value = tostring(value)
|
||||
end
|
||||
local widget = UI.createWidget("CaveBotAction", CaveBot.actionList)
|
||||
widget:setText(action .. ":" .. value:split("\n")[1])
|
||||
widget.action = action
|
@ -38,6 +38,7 @@ CaveBot.Editor.registerAction = function(action, text, params)
|
||||
end
|
||||
local widget = CaveBot.addAction(action, value)
|
||||
CaveBot.actionList:moveChildToIndex(widget, index + 1)
|
||||
CaveBot.actionList:focusChild(widget)
|
||||
CaveBot.save()
|
||||
end)
|
||||
end
|
||||
@ -58,6 +59,11 @@ CaveBot.Editor.setup = function()
|
||||
CaveBot.actionList:ensureChildVisible(action)
|
||||
CaveBot.save()
|
||||
end)
|
||||
registerAction("edit", function()
|
||||
local action = CaveBot.actionList:getFocusedChild()
|
||||
if not action or not action.onDoubleClick then return end
|
||||
action.onDoubleClick(action)
|
||||
end)
|
||||
registerAction("move down", function()
|
||||
local action = CaveBot.actionList:getFocusedChild()
|
||||
if not action then return end
|
||||
@ -67,11 +73,6 @@ CaveBot.Editor.setup = function()
|
||||
CaveBot.actionList:ensureChildVisible(action)
|
||||
CaveBot.save()
|
||||
end)
|
||||
registerAction("edit", function()
|
||||
local action = CaveBot.actionList:getFocusedChild()
|
||||
if not action or not action.onDoubleClick then return end
|
||||
action.onDoubleClick(action)
|
||||
end)
|
||||
registerAction("remove", function()
|
||||
local action = CaveBot.actionList:getFocusedChild()
|
||||
if not action then return end
|
@ -26,10 +26,7 @@ local function setup()
|
||||
|
||||
onUse(function(pos, itemId, stackPos, subType)
|
||||
if CaveBot.isOn() or not isEnabled then return end
|
||||
if pos.x == 0xFFFF then
|
||||
lastPos = pos
|
||||
CaveBot.addAction("use", itemId, true)
|
||||
else
|
||||
if pos.x ~= 0xFFFF then
|
||||
lastPos = pos
|
||||
CaveBot.addAction("use", pos.x .. "," .. pos.y .. "," .. pos.z, true)
|
||||
end
|
@ -58,9 +58,14 @@ for i, healingInfo in ipairs({storage.hpitem1, storage.hpitem2, storage.manaitem
|
||||
local hp = i <= 2 and player:getHealthPercent() or math.min(100, math.floor(100 * (player:getMana() / player:getMaxMana())))
|
||||
if healingInfo.max >= hp and hp >= healingInfo.min then
|
||||
if TargetBot then
|
||||
TargetBot.useItem(healingInfo.item, player) -- sync spell with targetbot if available
|
||||
TargetBot.useItem(healingInfo.item, healingInfo.subType, player) -- sync spell with targetbot if available
|
||||
else
|
||||
useWith(healingInfo.item, player)
|
||||
local thing = g_things.getThingType(healingInfo.item)
|
||||
local subType = g_game.getClientVersion() >= 860 and 0 or 1
|
||||
if thing and thing:isFluidContainer() then
|
||||
subType = healingInfo.subType
|
||||
end
|
||||
g_game.useInventoryItemWith(healingInfo.item, player, subType)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@ -68,10 +73,14 @@ for i, healingInfo in ipairs({storage.hpitem1, storage.hpitem2, storage.manaitem
|
||||
|
||||
UI.DualScrollItemPanel(healingInfo, function(widget, newParams)
|
||||
healingInfo = newParams
|
||||
healingmacro.setOn(healingInfo.on)
|
||||
healingmacro.setOn(healingInfo.on and healingInfo.item > 100)
|
||||
end)
|
||||
end
|
||||
|
||||
if g_game.getClientVersion() < 780 then
|
||||
UI.Label("In old tibia potions & runes work only when you have backpack with them opened")
|
||||
end
|
||||
|
||||
UI.Separator()
|
||||
|
||||
UI.Label("Mana shield spell:")
|
||||
@ -143,6 +152,7 @@ macro(10000, "eat food", function()
|
||||
end
|
||||
end
|
||||
-- can't find any food, try to eat random item using hotkey
|
||||
if g_game.getClientVersion() < 780 then return end -- hotkey's dont work on old tibia
|
||||
local toEat = storage.foodItems[math.random(1, #storage.foodItems)]
|
||||
if toEat then g_game.useInventoryItem(toEat.id) end
|
||||
end)
|
@ -1,5 +1,5 @@
|
||||
-- main tab
|
||||
VERSION = "1.0"
|
||||
VERSION = "1.1"
|
||||
|
||||
UI.Label("Config version: " .. VERSION)
|
||||
|
@ -39,7 +39,7 @@ TargetBot.Creature.attack = function(params, targets, isLooting) -- params {conf
|
||||
end
|
||||
end
|
||||
if config.useRuneAttack and config.attackRune > 100 then
|
||||
if TargetBot.useAttackItem(config.attackRune, creature, config.attackRuneDelay) then
|
||||
if TargetBot.useAttackItem(config.attackRune, 0, creature, config.attackRuneDelay) then
|
||||
return
|
||||
end
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
TargetBot.Creature.calculatePriority = function(creature, config, path)
|
||||
-- config is based on creature_editor
|
||||
local priority = config.priority
|
||||
local priority = 0
|
||||
|
||||
-- extra priority if it's current target
|
||||
if g_game.getAttackingCreature() == creature then
|
||||
@ -12,6 +12,9 @@ TargetBot.Creature.calculatePriority = function(creature, config, path)
|
||||
return priority
|
||||
end
|
||||
|
||||
-- add config priority
|
||||
priority = priority + config.priority
|
||||
|
||||
-- extra priority for close distance
|
||||
local path_length = #path
|
||||
if path_length == 1 then
|
@ -237,7 +237,7 @@ TargetBot.Looting.lootContainer = function(lootContainers, container)
|
||||
if nextContainer.lootTries < 2 then -- max 0.6s to open it
|
||||
g_game.open(nextContainer, container)
|
||||
waitTill = now + 300 -- give it 0.3s to open
|
||||
waitingForContainer = loot.container
|
||||
waitingForContainer = nextContainer:getId()
|
||||
return
|
||||
end
|
||||
end
|
@ -216,16 +216,41 @@ TargetBot.sayAttackSpell = function(text, delay)
|
||||
return false
|
||||
end
|
||||
|
||||
local lastItemUse = 0
|
||||
local lastRuneAttack = 0
|
||||
|
||||
TargetBot.useItem = function(item, target, delay)
|
||||
useWith(item, target)
|
||||
TargetBot.useItem = function(item, subType, target, delay)
|
||||
if not delay then delay = 200 end
|
||||
if lastItemUse + delay < now then
|
||||
local thing = g_things.getThingType(item)
|
||||
if not thing or not thing:isFluidContainer() then
|
||||
subType = g_game.getClientVersion() >= 860 and 0 or 1
|
||||
end
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(item, subType)
|
||||
if not tmpItem then return end
|
||||
g_game.useWith(tmpItem, target, subType) -- using item from bp
|
||||
else
|
||||
g_game.useInventoryItemWith(item, target, subType) -- hotkey
|
||||
end
|
||||
lastItemUse = now
|
||||
end
|
||||
end
|
||||
|
||||
TargetBot.useAttackItem = function(item, target, delay)
|
||||
TargetBot.useAttackItem = function(item, subType, target, delay)
|
||||
if not delay then delay = 2000 end
|
||||
if lastRuneAttack + delay < now then
|
||||
useWith(item, target)
|
||||
local thing = g_things.getThingType(item)
|
||||
if not thing or not thing:isFluidContainer() then
|
||||
subType = g_game.getClientVersion() >= 860 and 0 or 1
|
||||
end
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(item, subType)
|
||||
if not tmpItem then return end
|
||||
g_game.useWith(tmpItem, target, subType) -- using item from bp
|
||||
else
|
||||
g_game.useInventoryItemWith(healingInfo.item, target, subType) -- hotkey
|
||||
end
|
||||
lastRuneAttack = now
|
||||
end
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
# Default config for OTClientV8 bot (min. otcv8 version 2.2.3)
|
||||
|
||||
### Website: http://bot.otclient.ovh/
|
||||
### Forum: https://otland.net/forums/otclient.494/
|
||||
### Discord: https://discord.gg/t4ntS5p
|
@ -95,6 +95,7 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, relo
|
||||
context.g_sounds = g_sounds
|
||||
context.g_window = g_window
|
||||
context.g_mouse = g_mouse
|
||||
context.g_things = g_things
|
||||
|
||||
context.Item = Item
|
||||
context.Creature = Creature
|
||||
|
@ -150,12 +150,14 @@ UI.DualScrollItemPanel = function(params, callback, parent) -- callback = functi
|
||||
--[[ params:
|
||||
on - bool,
|
||||
item - number,
|
||||
subType - number,
|
||||
title - string,
|
||||
min - number,
|
||||
max - number,
|
||||
]]
|
||||
params.title = params.title or "title"
|
||||
params.item = params.item or 0
|
||||
params.subType = params.subType or 0
|
||||
params.min = params.min or 20
|
||||
params.max = params.max or 80
|
||||
|
||||
@ -170,9 +172,10 @@ UI.DualScrollItemPanel = function(params, callback, parent) -- callback = functi
|
||||
end
|
||||
end
|
||||
|
||||
widget.item:setItemId(params.item)
|
||||
widget.item:setItem(Item.create(params.item, params.subType))
|
||||
widget.item.onItemChange = function()
|
||||
params.item = widget.item:getItemId()
|
||||
params.subType = widget.item:getItemSubType()
|
||||
if callback then
|
||||
callback(widget, params)
|
||||
end
|
||||
|
@ -19,6 +19,7 @@ DualScrollPanel < Panel
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
&disableScroll: true
|
||||
|
||||
HorizontalScrollBar
|
||||
id: scroll2
|
||||
@ -29,6 +30,7 @@ DualScrollPanel < Panel
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
&disableScroll: true
|
||||
|
||||
BotTextEdit
|
||||
id: text
|
||||
@ -66,6 +68,7 @@ SingleScrollItemPanel < Panel
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
&disableScroll: true
|
||||
|
||||
DualScrollItemPanel < Panel
|
||||
height: 33
|
||||
@ -95,6 +98,7 @@ DualScrollItemPanel < Panel
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
&disableScroll: true
|
||||
|
||||
HorizontalScrollBar
|
||||
id: scroll2
|
||||
@ -105,6 +109,7 @@ DualScrollItemPanel < Panel
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
step: 1
|
||||
&disableScroll: true
|
||||
|
||||
ItemsRow < Panel
|
||||
height: 33
|
||||
@ -197,6 +202,7 @@ ItemAndSlotPanel < Panel
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 2
|
||||
height: 20
|
||||
&disableScroll: true
|
||||
|
||||
TwoItemsAndSlotPanel < Panel
|
||||
height: 35
|
||||
@ -230,4 +236,5 @@ TwoItemsAndSlotPanel < Panel
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 2
|
||||
height: 20
|
||||
&disableScroll: true
|
||||
|
@ -37,4 +37,13 @@ function updateOrder()
|
||||
return (a.index or 1000) < (b.index or 1000)
|
||||
end)
|
||||
contentsPanel.buttons:reorderChildren(children)
|
||||
local visibleCount = 0
|
||||
for _, child in ipairs(children) do
|
||||
if child:isVisible() then
|
||||
visibleCount = visibleCount + 1
|
||||
end
|
||||
end
|
||||
if visibleCount > 6 and buttonsWindow:getHeight() < 30 then
|
||||
buttonsWindow:setHeight(buttonsWindow:getHeight() + 22)
|
||||
end
|
||||
end
|
@ -459,7 +459,7 @@ function doKeyCombo(keyCombo, repeated)
|
||||
end
|
||||
hotKey.hotkeyDelayTo = g_clock.millis() + hotkeyDelay
|
||||
elseif hotKey.useType == HOTKEY_MANAGER_USE then
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
|
||||
if item then
|
||||
g_game.use(item)
|
||||
@ -469,7 +469,7 @@ function doKeyCombo(keyCombo, repeated)
|
||||
end
|
||||
hotKey.hotkeyDelayTo = g_clock.millis() + hotkeyDelay
|
||||
elseif hotKey.useType == HOTKEY_MANAGER_USEONSELF then
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
|
||||
if item then
|
||||
g_game.useWith(item, g_game.getLocalPlayer())
|
||||
@ -482,7 +482,7 @@ function doKeyCombo(keyCombo, repeated)
|
||||
local attackingCreature = g_game.getAttackingCreature()
|
||||
if not attackingCreature then
|
||||
local item = Item.create(hotKey.itemId)
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
|
||||
if not tmpItem then return end
|
||||
item = tmpItem
|
||||
@ -493,7 +493,7 @@ function doKeyCombo(keyCombo, repeated)
|
||||
end
|
||||
|
||||
if not attackingCreature:getTile() then return end
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
|
||||
if item then
|
||||
g_game.useWith(item, attackingCreature, hotKey.subType or -1)
|
||||
@ -504,7 +504,7 @@ function doKeyCombo(keyCombo, repeated)
|
||||
hotKey.hotkeyDelayTo = g_clock.millis() + hotkeyDelay
|
||||
elseif hotKey.useType == HOTKEY_MANAGER_USEWITH then
|
||||
local item = Item.create(hotKey.itemId)
|
||||
if g_game.getClientVersion() < 740 then
|
||||
if g_game.getClientVersion() < 780 then
|
||||
local tmpItem = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
|
||||
if not tmpItem then return true end
|
||||
item = tmpItem
|
||||
|
@ -376,7 +376,7 @@ function walk(dir, ticks)
|
||||
g_game.stop()
|
||||
return
|
||||
else
|
||||
return
|
||||
player:lockWalk(200)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ function UIItem:onDrop(widget, mousePos, forced)
|
||||
if not item or not item:isItem() then return false end
|
||||
|
||||
if self.selectable then
|
||||
self:setItem(Item.create(item:getId(), item:getCount()))
|
||||
self:setItem(Item.create(item:getId(), item:getCountOrSubType()))
|
||||
return
|
||||
end
|
||||
|
||||
|
BIN
otclient_dx.exe
BIN
otclient_dx.exe
Binary file not shown.
BIN
otclient_gl.exe
BIN
otclient_gl.exe
Binary file not shown.
BIN
otclient_linux
BIN
otclient_linux
Binary file not shown.
BIN
pdb/pdb.7z
BIN
pdb/pdb.7z
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user