Version 1.4 - Websockets and bug fixes

This commit is contained in:
OTCv8
2019-11-26 02:32:51 +01:00
parent 1072671986
commit c750ea65f8
29 changed files with 426 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
MiniWindow
id: botWindow
!text: tr('Bot')
height: 200
height: 600
icon: /images/topbuttons/bot
@onClose: modules.game_bot.onMiniWindowClose()
&save: true
@@ -16,7 +16,7 @@ MiniWindow
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
margin-top: 5
margin-top: 2
margin-right: 90
text-offset: 3 0
@@ -43,7 +43,7 @@ MiniWindow
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin-top: 5
margin-top: 3
text-auto-resize: true
!text: tr('Status: waiting')
text-align: center
@@ -53,7 +53,7 @@ MiniWindow
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
margin-top: 3
Panel
anchors.top: prev.bottom
@@ -75,7 +75,7 @@ MiniWindow
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
tab-spacing: 2
tab-spacing: 1
height: 20
movable: false

View File

@@ -10,9 +10,9 @@ botDefaultConfig = {
--#panels
local healTab = addTab("HP")
local attackTab = addTab("Atck")
local warTab = addTab("War")
local batTab = addTab("Batt")
local caveTab = addTab("Cave")
local toolsTab = addTab("Tools")
Panels.TradeMessage()
Panels.AutoStackItems()
@@ -45,12 +45,12 @@ Panels.Equip(healTab)
Panels.Equip(healTab)
Panels.Eating(healTab)
Panels.AttackSpell(attackTab)
Panels.AttackItem(attackTab)
Panels.AttackSpell(batTab)
Panels.AttackItem(batTab)
Panels.AttackLeaderTarget(warTab)
Panels.LimitFloor(warTab)
Panels.AntiPush(warTab)
Panels.AttackLeaderTarget(batTab)
Panels.LimitFloor(batTab)
Panels.AntiPush(batTab)
local waypoints = Panels.Waypoints(caveTab)
local attacking = Panels.Attacking(caveTab)
@@ -61,6 +61,18 @@ end, caveTab)
--#macros
macro(1000, "exchange money", function()
local containers = getContainers()
for i, container in pairs(containers) do
for j, item in ipairs(container:getItems()) do
if item:isStackable() and (item:getId() == 3035 or item:getId() == 3031) and item:getCount() == 100 then
g_game.use(item)
return
end
end
end
end)
macro(1000, "this macro does nothing", "f7", function()
end)

View File

@@ -14,7 +14,7 @@ context.playSound = function(file)
end
botSoundChannel:setEnabled(true)
botSoundChannel:stop(0)
botSoundChannel:play(file, 0, 0)
botSoundChannel:play(file, 0, 1.0)
return botSoundChannel
end

View File

@@ -456,7 +456,7 @@ Panels.Attacking = function(parent)
local ui = context.setupUI([[
Panel
id: attacking
height: 150
height: 140
BotLabel
anchors.top: parent.top
@@ -486,7 +486,7 @@ Panel
anchors.left: parent.left
text: Add
width: 60
height: 20
height: 17
Button
id: edit
@@ -494,7 +494,7 @@ Panel
anchors.horizontalCenter: parent.horizontalCenter
text: Edit
width: 60
height: 20
height: 17
Button
id: remove
@@ -502,7 +502,7 @@ Panel
anchors.right: parent.right
text: Remove
width: 60
height: 20
height: 17
TextList
id: list
@@ -531,7 +531,7 @@ Panel
anchors.left: parent.left
text: Add
width: 60
height: 20
height: 17
Button
id: mEdit
@@ -539,7 +539,7 @@ Panel
anchors.horizontalCenter: parent.horizontalCenter
text: Edit
width: 60
height: 20
height: 17
Button
id: mRemove
@@ -547,7 +547,7 @@ Panel
anchors.right: parent.right
text: Remove
width: 60
height: 20
height: 17
]], parent)
@@ -897,7 +897,10 @@ Panel
if #lootContainers == 0 or not context.storage.looting.enabled then
return false
end
if modules.game_walking.lastManualWalk + 500 > context.now then
return true
end
local pos = context.player:getPosition()
table.sort(lootContainers, function(pos1, pos2)
local dist1 = math.max(math.abs(pos.x-pos1.x), math.abs(pos.y-pos1.y))
@@ -993,7 +996,7 @@ Panel
end
local topItem = tile:getTopUseThing()
if not topItem:isContainer() then
if not topItem or not topItem:isContainer() then
return
end

View File

@@ -15,9 +15,12 @@ Panels.Haste = function(parent)
end
Panels.ManaShield = function(parent)
local lastManaShield = 0
context.macro(100, "Auto Mana Shield", nil, function()
if not context.hasManaShield() then
context.saySpell("utamo vita", 200)
if not context.hasManaShield() or context.now > lastManaShield + 90000 then
if context.saySpell("utamo vita", 200) then
lastManaShield = context.now
end
end
end, parent)
end

View File

@@ -5,7 +5,7 @@ Panels.Looting = function(parent)
local ui = context.setupUI([[
Panel
id: looting
height: 190
height: 180
BotLabel
anchors.top: parent.top
@@ -35,7 +35,7 @@ Panel
anchors.left: parent.left
text: Add
width: 60
height: 20
height: 17
Button
id: edit
@@ -43,7 +43,7 @@ Panel
anchors.horizontalCenter: parent.horizontalCenter
text: Edit
width: 60
height: 20
height: 17
Button
id: remove
@@ -51,7 +51,7 @@ Panel
anchors.right: parent.right
text: Remove
width: 60
height: 20
height: 17
ScrollablePanel
id: items
@@ -90,7 +90,6 @@ Panel
height: 33
margin-top: 2
]], parent)
local lootContainers = { ui.containers.item1, ui.containers.item2, ui.containers.item3, ui.containers.item4, ui.containers.item5 }

View File

@@ -5,7 +5,7 @@ Panels.Waypoints = function(parent)
local ui = context.setupUI([[
Panel
id: waypoints
height: 223
height: 206
BotLabel
anchors.top: parent.top
@@ -35,7 +35,7 @@ Panel
anchors.left: parent.left
text: Add
width: 60
height: 20
height: 17
Button
id: edit
@@ -43,7 +43,7 @@ Panel
anchors.horizontalCenter: parent.horizontalCenter
text: Edit
width: 60
height: 20
height: 17
Button
id: remove
@@ -51,7 +51,7 @@ Panel
anchors.right: parent.right
text: Remove
width: 60
height: 20
height: 17
TextList
id: list
@@ -88,7 +88,7 @@ Panel
text: Goto
width: 61
margin-top: 1
height: 20
height: 17
Button
id: wUse
@@ -96,7 +96,7 @@ Panel
anchors.left: prev.right
text: Use
width: 61
height: 20
height: 17
Button
id: wUseWith
@@ -104,7 +104,7 @@ Panel
anchors.left: prev.right
text: UseWith
width: 61
height: 20
height: 17
Button
id: wWait
@@ -113,7 +113,7 @@ Panel
text: Wait
width: 61
margin-top: 1
height: 20
height: 17
Button
id: wSay
@@ -121,7 +121,7 @@ Panel
anchors.left: prev.right
text: Say
width: 61
height: 20
height: 17
Button
id: wNpc
@@ -129,7 +129,7 @@ Panel
anchors.left: prev.right
text: Say NPC
width: 61
height: 20
height: 17
Button
id: wLabel
@@ -138,7 +138,7 @@ Panel
text: Label
width: 61
margin-top: 1
height: 20
height: 17
Button
id: wFollow
@@ -146,7 +146,7 @@ Panel
anchors.left: prev.right
text: Follow
width: 61
height: 20
height: 17
Button
id: wFunction
@@ -154,7 +154,7 @@ Panel
anchors.left: prev.right
text: Function
width: 61
height: 20
height: 17
BotSwitch
id: recording
@@ -162,7 +162,7 @@ Panel
anchors.left: parent.left
anchors.right: parent.right
text: Auto Recording
height: 20
height: 17
]], parent)

View File

@@ -1,9 +1,10 @@
BotButton < Button
height: 17
margin-top: 2
BotSwitch < Button
margin-top: 2
height: 20
height: 17
image-color: green
$!on:
image-color: red
@@ -17,7 +18,7 @@ SmallBotSwitch < Button
BotLabel < Label
margin-top: 2
height: 20
height: 15
text-auto-resize: true
text-align: center
text-wrap: true

View File

@@ -66,7 +66,7 @@ SingleScrollItemPanel < Panel
step: 1
DualScrollItemPanel < Panel
height: 40
height: 37
margin-top: 2
BotItem
@@ -198,7 +198,7 @@ ItemAndSlotPanel < Panel
height: 20
TwoItemsAndSlotPanel < Panel
height: 40
height: 37
BotItem
id: item1