Version 1.9

This commit is contained in:
OTCv8
2020-01-21 23:45:52 +01:00
parent 11ad766308
commit be8704ee92
56 changed files with 3517 additions and 483 deletions

View File

@@ -163,7 +163,6 @@ function refresh()
configList.onOptionChange = function(widget)
settings[index].config = widget:getCurrentOption().text
settings[index].enabled = false
g_settings.setNode('bot', settings)
g_settings.save()
refresh()
@@ -178,7 +177,7 @@ function refresh()
if not g_game.isOnline() or not settings[index].enabled then
statusLabel:setOn(true)
statusLabel:setText("Status: disabled")
statusLabel:setText("Status: disabled\nPress off button to enable")
return
end
@@ -381,7 +380,9 @@ function initCallbacks()
})
connect(g_map, {
onMissle = botOnMissle
onMissle = botOnMissle,
onAnimatedText = botOnAnimatedText,
onStaticText = botOnStaticText
})
end
@@ -427,7 +428,9 @@ function terminateCallbacks()
})
disconnect(g_map, {
onMissle = botOnMissle
onMissle = botOnMissle,
onAnimatedText = botOnAnimatedText,
onStaticText = botOnStaticText
})
end
@@ -526,6 +529,16 @@ function botOnMissle(missle)
safeBotCall(function() botExecutor.callbacks.onMissle(missle) end)
end
function botOnAnimatedText(thing, text)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onAnimatedText(thing, text) end)
end
function botOnStaticText(thing, text)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onStaticText(thing, text) end)
end
function botChannelList(channels)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onChannelList(channels) end)

View File

@@ -52,6 +52,8 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, webs
onContainerClose = {},
onContainerUpdateItem = {},
onMissle = {},
onAnimatedText = {},
onStaticText = {},
onChannelList = {},
onOpenChannel = {},
onCloseChannel = {},
@@ -275,6 +277,16 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, webs
callback(missle)
end
end,
onAnimatedText = function(thing, text)
for i, callback in ipairs(context._callbacks.onAnimatedText) do
callback(thing, text)
end
end,
onStaticText = function(thing, text)
for i, callback in ipairs(context._callbacks.onStaticText) do
callback(thing, text)
end
end,
onChannelList = function(channels)
for i, callback in ipairs(context._callbacks.onChannelList) do
callback(channels)

View File

@@ -116,6 +116,16 @@ context.onMissle = function(callback)
return context.callback("onMissle", callback)
end
-- onAnimatedText -- callback = function(thing, text)
context.onAnimatedText = function(callback)
return context.callback("onAnimatedText", callback)
end
-- onStaticText -- callback = function(thing, text)
context.onStaticText = function(callback)
return context.callback("onStaticText", callback)
end
-- onChannelList -- callback = function(channels)
context.onChannelList = function(callback)
return context.callback("onChannelList", callback)

View File

@@ -123,7 +123,7 @@ context.addIcon = function(id, options, callback)
widget.onDragMove = function(widget, mousePos, moved)
local parentRect = widget:getParent():getRect()
local x = math.min(math.max(parentRect.x, mousePos.x - widget.movingReference.x), parentRect.x + parentRect.width - widget:getWidth())
local y = math.min(math.max(parentRect.y, mousePos.y - widget.movingReference.y), parentRect.y + parentRect.height - widget:getHeight())
local y = math.min(math.max(parentRect.y - widget:getParent():getMarginTop(), mousePos.y - widget.movingReference.y), parentRect.y + parentRect.height - widget:getHeight())
widget:move(x, y)
return true
end
@@ -141,8 +141,8 @@ context.addIcon = function(id, options, callback)
widget:addAnchor(AnchorHorizontalCenter, 'parent', AnchorHorizontalCenter)
widget:addAnchor(AnchorVerticalCenter, 'parent', AnchorVerticalCenter)
widget:setMarginTop(height * (-0.5 + config.x))
widget:setMarginLeft(width * (-0.5 + config.y))
widget:setMarginTop(height * (-0.5 + config.y))
widget:setMarginLeft(width * (-0.5 + config.x))
return true
end
end
@@ -153,7 +153,7 @@ context.addIcon = function(id, options, callback)
local parentRect = parent:getRect()
local width = parentRect.width - widget:getWidth()
local height = parentRect.height - widget:getHeight()
widget:setMarginTop(height * (-0.5 + config.y))
widget:setMarginTop(-parent:getMarginTop() + height * (-0.5 + config.y))
widget:setMarginLeft(width * (-0.5 + config.x))
end

View File

@@ -7,4 +7,9 @@ context.displayGeneralBox = function(title, message, buttons, onEnterCallback, o
local box = displayGeneralBox(title, message, buttons, onEnterCallback, onEscapeCallback)
box.botWidget = true
return box
end
end
context.doScreenshot = function(filename)
g_app.doScreenshot(filename)
end
context.screenshot = context.doScreenshot

View File

@@ -26,6 +26,7 @@ BotLabel < Label
BotItem < Item
virtual: true
&selectable: true
&editable: true
BotTextEdit < TextEdit
@onClick: modules.game_textedit.show(self)
@@ -38,66 +39,7 @@ BotSeparator < HorizontalSeparator
margin-top: 5
margin-bottom: 3
BotSmallScrollBar < UIScrollBar
orientation: vertical
margin-bottom: 1
step: 20
width: 8
image-source: /images/ui/scrollbar
image-clip: 39 0 13 65
image-border: 1
pixels-scroll: true
UIButton
id: decrementButton
anchors.top: parent.top
anchors.left: parent.left
image-source: /images/ui/scrollbar
image-clip: 0 0 13 13
image-color: #ffffffff
size: 8 8
$hover:
image-clip: 13 0 13 13
$pressed:
image-clip: 26 0 13 13
$disabled:
image-color: #ffffff66
UIButton
id: incrementButton
anchors.bottom: parent.bottom
anchors.right: parent.right
size: 8 8
image-source: /images/ui/scrollbar
image-clip: 0 13 13 13
image-color: #ffffffff
$hover:
image-clip: 13 13 13 13
$pressed:
image-clip: 26 13 13 13
$disabled:
image-color: #ffffff66
UIButton
id: sliderButton
anchors.centerIn: parent
size: 8 11
image-source: /images/ui/scrollbar
image-clip: 0 26 13 13
image-border: 2
image-color: #ffffffff
$hover:
image-clip: 13 26 13 13
$pressed:
image-clip: 26 26 13 13
$disabled:
image-color: #ffffff66
Label
id: valueLabel
anchors.fill: parent
color: white
text-align: center
BotSmallScrollBar < SmallScrollBar
BotPanel < Panel
ScrollablePanel