@ -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.0026 "
version="2.0027 "
>
>
<description trim= "y" >
<description trim= "y" >
< ![CDATA[
< ![CDATA[
@ -150,7 +150,7 @@ Usage
dinv backup [list | create | delete | restore] <backup n a m e >
dinv backup [list | create | delete | restore] <backup n a m e >
dinv reset [list | confirm] <module n a m e s | a l l >
dinv reset [list | confirm] <module n a m e s | a l l >
dinv forget <query >
dinv forget <query >
dinv ignore [on | off] < container r e l a t i v e n a m e >
dinv ignore [on | off] < keyring | c o n t a i n e r r e l a t i v e n a m e >
dinv notify [none | light | standard | all]
dinv notify [none | light | standard | all]
dinv cache [reset | size] [recent | frequent | custom | all] < # entries>
dinv cache [reset | size] [recent | frequent | custom | all] < # entries>
dinv tags <names | a l l > [on | off]
dinv tags <names | a l l > [on | off]
@ -909,7 +909,6 @@ function OnPluginSend(msg)
_, _, baseCommand = string.find(msg, dbot.execute.bypassPrefix .. "(.*)")
_, _, baseCommand = string.find(msg, dbot.execute.bypassPrefix .. "(.*)")
if (baseCommand ~= nil) then
if (baseCommand ~= nil) then
--dbot.note("@mBypass command = @W\"@G" .. (baseCommand or "nil") .. "@W\"")
--dbot.note("@mBypass command = @W\"@G" .. (baseCommand or "nil") .. "@W\"")
-- It is helpful in some scenarios for us to know that something special is pending. For
-- It is helpful in some scenarios for us to know that something special is pending. For
-- example, we might be sending a command to the mud to go AFK, or quit, or write a note.
-- example, we might be sending a command to the mud to go AFK, or quit, or write a note.
setPending(baseCommand)
setPending(baseCommand)
@ -1388,6 +1387,11 @@ function inv.config.load()
return DRL_RET_INTERNAL_ERROR
return DRL_RET_INTERNAL_ERROR
end -- if
end -- if
-- The following fields were added after dinv was released so we set default values if necessary
if (inv.config.table.doIgnoreKeyring == nil) then
inv.config.table.doIgnoreKeyring = false -- default value
end -- if
return retval
return retval
end -- inv.config.load
end -- inv.config.load
@ -1421,6 +1425,7 @@ function inv.config.new()
isPromptEnabled = true,
isPromptEnabled = true,
isBackupEnabled = true,
isBackupEnabled = true,
isBuildExecuted = false,
isBuildExecuted = false,
doIgnoreKeyring = false,
refreshPeriod = 0,
refreshPeriod = 0,
refreshEagerSec = 0
refreshEagerSec = 0
}
}
@ -3669,7 +3674,7 @@ end -- inv.cli.ignore.fn
function inv.cli.ignore.usage()
function inv.cli.ignore.usage()
dbot.print("@W " .. pluginNameCmd .. " ignore @G[on | off] < container r e l a t i v e n a m e > @w")
dbot.print("@W " .. pluginNameCmd .. " ignore @G[on | off] < keyring | c o n t a i n e r r e l a t i v e n a m e > @w")
end -- inv.cli.ignore.usage
end -- inv.cli.ignore.usage
@ -3683,6 +3688,8 @@ The @Cignore@W mode allows you to specify one or more containers that the plugin
Any ignored container and any items in an ignored container are not included when the plugin is
Any ignored container and any items in an ignored container are not included when the plugin is
searching, getting, putting, storing, organizing, and creating or wearing equipment sets.
searching, getting, putting, storing, organizing, and creating or wearing equipment sets.
You may also use "keyring" as a container name to indicate ignoring everything on your keyring.
Examples:
Examples:
1) Ignore "3.bag" in your main inventory
1) Ignore "3.bag" in your main inventory
@Gdinv ignore on 3.bag@W
@Gdinv ignore on 3.bag@W
@ -3690,7 +3697,11 @@ Examples:
2) Stop ignoring "3.bag"
2) Stop ignoring "3.bag"
@Gdinv ignore off 3.bag@W
@Gdinv ignore off 3.bag@W
3) Do you really need another example? :p
3) Ignore everything on your keyring
@Gdinv ignore on keyring@W
4) Stop ignoring your keyring contents
@Gdinv ignore off keyring@W
]])
]])
end -- inv.cli.ignore.examples
end -- inv.cli.ignore.examples
@ -5457,6 +5468,7 @@ end -- inv.items.ignore
function inv.items.ignoreCR()
function inv.items.ignoreCR()
local retval = DRL_RET_SUCCESS
if (inv.items.ignorePkg == nil) then
if (inv.items.ignorePkg == nil) then
dbot.error("inv.items.ignoreCR: Aborting ignore request -- ignore package is nil!")
dbot.error("inv.items.ignoreCR: Aborting ignore request -- ignore package is nil!")
@ -5465,47 +5477,71 @@ function inv.items.ignoreCR()
local endTag = inv.items.ignorePkg.endTag
local endTag = inv.items.ignorePkg.endTag
local idArray, retval = inv.items.searchCR("rname " .. inv.items.ignorePkg.container, true)
-- Check that the ignore mode is valid
if (retval ~= DRL_RET_SUCCESS) then
local modeStr
dbot.warn("inv.items.ignoreCR: failed to search inventory table: " .. dbot.retval.getString(retval))
local lowerMode = string.lower(inv.items.ignorePkg.mode or "")
if (lowerMode == "on") then
modeStr = "@GON@W"
elseif (lowerMode == "off") then
modeStr = "@ROFF@W"
else
dbot.warn("inv.items.ignoreCR: Invalid ignore mode \"" .. (inv.items.ignorePkg.mode or "nil") .. "\"")
inv.items.ignorePkg = nil
return inv.tags.stop(invTagsIgnore, endTag, DRL_INVALID_PARAM)
end -- if
-- Let the user know if no items matched their container relative name
if (invItemLocKeyring == string.lower(inv.items.ignorePkg.container)) then
elseif (idArray == nil) or (#idArray == 0) then
if (lowerMode == "on") then
dbot.info("No match found for ignore container: \"" .. inv.items.ignorePkg.container .. "\"")
inv.config.table.doIgnoreKeyring = true
retval = DRL_MISSING_ENTRY
else
inv.config.table.doIgnoreKeyring = false
end -- if
elseif (#idArray > 1) then
-- Save the config change that indicates if we are ignoring the keyring
dbot.warn("inv.items.ignoreCR: More than one item matched container \"" ..
retval = inv.config.save()
inv.items.ignorePkg.container .. "\"")
if (retval ~= DRL_RET_SUCCESS) and (retval ~= DRL_RET_UNINITIALIZED) then
retval = DRL_INTERNAL_ERROR
dbot.warn("inv.items.ignoreCR: Failed to save inv.config module data: " ..
dbot.retval.getString(retval))
else
dbot.info("Ignore mode for keyring \"" .. inv.items.ignorePkg.container .. "\" is " .. modeStr)
end -- if
-- Set or clear the ignore flag for the specified container
-- We are targeting a container, not the keyring
else
else
local mode
local idArray, retval = inv.items.searchCR("rname " .. inv.items.ignorePkg.container, true)
local objId = idArray[1]
if (retval ~= DRL_RET_SUCCESS) then
dbot.warn("inv.items.ignoreCR: failed to search inventory table: " .. dbot.retval.getString(retval))
dbot.debug("Setting ignore to \"" .. inv.items.ignorePkg.mode .. "\" for item " .. objId)
-- Let the user know if no items matched their container relative name
elseif (idArray == nil) or (#idArray == 0) then
dbot.info("No match found for ignore container: \"" .. inv.items.ignorePkg.container .. "\"")
retval = DRL_MISSING_ENTRY
if (inv.items.getStatField(objId, invStatFieldType) ~= invmon.typeStr[invmonTypeContainer]) then
elseif (#idArray > 1 ) then
mode = "@MINVALID@W"
dbot.warn("inv.items.ignoreCR: More than one item matched container \"" ..
dbot.warn("inv.items.ignoreCR: item \"" .. inv.items.ignorePkg.container .. "\" is not a container ")
inv.items.ignorePkg.container .. "\" ")
retval = DRL_INVALID_PARAM
retval = DRL_INTERNAL_ERROR
elseif (inv.items.ignorePkg.mode == "on") then
-- Set or clear the ignore flag for the specified container
mode = "@GON@W"
else
retval = inv.items.keyword(inv.items.ignoreFlag, invKeywordOpAdd, "id " .. objId, true, nil)
local objId = idArray[1]
dbot.debug("Setting ignore to \"" .. modeStr .. "\" for item " .. objId)
elseif (inv.items.ignorePkg.mode == "off" ) then
if (inv.items.getStatField(objId, invStatFieldType) ~= invmon.typeStr[invmonTypeContainer] ) then
mode = "@ROFF@W"
dbot.warn("inv.items.ignoreCR: item \"" .. inv.items.ignorePkg.container .. "\" is not a container")
retval = inv.items.keyword(inv.items.ignoreFlag, invKeywordOpRemove, "id " .. objId, true, nil)
retval = DRL_INVALID_PARAM
else
elseif (lowerMode == "on") then
mode = "@MINVALID@W"
retval = inv.items.keyword(inv.items.ignoreFlag, invKeywordOpAdd, "id " .. objId, true, nil)
dbot.warn("inv.items.ignoreCR: Invalid ignore mode \"" .. inv.items.ignorePkg.mode .. "\"")
retval = DRL_INVALID_PARAM
elseif (lowerMode == "off") then
retval = inv.items.keyword(inv.items.ignoreFlag, invKeywordOpRemove, "id " .. objId, true, nil)
end -- if
dbot.info("Ignore mode for container \"" .. inv.items.ignorePkg.container .. "\" is " .. modeStr)
end -- if
end -- if
dbot.info("Ignore mode for container \"" .. inv.items.ignorePkg.container .. "\" is " .. mode)
end -- if
end -- if
-- Save our changes so that they don't get picked up again accidentally if we reload the plugin
-- Save our changes so that they don't get picked up again accidentally if we reload the plugin
@ -5518,21 +5554,26 @@ end -- inv.items.ignoreCR
-- An item is "ignored" if it has the inv.items.ignoreFlag or if it is in a container that has
-- An item is "ignored" if it has the inv.items.ignoreFlag or if it is in a container that has
-- the inv.items.ignoreFlag
-- the inv.items.ignoreFlag. We can also mark the keyring as ignored.
function inv.items.isIgnored(objId)
function inv.items.isIgnored(objId)
if (objId == nil) or (tonumber(objId or "") == nil) then
if (objId == nil) or (tonumber(objId or "") == nil) then
return false
return false
end -- if
end -- if
local keywords = inv.items.getStatField(objId, invStatFieldKeywords) or ""
local keywords = inv.items.getStatField(objId, invStatFieldKeywords) or ""
local objLoc = inv.items.getField(objId, invFieldObjLoc)
if dbot.isWordInString(inv.items.ignoreFlag, keywords) then
if dbot.isWordInString(inv.items.ignoreFlag, keywords) then
-- If the the item has the ignore flag, it is ignored
-- If the the item has the ignore flag, it is ignored
return true
return true
elseif (objLoc == invItemLocKeyring) then
-- If the item is on the keyring, we ignore the item if the keyring is ignored
return inv.config.table.doIgnoreKeyring
else
else
-- Check if the object is in a container and, if so, if that container is ignored
-- Check if the object is in a container and, if so, if that container is ignored
return inv.items.isIgnored(tonumber(inv.items.getField(objId, invFieldObjLoc) or ""))
return inv.items.isIgnored(tonumber(objLoc) or "")
end -- if
end -- if
@ -8240,8 +8281,7 @@ function inv.items.displayItem(objId, verbosity, wearableLoc)
local highlightOn = ""
local highlightOn = ""
local highlightOff = ""
local highlightOff = ""
local isCurrentlyWorn = false
local isCurrentlyWorn = false
if (type(objLoc) ~= "number") and (inv.items.getField(objId, invFieldObjLoc) ~= invItemLocInventory)
if inv.items.isWorn(objId) and (inv.items.getField(objId, invFieldColorName) ~= "") then
and (inv.items.getField(objId, invFieldColorName) ~= "") then
isCurrentlyWorn = true
isCurrentlyWorn = true
highlightOn = "@W"
highlightOn = "@W"
highlightOff = "@w"
highlightOff = "@w"
@ -12411,7 +12451,7 @@ function inv.priority.addDefault()
dam = 0.9,
dam = 0.9,
hit = 0.4,
hit = 0.4,
avedam = 1 ,
avedam = 0.9 ,
offhandDam = 0.3,
offhandDam = 0.3,
hp = 0.02,
hp = 0.02,
@ -12449,7 +12489,7 @@ function inv.priority.addDefault()
dam = 0.9,
dam = 0.9,
hit = 0.5,
hit = 0.5,
avedam = 1 ,
avedam = 0.9 ,
offhandDam = 0.4,
offhandDam = 0.4,
hp = 0.01,
hp = 0.01,
@ -12494,8 +12534,8 @@ function inv.priority.addDefault()
dam = 0.8,
dam = 0.8,
hit = 0.6,
hit = 0.6,
avedam = 1 ,
avedam = 0.8 ,
offhandDam = 0.5 ,
offhandDam = 0.4 ,
hp = 0.01,
hp = 0.01,
mana = 0.01,
mana = 0.01,
@ -12532,8 +12572,8 @@ function inv.priority.addDefault()
dam = 0.7,
dam = 0.7,
hit = 0.6,
hit = 0.6,
avedam = 1. 0,
avedam = 0.7 ,
offhandDam = 0.6 ,
offhandDam = 0.4 ,
hp = 0.01,
hp = 0.01,
mana = 0.01,
mana = 0.01,
@ -12570,8 +12610,8 @@ function inv.priority.addDefault()
dam = 0.6,
dam = 0.6,
hit = 0.6,
hit = 0.6,
avedam = 1. 0,
avedam = 0.6 ,
offhandDam = 0.7 ,
offhandDam = 0.4 ,
hp = 0.01,
hp = 0.01,
mana = 0.01,
mana = 0.01,
@ -12610,10 +12650,10 @@ function inv.priority.addDefault()
con = 0.5,
con = 0.5,
luck = 1.0,
luck = 1.0,
dam = 0.5,
dam = 0.5,
hit = 0.5 ,
hit = 0.4 ,
avedam = 1. 0,
avedam = 0.5 ,
offhandDam = 0.85 ,
offhandDam = 0.4 ,
hp = 0.01,
hp = 0.01,
mana = 0.01,
mana = 0.01,
@ -19127,7 +19167,7 @@ function dbot.backup.current()
-- Shell commands running in the background aren't guaranteed to complete in the order
-- Shell commands running in the background aren't guaranteed to complete in the order
-- they were made. As a result, we spin here until we know that the backup was actually
-- they were made. As a result, we spin here until we know that the backup was actually
-- renamed before we move on to the next backup.
-- renamed before we move on to the next backup.
dbot.spinUntilExistsBusy(backupDir .. fullOlderBackup, 2 )
dbot.spinUntilExistsBusy(backupDir .. fullOlderBackup, 5 )
end -- if
end -- if
end -- for
end -- for
@ -19252,7 +19292,7 @@ function dbot.backup.delete(name, endTag, isQuiet)
if (backupName.baseName == name) then
if (backupName.baseName == name) then
dbot.debug("dbot.backup.delete: Executing \"rmdir /s /q \"" .. backupName.dirName .. "\"\"")
dbot.debug("dbot.backup.delete: Executing \"rmdir /s /q \"" .. backupName.dirName .. "\"\"")
dbot.shell("rmdir /s /q \"" .. backupName.dirName .. "\" > nul")
dbot.shell("rmdir /s /q \"" .. backupName.dirName .. "\" > nul")
retval = dbot.spinWhileExistsBusy(backupName.dirName, 2 )
retval = dbot.spinWhileExistsBusy(backupName.dirName, 5 )
if (retval ~= DRL_RET_SUCCESS) then
if (retval ~= DRL_RET_SUCCESS) then
dbot.warn("dbot.backup.delete: Failed to delete backup \"@G" .. name .. "@W\": " ..
dbot.warn("dbot.backup.delete: Failed to delete backup \"@G" .. name .. "@W\": " ..
dbot.retval.getString(retval))
dbot.retval.getString(retval))