mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-20 22:53:26 +02:00
Bot update - waypoints, attacking, looting
This commit is contained in:
@@ -79,8 +79,22 @@ context.onUseWith = function(callback)
|
||||
return context.callback("onUseWith", callback)
|
||||
end
|
||||
|
||||
-- onContainerOpen -- callback = function(container, previousContainer)
|
||||
context.onContainerOpen = function(callback)
|
||||
return context.callback("onContainerOpen", callback)
|
||||
end
|
||||
|
||||
-- custom callbacks
|
||||
-- onContainerUpdateItem -- callback = function(container)
|
||||
context.onContainerClose = function(callback)
|
||||
return context.callback("onContainerClose", callback)
|
||||
end
|
||||
|
||||
-- onContainerUpdateItem -- callback = function(container, slot, item)
|
||||
context.onContainerUpdateItem = function(callback)
|
||||
return context.callback("onContainerUpdateItem", callback)
|
||||
end
|
||||
|
||||
-- CUSTOM CALLBACKS
|
||||
|
||||
-- listen(name, callback) -- callback = function(text, channelId, pos)
|
||||
context.listen = function(name, callback)
|
||||
|
@@ -36,7 +36,7 @@ context.macro = function(timeout, name, hotkey, callback, parent)
|
||||
local switch = nil
|
||||
if name:len() > 0 then
|
||||
if context.storage._macros[name] == nil then
|
||||
context.storage._macros[name] = true
|
||||
context.storage._macros[name] = false
|
||||
end
|
||||
switch = context._addMacroSwitch(name, hotkey, parent)
|
||||
end
|
||||
|
@@ -10,6 +10,19 @@ context.getSpectators = function(multifloor)
|
||||
return g_map.getSpectators(context.player:getPosition(), multifloor)
|
||||
end
|
||||
|
||||
context.getCreatureById = function(id, multifloor)
|
||||
if type(id) ~= 'number' then return nil end
|
||||
if multifloor ~= true then
|
||||
multifloor = false
|
||||
end
|
||||
for i, spec in ipairs(g_map.getSpectators(context.player:getPosition(), multifloor)) do
|
||||
if spec:getId() == id then
|
||||
return spec
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
context.getCreatureByName = function(name, multifloor)
|
||||
if not name then return nil end
|
||||
name = name:lower()
|
||||
@@ -70,6 +83,10 @@ context.autoWalk = function(destination, maxDist, ignoreFields, ignoreCreatures)
|
||||
if #path < 1 then
|
||||
return false
|
||||
end
|
||||
g_game.autoWalk(path, context.player:getPosition())
|
||||
if g_game.getFeature(GameNewWalking) then
|
||||
g_game.autoWalk(path, context.player:getPosition())
|
||||
else
|
||||
g_game.autoWalk(path, {x=0,y=0,z=0})
|
||||
end
|
||||
return true
|
||||
end
|
@@ -5,6 +5,7 @@ context.setupUI = function(otml, parent)
|
||||
parent = context.panel
|
||||
end
|
||||
local widget = g_ui.loadUIFromString(otml, parent)
|
||||
widget.botWidget = true
|
||||
return widget
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user