Updated to OTCv8 3.1 rev 217

This commit is contained in:
OTCv8
2022-05-23 21:59:13 +00:00
parent a160f49cc8
commit c70abbdfdd
10 changed files with 76 additions and 3 deletions

View File

@@ -497,7 +497,9 @@ function initCallbacks()
onRemoveItem = botContainerRemoveItem,
onGameEditText = botGameEditText,
onSpellCooldown = botSpellCooldown,
onSpellGroupCooldown = botGroupSpellCooldown
onSpellGroupCooldown = botGroupSpellCooldown,
onQuestLog = botGameQuestLog,
onQuestLine = botGameQuestLine
})
connect(Tile, {
@@ -560,7 +562,9 @@ function terminateCallbacks()
onAttackingCreatureChange = botAttackingCreatureChange,
onGameEditText = botGameEditText,
onSpellCooldown = botSpellCooldown,
onSpellGroupCooldown = botGroupSpellCooldown
onSpellGroupCooldown = botGroupSpellCooldown,
onQuestLog = botGameQuestLog,
onQuestLine = botGameQuestLine
})
disconnect(Tile, {
@@ -789,4 +793,14 @@ end
function botGroupSpellCooldown(iconId, duration)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onGroupSpellCooldown(iconId, duration) end)
end
function botGameQuestLog(quests)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onGameQuestLog(quests) end)
end
function botGameQuestLine(quests)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onGameQuestLine(questId, questMissions) end)
end

View File

@@ -72,7 +72,9 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, relo
onGameEditText = {},
onGroupSpellCooldown = {},
onSpellCooldown = {},
onRemoveItem = {}
onRemoveItem = {},
onGameQuestLog = {},
onGameQuestLine = {}
}
-- basic functions & classes
@@ -404,6 +406,26 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, relo
callback(iconId, duration)
end
end,
onGameQuestLog = function(quests)
local tmp = {}
for j,questEntry in pairs(quests) do
local id, name, completed = unpack(questEntry)
table.insert(tmp, { id = id, name = name, completed = completed })
end
for i, callback in ipairs(context._callbacks.onGameQuestLog) do
callback(tmp)
end
end,
onGameQuestLine = function(questId, questMissions)
local tmp = {}
for i,questMission in pairs(questMissions) do
local name, description = unpack(questMission)
table.insert(tmp, { name = name, description = description })
end
for i, callback in ipairs(context._callbacks.onGameQuestLine) do
callback(questId, tmp)
end
end,
}
}
end

View File

@@ -225,6 +225,16 @@ context.onGroupSpellCooldown = function(callback)
return context.callback("onGroupSpellCooldown", callback)
end
-- onGameQuestLog - callback = function(quests)
context.onGameQuestLog = function(callback)
return context.callback("onGameQuestLog", callback)
end
-- onGameQuestLine - callback = function(questMission)
context.onGameQuestLine = function(callback)
return context.callback("onGameQuestLine", callback)
end
-- CUSTOM CALLBACKS
-- listen(name, callback) -- callback = function(text, channelId, pos)