mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 22:23:28 +02:00
Version 1.3 - auto reconnect, better bot (with sound), animated mounts, bug fixes
This commit is contained in:
@@ -10,7 +10,7 @@ Panels.MonsterEditor = function(monster, config, callback, parent)
|
||||
local window = context.setupUI([[
|
||||
MainWindow
|
||||
id: monsterEditor
|
||||
size: 450 430
|
||||
size: 450 450
|
||||
!text: tr("Edit monster")
|
||||
|
||||
Label
|
||||
@@ -163,12 +163,24 @@ MainWindow
|
||||
maximum: 100
|
||||
step: 1
|
||||
|
||||
Label
|
||||
id: dangerText
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.horizontalCenter
|
||||
anchors.top: prev.bottom
|
||||
margin-right: 5
|
||||
margin-top: 10
|
||||
text: If total danger is high (>8) bot won't auto loot until it's low again and will be trying to minimize it
|
||||
text-align: center
|
||||
text-wrap: true
|
||||
text-auto-resize: true
|
||||
|
||||
Label
|
||||
id: attackSpellText
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.horizontalCenter
|
||||
anchors.top: prev.bottom
|
||||
margin-right: 10
|
||||
margin-right: 5
|
||||
margin-top: 10
|
||||
text: Attack spell and attack rune are only used when you have more than 30% health
|
||||
text-align: center
|
||||
@@ -600,7 +612,6 @@ Panel
|
||||
local status, result = pcall(function() return json.decode(command.text) end)
|
||||
if not status then
|
||||
context.error("Invalid monster config: " .. commands[i].command .. ", error: " .. result)
|
||||
print(command.text)
|
||||
else
|
||||
monsters[commands[i].command] = result
|
||||
table.insert(labels, commands[i].command)
|
||||
@@ -634,7 +645,7 @@ Panel
|
||||
ui.config:addOption(name)
|
||||
end
|
||||
|
||||
if not context.storage.attacking.activeConfig and #context.storage.attacking.configs > 0 then
|
||||
if (not context.storage.attacking.activeConfig or context.storage.attacking.activeConfig == 0) and #context.storage.attacking.configs > 0 then
|
||||
context.storage.attacking.activeConfig = 1
|
||||
end
|
||||
|
||||
@@ -687,12 +698,26 @@ Panel
|
||||
if not context.storage.attacking.activeConfig or not context.storage.attacking.configs[context.storage.attacking.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.attacking.enabled = false
|
||||
table.remove(context.storage.attacking.configs, context.storage.attacking.activeConfig)
|
||||
context.storage.attacking.activeConfig = 0
|
||||
refreshConfig()
|
||||
local questionWindow = nil
|
||||
local closeWindow = function()
|
||||
questionWindow:destroy()
|
||||
end
|
||||
local removeConfig = function()
|
||||
closeWindow()
|
||||
if not context.storage.attacking.activeConfig or not context.storage.attacking.configs[context.storage.attacking.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.attacking.enabled = false
|
||||
table.remove(context.storage.attacking.configs, context.storage.attacking.activeConfig)
|
||||
context.storage.attacking.activeConfig = 0
|
||||
refreshConfig()
|
||||
end
|
||||
questionWindow = context.displayGeneralBox(tr('Remove config'), tr('Do you want to remove current attacking config?'), {
|
||||
{ text=tr('Yes'), callback=removeConfig },
|
||||
{ text=tr('No'), callback=closeWindow },
|
||||
anchor=AnchorHorizontalCenter}, removeConfig, closeWindow)
|
||||
end
|
||||
|
||||
|
||||
|
||||
ui.mAdd.onClick = function()
|
||||
if not context.storage.attacking.activeConfig or not context.storage.attacking.configs[context.storage.attacking.activeConfig] then
|
||||
@@ -745,7 +770,7 @@ Panel
|
||||
return false
|
||||
end
|
||||
|
||||
if monster:isPlayer() and config.monstersOnly then
|
||||
if monster:isPlayer() and (config.monstersOnly == true or config.monstersOnly == nil) then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -770,7 +795,7 @@ Panel
|
||||
return false
|
||||
end
|
||||
|
||||
local pathTo = context.findPath(context.player:getPosition(), {x=mpos.x, y=mpos.y, z=mpos.z}, maxDistance + 2, { ignoreNonPathable = true, precision=1, allowOnlyVisibleTiles = true })
|
||||
local pathTo = context.findPath(context.player:getPosition(), {x=mpos.x, y=mpos.y, z=mpos.z}, maxDistance + 2, { ignoreNonPathable = true, precision=1, allowOnlyVisibleTiles = true, ignoreCost = true })
|
||||
if not pathTo or #pathTo > maxDistance + 1 then
|
||||
return false
|
||||
end
|
||||
@@ -900,7 +925,7 @@ Panel
|
||||
end
|
||||
|
||||
local topItem = tile:getTopUseThing()
|
||||
if not topItem:isContainer() then
|
||||
if not topItem or not topItem:isContainer() then
|
||||
table.remove(lootContainers, 1)
|
||||
return true
|
||||
end
|
||||
|
@@ -229,7 +229,7 @@ Panel
|
||||
ui.config:addOption(name)
|
||||
end
|
||||
|
||||
if not context.storage.looting.activeConfig and #context.storage.looting.configs > 0 then
|
||||
if (not context.storage.looting.activeConfig or context.storage.looting.activeConfig == 0) and #context.storage.looting.configs > 0 then
|
||||
context.storage.looting.activeConfig = 1
|
||||
end
|
||||
|
||||
@@ -286,12 +286,25 @@ Panel
|
||||
if not context.storage.looting.activeConfig or not context.storage.looting.configs[context.storage.looting.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.looting.enabled = false
|
||||
table.remove(context.storage.looting.configs, context.storage.looting.activeConfig)
|
||||
context.storage.looting.activeConfig = 0
|
||||
refreshConfig()
|
||||
local questionWindow = nil
|
||||
local closeWindow = function()
|
||||
questionWindow:destroy()
|
||||
end
|
||||
local removeConfig = function()
|
||||
closeWindow()
|
||||
if not context.storage.looting.activeConfig or not context.storage.looting.configs[context.storage.looting.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.looting.enabled = false
|
||||
table.remove(context.storage.looting.configs, context.storage.looting.activeConfig)
|
||||
context.storage.looting.activeConfig = 0
|
||||
refreshConfig()
|
||||
end
|
||||
questionWindow = context.displayGeneralBox(tr('Remove config'), tr('Do you want to remove current looting config?'), {
|
||||
{ text=tr('Yes'), callback=removeConfig },
|
||||
{ text=tr('No'), callback=closeWindow },
|
||||
anchor=AnchorHorizontalCenter}, removeConfig, closeWindow)
|
||||
end
|
||||
|
||||
refreshConfig()
|
||||
|
||||
context.onContainerOpen(function(container, prevContainer)
|
||||
@@ -360,7 +373,7 @@ Panel
|
||||
if item:getId() == foundItem:getId() then
|
||||
if foundItem:isStackable() then
|
||||
if item:getCount() ~= 100 then
|
||||
g_game.move(foundItem, container:getSlotPosition(j), foundItem:getCount())
|
||||
g_game.move(foundItem, container:getSlotPosition(j - 1), foundItem:getCount())
|
||||
return
|
||||
end
|
||||
else
|
||||
|
@@ -14,4 +14,23 @@ Panels.TradeMessage = function(parent)
|
||||
context.addTextEdit("autoTradeMessage", context.storage.autoTradeMessage or "I'm using OTClientV8 - https://github.com/OTCv8/otclientv8", function(widget, text)
|
||||
context.storage.autoTradeMessage = text
|
||||
end, parent)
|
||||
end
|
||||
|
||||
Panels.AutoStackItems = function(parent)
|
||||
context.macro(500, "Auto stacking items", nil, function()
|
||||
local containers = context.getContainers()
|
||||
for i, container in pairs(containers) do
|
||||
local toStack = {}
|
||||
for j, item in ipairs(container:getItems()) do
|
||||
if item:isStackable() and item:getCount() ~= 100 then
|
||||
local otherItem = toStack[item:getId()]
|
||||
if otherItem then
|
||||
g_game.move(item, otherItem, item:getCount())
|
||||
return
|
||||
end
|
||||
toStack[item:getId()] = container:getSlotPosition(j - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end, parent)
|
||||
end
|
@@ -27,7 +27,7 @@ Panels.AttackLeaderTarget = function(parent)
|
||||
end
|
||||
end)
|
||||
context.macro(50, "Attack leader's target", nil, function()
|
||||
if toAttack and context.storage.attackLeader:len() > 0 then
|
||||
if toAttack and context.storage.attackLeader:len() > 0 and toAttack ~= g_game.getAttackingCreature() then
|
||||
g_game.attack(toAttack)
|
||||
toAttack = nil
|
||||
end
|
||||
|
@@ -269,7 +269,7 @@ Panel
|
||||
ui.config:addOption(name)
|
||||
end
|
||||
|
||||
if not context.storage.cavebot.activeConfig and #context.storage.cavebot.configs > 0 then
|
||||
if (not context.storage.cavebot.activeConfig or context.storage.cavebot.activeConfig == 0) and #context.storage.cavebot.configs > 0 then
|
||||
context.storage.cavebot.activeConfig = 1
|
||||
end
|
||||
|
||||
@@ -331,10 +331,24 @@ Panel
|
||||
if not context.storage.cavebot.activeConfig or not context.storage.cavebot.configs[context.storage.cavebot.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.cavebot.enabled = false
|
||||
table.remove(context.storage.cavebot.configs, context.storage.cavebot.activeConfig)
|
||||
context.storage.cavebot.activeConfig = 0
|
||||
refreshConfig()
|
||||
local questionWindow = nil
|
||||
local closeWindow = function()
|
||||
questionWindow:destroy()
|
||||
end
|
||||
local removeConfig = function()
|
||||
closeWindow()
|
||||
if not context.storage.cavebot.activeConfig or not context.storage.cavebot.configs[context.storage.cavebot.activeConfig] then
|
||||
return
|
||||
end
|
||||
context.storage.cavebot.enabled = false
|
||||
table.remove(context.storage.cavebot.configs, context.storage.cavebot.activeConfig)
|
||||
context.storage.cavebot.activeConfig = 0
|
||||
refreshConfig()
|
||||
end
|
||||
questionWindow = context.displayGeneralBox(tr('Remove config'), tr('Do you want to remove current waypoints config?'), {
|
||||
{ text=tr('Yes'), callback=removeConfig },
|
||||
{ text=tr('No'), callback=closeWindow },
|
||||
anchor=AnchorHorizontalCenter}, removeConfig, closeWindow)
|
||||
end
|
||||
|
||||
-- waypoint editor
|
||||
@@ -733,7 +747,7 @@ Panel
|
||||
ui.list:focusChild(nextChild)
|
||||
commandExecutionNo = 0
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
return functions
|
||||
end
|
||||
|
Reference in New Issue
Block a user