Version 2.0041

1) Fixed a bug in how offhandDam was displayed in priority output.  Due to case insensitivity, it could
   appear that offhandDam was not being used or had a value of 0.
2) Added a reminder that invmon can be disabled if the plugin is disabled
3) The @Cstore@W mode will no longer attempt to store an item if it is already in a container
4) Increased the number of allowable items to be consumed in one command from 4 to 10.  It's up to
   you to not quaff a bunch of pots when you don't need them :p
master dinv_2.0041
Durel 7 years ago
parent aab3e8e05d
commit 861b47c6ea

@ -1,6 +1,24 @@
dbot.changelog = {} dbot.changelog = {}
dbot.changelog[2.0041] =
{
{ change = drlDbotChangeLogTypeFix,
desc = [[Fixed a bug in how offhandDam was displayed in priority output. Due to case insensitivity,
it could appear that offhandDam was not being used or had a value of 0.]]
},
{ change = drlDbotChangeLogTypeMisc,
desc = [[Added a reminder that invmon can be disabled if the plugin is disabled]]
},
{ change = drlDbotChangeLogTypeMisc,
desc = [[The @Cstore@W mode will no longer attempt to store an item if it is already in a container]]
},
{ change = drlDbotChangeLogTypeMisc,
desc = [[Increased the number of allowable items to be consumed in one "dinv consume ..." command from
4 to 10. It's up to you to not quaff a bunch of pots when you don't need them :p]]
}
}
dbot.changelog[2.0040] = dbot.changelog[2.0040] =
{ {
{ change = drlDbotChangeLogTypeFix, { change = drlDbotChangeLogTypeFix,

@ -89,7 +89,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.0040" version="2.0041"
> >
<description trim="y"> <description trim="y">
<![CDATA[ <![CDATA[
@ -650,6 +650,26 @@ Feature Wishlist
> >
</alias> </alias>
<alias
script="inv.cli.autoQueue.fn1"
match="^[ ]*dinv[ ]+auto[ ]+(halt)[ ]*$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
<alias
script="inv.cli.autoQueue.fn2"
match="^[ ]*dinv[ ]+auto[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+(.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
</aliases> </aliases>
<!-- Script --> <!-- Script -->
@ -816,11 +836,13 @@ end -- OnPluginDisconnect
function OnPluginEnable() function OnPluginEnable()
dbot.debug("OnPluginEnable!") dbot.debug("OnPluginEnable!")
dbot.info("@GENABLED@W")
end -- OnPluginEnable end -- OnPluginEnable
function OnPluginDisable() function OnPluginDisable()
dbot.debug("OnPluginDisable!") dbot.debug("OnPluginDisable!")
dbot.info("@RDISABLED@W: You may type \"invmon\" to disable invmon tags if you no longer need them.")
end -- OnPluginDisable end -- OnPluginDisable
@ -1641,6 +1663,8 @@ end -- inv.config.new
-- inv.cli.help.usage() -- inv.cli.help.usage()
-- inv.cli.help.examples() -- inv.cli.help.examples()
-- --
-- inv.cli.autoQueue.fn(name, line, wildcards)
--
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
inv.cli = {} inv.cli = {}
@ -4930,6 +4954,32 @@ Examples:
end -- inv.cli.help.examples end -- inv.cli.help.examples
inv.cli.autoQueue = {}
function inv.cli.autoQueue.fn1(name, line, wildcards)
dbot.autoQueueEnable = false
dbot.note("Auto Queue: halting...")
end -- inv.cli.autoQueue.fn1
function inv.cli.autoQueue.fn2(name, line, wildcards)
local maxCmds = wildcards[1] or ""
local cmdTimeout = wildcards[2] or ""
local totTimeout = wildcards[3] or ""
local state = wildcards[4] or ""
local command = wildcards[5] or ""
local paramStr = (command or "none") .. ", maxCommands=" .. (maxCmds or "nil")
local endTag = inv.tags.new(paramStr, nil, nil, nil)
dbot.debug("Auto Queue: cmd=\"" .. command .. "\", maxCmds=" .. maxCmds .. ", cmdTO=" .. cmdTimeout ..
", totTO=" .. totTimeout .. ", state=" .. state)
local retval = dbot.autoQueue(command, maxCmds, cmdTimeout, totTimeout, state, endTag)
return retval
end -- inv.cli.autoQueue.fn2
inv.cli.debug = {} inv.cli.debug = {}
function inv.cli.debug.fn(name, line, wildcards) function inv.cli.debug.fn(name, line, wildcards)
local command = wildcards[1] or "" local command = wildcards[1] or ""
@ -7488,21 +7538,29 @@ function inv.items.storeCR()
local numItemsMoved = 0 local numItemsMoved = 0
for _,objId in ipairs(idArray) do for _,objId in ipairs(idArray) do
retval = inv.items.storeItem(objId, commandArray)
if (retval ~= DRL_RET_SUCCESS) then -- Check the object's location. We don't want to store it if it is already in a container
dbot.note("Skipping request to store item " .. objId .. ": " .. dbot.retval.getString(retval)) if (tonumber(inv.items.getField(objId, invFieldObjLoc) or "") ~= nil) then
dbot.debug("Skipping store request for objId " .. objId .. ": it is already in a container")
else else
numItemsMoved = numItemsMoved + 1 -- The item isn't already in a container so we can store it
end -- if retval = inv.items.storeItem(objId, commandArray)
if (retval ~= DRL_RET_SUCCESS) then
dbot.note("Skipping request to store item " .. objId .. ": " .. dbot.retval.getString(retval))
else
numItemsMoved = numItemsMoved + 1
end -- if
if (commandArray ~= nil) then if (commandArray ~= nil) then
if (#commandArray >= inv.items.burstSize) then if (#commandArray >= inv.items.burstSize) then
retval = dbot.execute.safe.blocking(commandArray, nil, nil, dbot.callback.default, 10) retval = dbot.execute.safe.blocking(commandArray, nil, nil, dbot.callback.default, 10)
if (retval ~= DRL_RET_SUCCESS) then if (retval ~= DRL_RET_SUCCESS) then
dbot.info("Skipping request to store items: " .. dbot.retval.getString(retval)) dbot.info("Skipping request to store items: " .. dbot.retval.getString(retval))
break break
end -- if
commandArray = dbot.execute.new()
end -- if end -- if
commandArray = dbot.execute.new()
end -- if end -- if
end -- if end -- if
end -- for end -- for
@ -12103,13 +12161,30 @@ function inv.priority.tableToString(priorityTable, doDisplayUnused, doDisplayCol
local fieldDesc = fieldEntry[2] local fieldDesc = fieldEntry[2]
local useField = true local useField = true
-- This is a kludge. All priority weighting field names are lower case except
-- "offhandDam". When we added support for case insensitivity, that could cause a problem
-- for people with old priorities with "offhandDam" instead of "offhanddam". Here is a
-- one-off to work around that case by handling that one field differently.
if (fieldName == "offhanddam") then
fieldName = "offhandDam"
end -- if
-- Check if we should display this field or not. We only use the field if at least one entry -- Check if we should display this field or not. We only use the field if at least one entry
-- block has a non-zero entry for the field or if the doDisplayUnused param is true. -- block has a non-zero entry for the field or if the doDisplayUnused param is true.
if (not doDisplayUnused) then if (not doDisplayUnused) then
useField = false useField = false
for _, blockEntry in ipairs(priorityTable) do for _, blockEntry in ipairs(priorityTable) do
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "") or 0
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "")
if (fieldName == "offhandDam") and (fieldValue == nil) then
fieldValue = tonumber(blockEntry.priorities["offhanddam"] or "")
end -- if
if (fieldValue == nil) then
fieldValue = 0
end -- if
if (fieldValue ~= 0) then if (fieldValue ~= 0) then
useField = true useField = true
@ -12122,7 +12197,16 @@ function inv.priority.tableToString(priorityTable, doDisplayUnused, doDisplayCol
priString = priString .. fieldPrefix .. string.format("\r\n%12s", fieldName) .. fieldSuffix priString = priString .. fieldPrefix .. string.format("\r\n%12s", fieldName) .. fieldSuffix
for _, blockEntry in ipairs(priorityTable) do for _, blockEntry in ipairs(priorityTable) do
local fieldValue = tonumber(blockEntry.priorities[fieldName] or "") or 0 local fieldValue = tonumber(blockEntry.priorities[fieldName] or "")
if (fieldName == "offhandDam") and (fieldValue == nil) then
fieldValue = tonumber(blockEntry.priorities["offhanddam"] or "")
end -- if
if (fieldValue == nil) then
fieldValue = 0
end -- if
local valuePrefix, valueSuffix = "", "" local valuePrefix, valueSuffix = "", ""
if doDisplayColors then if doDisplayColors then
@ -16784,6 +16868,7 @@ invTagsForget = "forget"
invTagsNotify = "notify" invTagsNotify = "notify"
invTagsCache = "cache" invTagsCache = "cache"
invTagsVersion = "version" invTagsVersion = "version"
invTagsAutoQueue = "autoQueue"
invTagsHelp = "help" invTagsHelp = "help"
inv.tags.modules = invTagsBuild .. " " .. inv.tags.modules = invTagsBuild .. " " ..
@ -16807,6 +16892,7 @@ inv.tags.modules = invTagsBuild .. " " ..
invTagsNotify .. " " .. invTagsNotify .. " " ..
invTagsCache .. " " .. invTagsCache .. " " ..
invTagsVersion .. " " .. invTagsVersion .. " " ..
invTagsAutoQueue .. " " ..
invTagsHelp invTagsHelp
@ -17702,7 +17788,7 @@ function inv.consume.use(typeName, size, numItems, containerName)
return DRL_RET_SUCCESS return DRL_RET_SUCCESS
end -- inv.consume.use end -- inv.consume.use
drlConsumeMaxConsecutiveItems = 4 drlConsumeMaxConsecutiveItems = 10
function inv.consume.useCR() function inv.consume.useCR()
local retval = DRL_RET_SUCCESS local retval = DRL_RET_SUCCESS
local objId local objId
@ -22191,6 +22277,86 @@ function dbot.version.update.releaseCR()
end -- dbot.version.update.releaseCR end -- dbot.version.update.releaseCR
dbot.autoQueueEnable = true
dbot.autoQueuePkg = nil
function dbot.autoQueue(command, maxCommands, commandTimeout, totalTimeout, state, endTag)
local numMaxCommands = tonumber(maxCommands or "")
local numCommandTimeout = tonumber(commandTimeout or "")
local numTotalTimeout = tonumber(totalTimeout or "")
if (command == nil) or (numMaxCommands == nil) or (numCommandTimeout == nil) or (numTotalTimeout == nil) then
dbot.warn("dbot.autoQueue: Invalid parameters")
return inv.tags.stop(invTagsAutoQueue, endTag, DRL_RET_INVALID_PARAM)
end -- if
if (dbot.autoQueuePkg ~= nil) then
dbot.info("Skipping autoQueue request: another request is in progress")
return inv.tags.stop(invTagsAutoQueue, endTag, DRL_RET_BUSY)
end -- if
dbot.autoQueuePkg = {}
dbot.autoQueuePkg.command = command
dbot.autoQueuePkg.maxCommands = numMaxCommands
dbot.autoQueuePkg.commandTimeout = numCommandTimeout
dbot.autoQueuePkg.totalTimeout = numTotalTimeout
dbot.autoQueuePkg.state = state
dbot.autoQueuePkg.endTag = endTag
dbot.autoQueueEnable = true
wait.make(dbot.autoQueueCR)
return DRL_RET_SUCCESS
end -- drlAutoQueue
dbot.autoQueueFence = "Fence: auto queue"
dbot.autoQueueFenceIdx = 1
function dbot.autoQueueCR()
if (dbot.autoQueuePkg == nil) then
dbot.warn("dbot.autoQueueCR: package is nil!?!")
return DRL_INTERNAL_ERROR
end -- if
local retval = DRL_RET_SUCCESS
local endTag = dbot.autoQueuePkg.endTag
local startTime = dbot.getTime()
local numCmds = 1
dbot.debug("Running up to " .. dbot.autoQueuePkg.maxCommands .. " instances of \"" ..
dbot.autoQueuePkg.command .. "\", timeouts=" .. dbot.autoQueuePkg.commandTimeout ..
"/" .. dbot.autoQueuePkg.totalTimeout)
while (dbot.autoQueueEnable == true) do
local fence = dbot.autoQueueFence .. " " .. dbot.autoQueueFenceIdx
dbot.autoQueueFenceIdx = dbot.autoQueueFenceIdx + 1
check (Execute(dbot.autoQueuePkg.command))
check (Execute("echo " .. fence))
local line, wildcards = wait.regexp("^" .. fence .. "$",
dbot.autoQueuePkg.commandTimeout,
trigger_flag.OmitFromOutput)
if (line == nil) or
(line == "") or
(numCmds >= dbot.autoQueuePkg.maxCommands) or
(dbot.getTime() - startTime > dbot.autoQueuePkg.totalTimeout) or
(dbot.gmcp.getState() ~= dbot.autoQueuePkg.state) then
break
end -- if
dbot.info("@YAuto Queue: \"" .. dbot.autoQueuePkg.command .. "\" " .. numCmds .. "/" ..
dbot.autoQueuePkg.maxCommands)
numCmds = numCmds + 1
end -- while
dbot.autoQueuePkg = nil
return inv.tags.stop(invTagsAutoQueue, endTag, retval)
end -- dbot.autoQueueCR
]]> ]]>
</script> </script>

Loading…
Cancel
Save