From b4ed8eeac780841370acb16c2e63787ea5795b2a Mon Sep 17 00:00:00 2001 From: Durel Date: Fri, 18 May 2018 16:11:44 -0400 Subject: [PATCH 1/5] 1) Added a workaround for quivers. Aard reports a quiver wearable location as "ready" but you can't wear anything at the "ready" location. Instead, you must wear it as the "readied" location. Dinv now translates "ready" to "readied" as necessary. 2) Added "@Gdinv consume display owned@W" mode to list only items in your consumable table that you actually have in your inventory. This gives you a quick summary of what you are actually carrying and suppresses items if you don't have any of that item type. --- aard_inventory.xml | 61 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/aard_inventory.xml b/aard_inventory.xml index cf6688e..47e6cea 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -89,7 +89,7 @@ dbot.version : Module to track version and changelog information and update the save_state="y" date_written="2017-08-12 08:45:15" requires="4.98" - version="2.0043" + version="2.0044" > 0)) then + if (not didPrintHeader) then + dbot.print(header) + didPrintHeader = true + end -- if + dbot.print(string.format(" %3d %5d %s%4d@w %s", + (entry.level or 0), (entry.room or 0), countColor, count, (entry.name or "nil"))) + end -- if numEntries = numEntries + 1 end -- for end -- if From 397a73606d0bb32255a1d27b0867e3853b2728be Mon Sep 17 00:00:00 2001 From: Durel Date: Fri, 18 May 2018 18:44:23 -0400 Subject: [PATCH 2/5] 1) Added preliminary "dinv commlog" mode to echo messages to the communication log plugin --- aard_inventory.xml | 77 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/aard_inventory.xml b/aard_inventory.xml index 47e6cea..f319446 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -640,9 +640,19 @@ Feature Wishlist > + + + Date: Fri, 18 May 2018 21:59:02 -0400 Subject: [PATCH 3/5] 1) Fixed bug where weapon identification did not account for temporary stats on a tempered or envenomed weapon --- aard_inventory.xml | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/aard_inventory.xml b/aard_inventory.xml index f319446..756cdc0 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -9667,6 +9667,17 @@ function inv.items.trigger.itemIdStats(line) _, _, weaponType = string.find(line, "Weapon Type:%s+(%a+)%s+") _, _, specials = string.find(line, "Specials%s+:%s+(%a+)%s+") + local tmpAvedam, tmpHR, tmpDR, tmpInt, tmpWis, tmpLuck, tmpStr, tmpDex, tmpCon + _, _, tmpAvedam = string.find(line, ":%s+adds [+-](%d+) average damage%s+") + _, _, tmpHR = string.find(line, ":%s+hit roll [+-](%d+)") + _, _, tmpDR = string.find(line, ":%s+damage roll [+-](%d+)") + _, _, tmpInt = string.find(line, ":%s+intelligence [+-](%d+)") + _, _, tmpWis = string.find(line, ":%s+wisdom [+-](%d+)") + _, _, tmpLuck = string.find(line, ":%s+luck [+-](%d+)") + _, _, tmpStr = string.find(line, ":%s+strength [+-](%d+)") + _, _, tmpDex = string.find(line, ":%s+dexterity [+-](%d+)") + _, _, tmpCon = string.find(line, ":%s+constitution [+-](%d+)") + if (id ~= nil) then inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldId, dbot.tonumber(id or "")) dbot.debug("Id = \"" .. id .. "\"") @@ -10051,6 +10062,69 @@ function inv.items.trigger.itemIdStats(line) dbot.debug("avedam = \"" .. avedam .. "\"") end -- if + if (tmpAvedam ~= nil) then + local currentAvedam = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldAveDam) + local newAvedam = dbot.tonumber(tmpAvedam) + currentAvedam + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldAveDam, newAvedam) + dbot.debug("tmpAvedam = \"" .. tmpAvedam .. "\"") + end -- if + + if (tmpHR ~= nil) then + local currentHR = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldHit) + local newHR = dbot.tonumber(tmpHR) + currentHR + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldHit, newHR) + dbot.debug("tmpHR = \"" .. tmpHR .. "\"") + end -- if + + if (tmpDR ~= nil) then + local currentDR = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldDam) + local newDR = dbot.tonumber(tmpDR) + currentDR + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldDam, newDR) + dbot.debug("tmpDR = \"" .. tmpDR .. "\"") + end -- if + + if (tmpInt ~= nil) then + local currentInt = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldInt) + local newInt = dbot.tonumber(tmpInt) + currentInt + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldInt, newInt) + dbot.debug("tmpInt = \"" .. tmpInt .. "\"") + end -- if + + if (tmpWis ~= nil) then + local currentWis = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldWis) + local newWis = dbot.tonumber(tmpWis) + currentWis + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldWis, newWis) + dbot.debug("tmpWis = \"" .. tmpWis .. "\"") + end -- if + + if (tmpLuck ~= nil) then + local currentLuck = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldLuck) + local newLuck = dbot.tonumber(tmpLuck) + currentLuck + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldLuck, newLuck) + dbot.debug("tmpLuck = \"" .. tmpLuck .. "\"") + end -- if + + if (tmpStr ~= nil) then + local currentStr = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldStr) + local newStr = dbot.tonumber(tmpStr) + currentStr + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldStr, newStr) + dbot.debug("tmpStr = \"" .. tmpStr .. "\"") + end -- if + + if (tmpDex ~= nil) then + local currentDex = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldDex) + local newDex = dbot.tonumber(tmpDex) + currentDex + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldDex, newDex) + dbot.debug("tmpDex = \"" .. tmpDex .. "\"") + end -- if + + if (tmpCon ~= nil) then + local currentCon = inv.items.getStatField(inv.items.identifyPkg.objId, invStatFieldCon) + local newCon = dbot.tonumber(tmpCon) + currentCon + inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldCon, newCon) + dbot.debug("tmpCon = \"" .. tmpCon .. "\"") + end -- if + if (inflicts ~= nil) then inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldInflicts, inflicts) dbot.debug("inflicts = \"" .. inflicts .. "\"") From d8587d8d70702df53d935a86be21ac0efdf536d0 Mon Sep 17 00:00:00 2001 From: Durel Date: Sun, 20 May 2018 13:49:39 -0400 Subject: [PATCH 4/5] 1) Removed experimental and undocumented "dinv auto" mode due to potential botting concerns --- aard_inventory.xml | 200 --------------------------------------------- 1 file changed, 200 deletions(-) diff --git a/aard_inventory.xml b/aard_inventory.xml index 756cdc0..9018c4d 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -660,26 +660,6 @@ Feature Wishlist > - - - - - - @@ -1709,9 +1689,6 @@ end -- inv.config.new -- inv.cli.help.usage() -- inv.cli.help.examples() -- --- inv.cli.autoQueue.fn1(name, line, wildcards) --- inv.cli.autoQueue.fn2(name, line, wildcards) --- ---------------------------------------------------------------------------------------------------- inv.cli = {} @@ -5020,36 +4997,6 @@ Examples: end -- inv.cli.help.examples -inv.cli.autoQueue = {} -function inv.cli.autoQueue.fn1(name, line, wildcards) - dbot.autoQueueState = dbot.autoQueueHalted - 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 = "x" .. (maxCmds or "nil") .. ", " .. string.gsub(command, ";", ";;") - local endTag = inv.tags.new(paramStr, nil, nil, nil) - - if (state == "active") then - state = "3" - elseif (state == "combat") then - state = "8" - end -- if - - 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.commlog = {} @@ -17076,7 +17023,6 @@ invTagsForget = "forget" invTagsNotify = "notify" invTagsCache = "cache" invTagsVersion = "version" -invTagsAutoQueue = "autoQueue" invTagsHelp = "help" inv.tags.modules = invTagsBuild .. " " .. @@ -17100,7 +17046,6 @@ inv.tags.modules = invTagsBuild .. " " .. invTagsNotify .. " " .. invTagsCache .. " " .. invTagsVersion .. " " .. - invTagsAutoQueue .. " " .. invTagsHelp @@ -22543,151 +22488,6 @@ function dbot.version.update.releaseCR() end -- dbot.version.update.releaseCR ----------------------------------------------------------------------------------------------------- --- dbot.autoQueue: Module to repeatedly execute a command under a specific set of circumstances --- --- dbot.autoQueue(command, maxCommands, commandTimeout, totalTimeout, state, endTag) --- dbot.autoQueueCR() --- --- Note: The "state" parameter refers to a gmcp state, such as dbot.stateActive or dbot.stateCombat --- --- Note2: If the character's room changes before the queue completes, the queue is aborted --- ----------------------------------------------------------------------------------------------------- - -dbot.autoQueueEnabled = "enabled" -dbot.autoQueueDisabled = "disabled" -dbot.autoQueueHalted = "halted" -dbot.autoQueueState = dbot.autoQueueEnabled -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 "") - local startRoom = dbot.gmcp.getRoomId() - - 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 auto queue 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.startRoom = startRoom - dbot.autoQueuePkg.state = state - dbot.autoQueuePkg.endTag = endTag - - dbot.autoQueueState = dbot.autoQueueEnabled - - 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 startRoom = dbot.autoQueuePkg.startRoom - local stateName = dbot.stateNames[dbot.autoQueuePkg.state] or "unknown" - 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.autoQueueState == dbot.autoQueueEnabled) do - local fence = dbot.autoQueueFence .. " " .. dbot.autoQueueFenceIdx - local iterInfo = "@C" .. dbot.autoQueuePkg.command .. " @W" .. numCmds .. "@w/@W" .. - dbot.autoQueuePkg.maxCommands - local haltInfo = "@C" .. dbot.autoQueuePkg.command .. "@W" - local currentState = dbot.gmcp.getState() or "Unknown" - dbot.autoQueueFenceIdx = dbot.autoQueueFenceIdx + 1 - - -- I don't like one-off work-arounds, but here is one anyway...It is a common situation to want to - -- use a series of combat commands. However, the auto queue won't run combat commands if we are in - -- the active state. As a result, the user would need to engage a mob (or mobs) manually and then - -- kick off the auto queue to continue combat. The work-around below allows the queue to execute one - -- iteration if the user currently is in the active state and the queue runs in the combat state. - -- That allows the user to initiate combat with a command in the auto queue. IMPORTANT: starting the - -- auto queue should *always* be done manually and never with a trigger -- that could potentially be - -- botting. - local useCombatKickstart = false - if (currentState == dbot.stateActive) and - (dbot.autoQueuePkg.state == dbot.stateCombat) and - (numCmds == 1) then - useCombatKickstart = true - end -- if - - -- Execute the next command in the queue if we are still in our starting room and haven't changed state. - -- Otherwise, halt the queue because we don't want to "bot" by changing rooms in the middle of the - -- series of commands. - if (startRoom ~= dbot.gmcp.getRoomId()) then - dbot.info("@YAuto queue @WHALTED " .. haltInfo .. "@Y You changed rooms") - dbot.autoQueueState = dbot.autoQueueDisabled - retval = DRL_RET_HALTED - - elseif (currentState ~= dbot.autoQueuePkg.state) and (not useCombatKickstart) then - dbot.info("@YAuto queue @WHALTED " .. haltInfo .. "@Y You are not in the @G" .. stateName .. - "@Y state") - dbot.autoQueueState = dbot.autoQueueDisabled - retval = DRL_RET_HALTED - - else - dbot.debug("@YAuto queue @Wstarted " .. iterInfo) - - 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 (dbot.getTime() - startTime > dbot.autoQueuePkg.totalTimeout) then - dbot.info("@YAuto queue @WHALTED " .. haltInfo .. "@Y Request timed out") - dbot.autoQueueState = dbot.autoQueueDisabled - retval = DRL_RET_TIMEOUT - - else - dbot.info("@YAuto queue @Wcompleted " .. iterInfo) - - -- Break if we completed all of the requested commands - if (numCmds >= dbot.autoQueuePkg.maxCommands) then - dbot.autoQueueState = dbot.autoQueueDisabled - end -- if - end -- if - - end -- if - - numCmds = numCmds + 1 - - end -- while - - if (dbot.autoQueueState == dbot.autoQueueHalted) then - retval = DRL_RET_HALTED - end -- if - - dbot.autoQueuePkg = nil - return inv.tags.stop(invTagsAutoQueue, endTag, retval) -end -- dbot.autoQueueCR - - ]]> From d479e716e258d12d3314b5e5f12786efd73a98f4 Mon Sep 17 00:00:00 2001 From: Durel Date: Sun, 20 May 2018 14:20:54 -0400 Subject: [PATCH 5/5] Version 2.0044 changelog --- aard_inventory.changelog | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/aard_inventory.changelog b/aard_inventory.changelog index c51b813..afc32ee 100644 --- a/aard_inventory.changelog +++ b/aard_inventory.changelog @@ -1,6 +1,27 @@ dbot.changelog = {} +dbot.changelog[2.0044] = +{ + { change = drlDbotChangeLogTypeFix, + desc = [[Fixed bug where weapon identification did not account for temporary stats on a tempered + or envenomed weapon]] + }, + { change = drlDbotChangeLogTypeFix, + desc = [[Added a workaround for quivers. Aard reports a quiver wearable location as "ready" but + you can't wear anything at the "ready" location. Instead, you must wear it as the "readied" + location. Dinv now translates "ready" to "readied" as necessary.]] + }, + { change = drlDbotChangeLogTypeNew, + desc = [[Added "@Gdinv consume display owned@W" mode to list only items in your consumable table + that you actually have in your inventory. This gives you a quick summary of what you are + actually carrying and suppresses items if you don't have any of that item type.]] + }, + { change = drlDbotChangeLogTypeMisc, + desc = [[Removed experimental "dinv auto" mode]] + } +} + dbot.changelog[2.0043] = { { change = drlDbotChangeLogTypeFix,