@ -88,7 +88,7 @@ dbot.version : Module to track version and changelog information and update the
save_state="y"
save_state="y"
date_written="2017-08-12 08:45:15"
date_written="2017-08-12 08:45:15"
requires="4.98"
requires="4.98"
version="2.0023 "
version="2.0024 "
>
>
<description trim= "y" >
<description trim= "y" >
< ![CDATA[
< ![CDATA[
@ -4844,7 +4844,10 @@ function inv.items.init.atInstall()
-- Trigger on one of the detail/stat lines of an item's id report (lore, identify, bid, etc.)
-- Trigger on one of the detail/stat lines of an item's id report (lore, identify, bid, etc.)
check (AddTriggerEx(inv.items.trigger.itemIdStatsName,
check (AddTriggerEx(inv.items.trigger.itemIdStatsName,
"^(\\| .*\\|| A full appraisal will reveal further information on this item.)$",
"^(" ..
"\\| .*\\||" ..
".*A full appraisal will reveal further information on this item.|" ..
")$",
"inv.items.trigger.itemIdStats(\"%1\")",
"inv.items.trigger.itemIdStats(\"%1\")",
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput,
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput,
custom_colour.Custom11, 0, "", "", sendto.script, 0))
custom_colour.Custom11, 0, "", "", sendto.script, 0))
@ -4878,15 +4881,17 @@ function inv.items.init.atInstall()
-- Trigger on an identify command to capture the item's object ID
-- Trigger on an identify command to capture the item's object ID
check (AddTriggerEx(inv.items.trigger.idItemName,
check (AddTriggerEx(inv.items.trigger.idItemName,
"^(" ..
"^(" ..
".------.*|" ..
".------.*|" ..
"\\|.*|" ..
"\\|.*|" ..
"You do not have that item.*|" ..
"You do not have that item.*|" ..
"You dream about being able to identify.*|" ..
"You dream about being able to identify.*|" ..
".*does not have that item for sale.*|" ..
".*does not have that item for sale.*|" ..
"There is no auction item with that id.*|" ..
"There is no auction item with that id.*|" ..
".*currently holds no inventory.*|" ..
".*currently holds no inventory.*|" ..
"There is no marketplace item with that id.*" ..
"There is no marketplace item with that id.*|" ..
"|)$", -- accept an empty capture on the last line
inv.items.identifyFence ..
"|)$", -- accept an empty capture on the last line if there is one there
"inv.items.trigger.idItem(\"%1\")",
"inv.items.trigger.idItem(\"%1\")",
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput,
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput,
custom_colour.Custom11, 0, "", "", sendto.script, 0))
custom_colour.Custom11, 0, "", "", sendto.script, 0))
@ -5615,7 +5620,7 @@ function inv.items.identifyCR(maxNumItems, refreshLocations)
else
else
numItemsIdentified = numItemsIdentified + 1
numItemsIdentified = numItemsIdentified + 1
dbot.note("Identify (" .. numItemsIdentified .. " / " .. numItemsToIdentify ..
dbot.note("Identify (" .. numItemsIdentified .. " / " .. numItemsToIdentify ..
") \"" .. (colorName or name or "Unidentified") .. "@W" .. DRL_ANSI_WHITE ..
"): \"" .. (colorName or name or "Unidentified") .. "@W" .. DRL_ANSI_WHITE ..
"\" (" .. objId .. ") from frequent cache")
"\" (" .. objId .. ") from frequent cache")
end -- if
end -- if
end -- if
end -- if
@ -5718,6 +5723,7 @@ end -- inv.items.identifyCR
idCommandBasic = "identify"
idCommandBasic = "identify"
inv.items.identifyFence = "DINV identify fence"
-- Asynchronous routine to identify an item
-- Asynchronous routine to identify an item
function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
local retval = DRL_RET_SUCCESS
local retval = DRL_RET_SUCCESS
@ -5754,6 +5760,8 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
inv.items.identifyPkg.objLoc = objLoc
inv.items.identifyPkg.objLoc = objLoc
inv.items.identifyPkg.command = idCommand
inv.items.identifyPkg.command = idCommand
local tmpCommands = {}
if (commandArray == nil) then
if (commandArray == nil) then
-- Add a timeout timer to clear the identify request if we take too long. For example,
-- Add a timeout timer to clear the identify request if we take too long. For example,
-- we may have tried to identify an item that isn't in our inventory table or we may have
-- we may have tried to identify an item that isn't in our inventory table or we may have
@ -5772,8 +5780,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, command)
table.insert(commandArray, command)
else
else
retval = dbot.execute.safe.command(command, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, command)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5790,8 +5800,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, command)
table.insert(commandArray, command)
else
else
retval = dbot.execute.safe.command(command, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, command)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5835,8 +5847,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, command)
table.insert(commandArray, command)
else
else
retval = dbot.execute.safe.command(command, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, command)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5850,8 +5864,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, idCommand)
table.insert(commandArray, idCommand)
else
else
retval = dbot.execute.safe.command(idCommand, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, idCommand)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5871,8 +5887,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, command)
table.insert(commandArray, command)
else
else
retval = dbot.execute.safe.command(command, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, command)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5894,8 +5912,10 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (commandArray ~= nil) then
if (commandArray ~= nil) then
table.insert(commandArray, command)
table.insert(commandArray, command)
else
else
retval = dbot.execute.safe.command(command, inv.items.identifyItemSetupFn, nil,
table.insert(tmpCommands, command)
dbot.callback.default, resultData)
table.insert(tmpCommands, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(tmpCommands, inv.items.identifyItemSetupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
@ -5918,6 +5938,8 @@ function inv.items.identifyItem(objId, idCommand, resultData, commandArray)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
inv.items.trigger.itemIdEnd()
inv.items.trigger.itemIdEnd()
end -- if
end -- if
else
table.insert(commandArray, "echo " .. inv.items.identifyFence)
end -- if
end -- if
return retval
return retval
@ -7874,8 +7896,12 @@ function inv.items.convertRelative(relativeName, value)
inv.lastIdentifiedObjectId = nil
inv.lastIdentifiedObjectId = nil
local resultData = dbot.callback.new()
local resultData = dbot.callback.new()
retval = dbot.execute.safe.command("identify " .. value, inv.items.convertSetupFn, nil,
dbot.callback.default, resultData)
local commandArray = {}
table.insert(commandArray, "identify " .. value)
table.insert(commandArray, "echo " .. inv.items.identifyFence)
retval = dbot.execute.safe.commands(commandArray, inv.items.convertSetupFn, nil,
dbot.callback.default, resultData)
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
dbot.warn("inv.items.convertRelative: Failed to submit safe identification call: " ..
dbot.warn("inv.items.convertRelative: Failed to submit safe identification call: " ..
dbot.retval.getString(retval))
dbot.retval.getString(retval))
@ -8833,7 +8859,7 @@ function inv.items.trigger.itemIdStart(line)
-- Watch for the end of the item description so that we can stop scanning
-- Watch for the end of the item description so that we can stop scanning
AddTriggerEx(inv.items.trigger.itemIdEndName,
AddTriggerEx(inv.items.trigger.itemIdEndName,
"^$" ,
inv.items.identifyFence ,
"inv.items.trigger.itemIdEnd()",
"inv.items.trigger.itemIdEnd()",
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput + trigger_flag.OneShot,
drlTriggerFlagsBaseline + trigger_flag.OmitFromOutput + trigger_flag.OneShot,
custom_colour.Custom11,
custom_colour.Custom11,
@ -9436,8 +9462,8 @@ end -- inv.items.trigger.itemIdEnd
inv.items.trigger.idItemName = "drlInvItemsTriggerIdItem"
inv.items.trigger.idItemName = "drlInvItemsTriggerIdItem"
inv.items.trigger.lastLineHyphens = false
function inv.items.trigger.idItem(line)
function inv.items.trigger.idItem(line)
local _, _, id = string.find(line, "Id%s+:%s+(%d+)%s+")
local _, _, id = string.find(line, "Id%s+:%s+(%d+)%s+")
if (id ~= nil) then
if (id ~= nil) then
inv.lastIdentifiedObjectId = id
inv.lastIdentifiedObjectId = id
@ -9446,15 +9472,8 @@ function inv.items.trigger.idItem(line)
if (line == "You do not have that item.") then
if (line == "You do not have that item.") then
dbot.debug("You do not have the relative item.")
dbot.debug("You do not have the relative item.")
inv.lastIdentifiedObjectId = 0
inv.lastIdentifiedObjectId = 0
elseif (inv.items.trigger.lastLineHyphens == true) and ((line == nil) or (line == "") ) then
elseif (line == inv.items.identifyFence ) then
EnableTrigger(inv.items.trigger.idItemName, false)
EnableTrigger(inv.items.trigger.idItemName, false)
dbot.debug("Disabling ID trigger on line=\"" .. line .. "\"")
end -- if
if (string.find(line, "^[+][-]+[+]")) then
inv.items.trigger.lastLineHyphens = true
else
inv.items.trigger.lastLineHyphens = false
end -- if
end -- if
end -- inv.items.trigger.idItem
end -- inv.items.trigger.idItem
@ -9661,6 +9680,17 @@ function inv.items.trigger.invmon(action, objId, containerId, wearLoc)
return DRL_RET_INVALID_PARAM
return DRL_RET_INVALID_PARAM
end -- if
end -- if
if (inv.items.getEntry(objId) == nil) or
(containerId ~= -1) and (inv.items.getEntry(containerId) == nil) then
dbot.debug("Skipping invmon for unknown item and/or container")
return DRL_RET_MISSING_ENTRY
end -- if
if (not inv.config.table.isBuildExecuted) then
dbot.debug("Skipping invmon, build is not complete yet")
return DRL_RET_UNINITIALIZED
end -- if
-- Get the action
-- Get the action
assert(invmon.action[action] ~= nil, "Undefined invmon action " .. action)
assert(invmon.action[action] ~= nil, "Undefined invmon action " .. action)
@ -12172,33 +12202,6 @@ function inv.priority.addDefault()
dbot.retval.getString(retval))
dbot.retval.getString(retval))
end -- if
end -- if
--[[FIXME: we probably shouldn't bundle this one
retval = inv.priority.add(
"cleric-tank",
{
{ -- Priorities for levels 1 - 291
minLevel = 1,
maxLevel = 291,
priorities = {
str = 1.2,
int = 1.2,
wis = 1.5,
dex = 1.3,
con = 1.5,
luck = 1.3,
hit = 0.5,
dam = 0.5,
avedam = 0.4,
offhandDam = 0.4,
}
}
})
if (retval ~= DRL_RET_SUCCESS) then
dbot.warn("inv.priority.addDefault: Failed to add priority \"cleric-tank\": " ..
dbot.retval.getString(retval))
end -- if
--]]
----------------------
----------------------
-- Priority: psi-melee
-- Priority: psi-melee
----------------------
----------------------
@ -19805,8 +19808,12 @@ function dbot.ability.isAvailable(ability, level)
-- Kick off the command that will trigger the level availability info
-- Kick off the command that will trigger the level availability info
local resultData = dbot.callback.new()
local resultData = dbot.callback.new()
retval = dbot.execute.safe.command("showskill " .. ability, dbot.ability.setupFn, nil,
dbot.callback.default, resultData)
local commandArray = {}
table.insert(commandArray, "showskill " .. ability)
table.insert(commandArray, "echo " .. dbot.ability.trigger.levelMsg)
retval = dbot.execute.safe.commands(commandArray, dbot.ability.setupFn, nil,
dbot.callback.default, resultData)
if (retval == DRL_RET_SUCCESS) then
if (retval == DRL_RET_SUCCESS) then
-- Wait for the callback to confirm that the showskill safe command completed
-- Wait for the callback to confirm that the showskill safe command completed
retval = dbot.callback.wait(resultData, 10)
retval = dbot.callback.wait(resultData, 10)
@ -19868,17 +19875,18 @@ function drlHaveAbilityStartTriggerFn(line)
end -- if
end -- if
-- Enable a trigger to watch for the output of the ability availability output. The trigger
-- Enable a trigger to watch for the output of the ability availability output. The trigger
-- will disable itself when it sees an empty li ne that indicates the output is done.
-- will disable itself when it sees a f ence messag e that indicates the output is done.
EnableTrigger(dbot.ability.trigger.levelName, true)
EnableTrigger(dbot.ability.trigger.levelName, true)
end -- drlHaveAbilityStartTriggerFn
end -- drlHaveAbilityStartTriggerFn
dbot.ability.trigger.levelMsg = "DINV showskill fence"
function dbot.ability.trigger.levelFn(line)
function dbot.ability.trigger.levelFn(line)
local useLevel
local useLevel
_, _, useLevel = string.find(line, "Your Level%s+:%s+(%d+)")
_, _, useLevel = string.find(line, "Your Level%s+:%s+(%d+)")
-- If we hit an empty lin e, we know that the output is done and we can disable this trigger
-- If we our fence echo messag e, we know that the output is done and we can disable this trigger
if (line == "" ) then
if (line == dbot.ability.trigger.levelMsg ) then
EnableTrigger(dbot.ability.trigger.levelName, false)
EnableTrigger(dbot.ability.trigger.levelName, false)
-- If we can't use the skill, set the useLevel out of reach
-- If we can't use the skill, set the useLevel out of reach
@ -19887,7 +19895,7 @@ function dbot.ability.trigger.levelFn(line)
-- Check if we found our level in a line like: "Your Level : 22 Learned: 95% "
-- Check if we found our level in a line like: "Your Level : 22 Learned: 95% "
elseif (useLevel ~= nil) and (tonumber(useLevel) ~= nil) then
elseif (useLevel ~= nil) and (tonumber(useLevel) ~= nil) then
dbot.abilityPkg.useLevel = tonumber(useLevel)
dbot.abilityPkg.useLevel = tonumber(useLevel) or 300
end -- if
end -- if
end -- dbot.ability.trigger.levelFn
end -- dbot.ability.trigger.levelFn
@ -19952,7 +19960,7 @@ function dbot.wish.init.atActive()
dbot.warn("dbot.wish.init.atActive: Failed to load wish data: " .. dbot.retval.getString(retval))
dbot.warn("dbot.wish.init.atActive: Failed to load wish data: " .. dbot.retval.getString(retval))
end -- if
end -- if
-- Trigger on the output of "wish list" and watch for an empty line indicating that we are done
-- Trigger on the output of "wish list" and watch for a fence message to tell us we are done
check (AddTriggerEx(dbot.wish.trigger.itemName,
check (AddTriggerEx(dbot.wish.trigger.itemName,
"^(.*)$",
"^(.*)$",
"dbot.wish.trigger.fn(\"%1\")",
"dbot.wish.trigger.fn(\"%1\")",
@ -20053,6 +20061,7 @@ function dbot.wish.get()
end -- dbot.wish.get
end -- dbot.wish.get
dbot.wish.fenceMsg = "DINV wish list fence"
function dbot.wish.getCR()
function dbot.wish.getCR()
local retval = DRL_RET_SUCCESS
local retval = DRL_RET_SUCCESS
local charState = dbot.gmcp.getState()
local charState = dbot.gmcp.getState()
@ -20076,9 +20085,11 @@ function dbot.wish.getCR()
if (pageLines == 0) then
if (pageLines == 0) then
table.insert(commandArray, "wish list")
table.insert(commandArray, "wish list")
table.insert(commandArray, "echo " .. dbot.wish.fenceMsg)
else
else
table.insert(commandArray, "pagesize 0")
table.insert(commandArray, "pagesize 0")
table.insert(commandArray, "wish list")
table.insert(commandArray, "wish list")
table.insert(commandArray, "echo " .. dbot.wish.fenceMsg)
table.insert(commandArray, "pagesize " .. pageLines)
table.insert(commandArray, "pagesize " .. pageLines)
end -- if
end -- if
@ -20137,7 +20148,8 @@ end -- dbot.wish.getCR
function dbot.wish.trigger.fn(line)
function dbot.wish.trigger.fn(line)
local wishName = string.match(line, ".*[-][-] ([^ -]+)[ ]*$")
local wishName = string.match(line, ".*[-][-] ([^ -]+)[ ]*$")
if (line == nil) or (line == "") then
-- We send a fence after checking with wishes to confirm that the wishes are done
if (line == dbot.wish.fenceMsg) then
EnableTrigger(dbot.wish.trigger.itemName, false)
EnableTrigger(dbot.wish.trigger.itemName, false)
dbot.wish.inProgress = false
dbot.wish.inProgress = false
end -- if
end -- if
@ -20216,7 +20228,7 @@ dbot.pagesize.trigger.suppressName = "drlDbotPageSizeSuppressTrigger"
function dbot.pagesize.init.atActive()
function dbot.pagesize.init.atActive()
local retval = DRL_RET_SUCCESS
local retval = DRL_RET_SUCCESS
-- Trigger on the output of "pagesize" and watch for an empty line indicating that we are done
-- Trigger on the output of "pagesize"
check (AddTriggerEx(dbot.pagesize.trigger.getName,
check (AddTriggerEx(dbot.pagesize.trigger.getName,
"^(" ..
"^(" ..
"|You currently display [0-9]+ lines per page." ..
"|You currently display [0-9]+ lines per page." ..
@ -20643,7 +20655,7 @@ function dbot.execute.queue.fence()
-- Spin until we have confirmation that the mud received the fence message or until we detect
-- Spin until we have confirmation that the mud received the fence message or until we detect
-- that we are in a state that will prevent the message from completing
-- that we are in a state that will prevent the message from completing
totTime = 0
totTime = 0
timeout = 6 0 -- wait a while since we there might be a lot of stuff queued up on the server
timeout = 3 0 -- wait a while since we there might be a lot of stuff queued up on the server
while (dbot.execute.fenceIsDetected == false) do
while (dbot.execute.fenceIsDetected == false) do
local charState = dbot.gmcp.getState()
local charState = dbot.gmcp.getState()