mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-12-15 00:19:47 +01:00
Version 1.1 - crash bug fix and more advanced bot
This commit is contained in:
@@ -31,7 +31,11 @@ function init()
|
||||
onGameEnd = offline,
|
||||
onTalk = botOnTalk,
|
||||
onUse = botOnUse,
|
||||
onUseWith = botOnUseWith
|
||||
onUseWith = botOnUseWith,
|
||||
onChannelList = botChannelList,
|
||||
onOpenChannel = botOpenChannel,
|
||||
onCloseChannel = botCloseChannel,
|
||||
onChannelEvent = botChannelEvent
|
||||
})
|
||||
|
||||
connect(rootWidget, { onKeyDown = botKeyDown,
|
||||
@@ -53,6 +57,7 @@ function init()
|
||||
connect(Container, { onOpen = botContainerOpen,
|
||||
onClose = botContainerClose,
|
||||
onUpdateItem = botContainerUpdateItem })
|
||||
connect(g_map, { onMissle = botOnMissle })
|
||||
|
||||
botConfigFile = g_configs.create("/bot.otml")
|
||||
local config = botConfigFile:get("config")
|
||||
@@ -153,7 +158,11 @@ function terminate()
|
||||
onGameEnd = offline,
|
||||
onTalk = botOnTalk,
|
||||
onUse = botOnUse,
|
||||
onUseWith = botOnUseWith
|
||||
onUseWith = botOnUseWith,
|
||||
onChannelList = botChannelList,
|
||||
onOpenChannel = botOpenChannel,
|
||||
onCloseChannel = botCloseChannel,
|
||||
onChannelEvent = botChannelEvent
|
||||
})
|
||||
|
||||
disconnect(Tile, { onAddThing = botAddThing, onRemoveThing = botRemoveThing })
|
||||
@@ -171,6 +180,7 @@ function terminate()
|
||||
disconnect(Container, { onOpen = botContainerOpen,
|
||||
onClose = botContainerClose,
|
||||
onUpdateItem = botContainerUpdateItem })
|
||||
disconnect(g_map, { onMissle = botOnMissle })
|
||||
|
||||
removeEvent(executeEvent)
|
||||
removeEvent(checkMsgsEvent)
|
||||
@@ -506,3 +516,33 @@ function botContainerUpdateItem(container, slot, item)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onContainerUpdateItem(container, slot, item) end)
|
||||
end
|
||||
|
||||
function botOnMissle(missle)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onMissle(missle) end)
|
||||
end
|
||||
|
||||
function botOnMissle(missle)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onMissle(missle) end)
|
||||
end
|
||||
|
||||
function botChannelList(channels)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onChannelList(channels) end)
|
||||
end
|
||||
|
||||
function botOpenChannel(channelId, name)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onOpenChannel(channelId, name) end)
|
||||
end
|
||||
|
||||
function botCloseChannel(channelId)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onCloseChannel(channelId) end)
|
||||
end
|
||||
|
||||
function botChannelEvent(channelId, name, event)
|
||||
if compiledConfig == nil then return false end
|
||||
safeBotCall(function() compiledConfig.callbacks.onChannelEvent(channelId, name, event) end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user