From 07a1630ba3537e0b7ad6e8b7e53493d6522b807e Mon Sep 17 00:00:00 2001 From: Durel Date: Tue, 5 Feb 2019 12:36:23 -0500 Subject: [PATCH] Version 2.0048 1) Tweaked set creation settings to be slightly faster and more responsive if the user sends commands to the mud while the set is being created 2) Updated ability checking module (e.g., "dual wield") to use aard's new gmcp class information instead of relying on an asynchronous call to "showskill" 3) Fixed a bug where dinv could mistakenly think you still had access to dual wield if you tier without logging out/in. 4) Updated dinv to check if you have access to a particular weapon skill before choosing that weapon for an equipment set. Note that dinv does not check if you have a weapon skill practiced -- that's up to you -- but dinv will no longer select a weapon for you that is not even available to you at your current mort. Also, note that weapons selected during an analysis are chosen based on weapon skills available at the time the analysis is created. --- aard_inventory.changelog | 24 ++++ aard_inventory.xml | 258 +++++++++++---------------------------- 2 files changed, 98 insertions(+), 184 deletions(-) diff --git a/aard_inventory.changelog b/aard_inventory.changelog index 4a38a55..f8c5a83 100644 --- a/aard_inventory.changelog +++ b/aard_inventory.changelog @@ -2,6 +2,30 @@ dbot.changelog = {} +dbot.changelog[2.0048] = +{ + { change = drlDbotChangeLogTypeFix, + desc = [[Fixed a bug where dinv could mistakenly think you still had access to dual wield + if you tier without logging out/in.]] + }, + { change = drlDbotChangeLogTypeFix, + desc = [[Updated dinv to check if you have access to a particular weapon skill before + choosing that weapon for an equipment set. Note that dinv does not check if you + have a weapon skill practiced -- that's up to you -- but dinv will no longer + select a weapon for you that is not even available to you at your current mort. + Also, note that weapons selected during an analysis are chosen based on weapon + skills available at the time the analysis is created.]] + }, + { change = drlDbotChangeLogTypeNew, + desc = [[Tweaked set creation settings to be slightly faster and more responsive if the + user sends commands to the mud while the set is being created.]] + }, + { change = drlDbotChangeLogTypeMisc, + desc = [[Updated ability checking module (e.g., "dual wield") to use aard's new gmcp class + information instead of relying on an asynchronous call to "showskill".]] + } +} + dbot.changelog[2.0047] = { { change = drlDbotChangeLogTypeFix, diff --git a/aard_inventory.xml b/aard_inventory.xml index 4732712..84aa693 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.0047" + version="2.0048" > waitForHaveAbilityThreshold) then - dbot.error("dbot.ability.isAvailable: Failed to get level availability: timed out") - dbot.deleteTrigger(dbot.ability.trigger.startName) - abilityIsAvailable = false - retval = DRL_RET_TIMEOUT - break - end -- if - end -- while + -- For each class in the char's mort list, check if they have access to the skill + for classNum in classList:gmatch("%d") do + local className = dbot.ability.classes[classNum] + if (className == nil) then + dbot.error("dbot.ability.isAvailable: Detected invalid class number \"" .. (classNum or "nil") .. "\"") + return abilityIsAvailble, DRL_RET_INTERNAL_ERROR end -- if - end -- if - -- Check the level info we found - if (dbot.abilityPkg.useLevel ~= nil) and - (dbot.abilityPkg.useLevel + (10 * dbot.gmcp.getTier()) <= level) then + local classLevel = dbot.ability.table[ability][className] + if (classLevel ~= nil) and (reqLevel >= classLevel) then + dbot.debug("\"" .. ability .. "\" is available from class \"" .. className .. "\" @@ level " .. classLevel) abilityIsAvailable = true - end -- if + break + end -- if + end -- for - -- Clean up and return - dbot.ability.isInProgress = false return abilityIsAvailable, retval end -- dbot.ability.isAvailable -function dbot.ability.isCached(ability, level) - -- Check if we already checked for this ability at a previous level. If we are at a higher - -- level than before and we had the ability before, there is no need to check it again -- we - -- don't lose ability as we get higher level. We could generate a big table for each ability - -- but we probably will only use this for one skill (dual wield) so we simply cache just the - -- previous ability. We can extend this later if we want to. The worst case is that we do - -- some extra "showskill" requests. - if (dbot.abilityPkg.ability ~= nil) and (dbot.abilityPkg.ability == ability) and - (dbot.abilityPkg.checkLevel ~= nil) and (dbot.abilityPkg.checkLevel <= level) and - (dbot.abilityPkg.useLevel ~= nil) then - return true - else - return false - end -- if -end -- dbot.ability.isCached - - -function drlHaveAbilityStartTriggerFn(line) - if string.find(line, "is not a valid skill or spell") or string.find(line, "You cannot use this") then - dbot.abilityPkg.useLevel = 300 -- we can't use this - return - end -- if - - -- Enable a trigger to watch for the output of the ability availability output. The trigger - -- will disable itself when it sees a fence message that indicates the output is done. - EnableTrigger(dbot.ability.trigger.levelName, true) -end -- drlHaveAbilityStartTriggerFn - - -dbot.ability.trigger.levelMsg = "DINV showskill fence" -function dbot.ability.trigger.levelFn(line) - local useLevel - _, _, useLevel = string.find(line, "Your Level%s+:%s+(%d+)") - - -- If we our fence echo message, we know that the output is done and we can disable this trigger - if (line == dbot.ability.trigger.levelMsg) then - EnableTrigger(dbot.ability.trigger.levelName, false) - - -- If we can't use the skill, set the useLevel out of reach - elseif string.find(line, "You cannot use this") then - dbot.abilityPkg.useLevel = 300 - - -- Check if we found our level in a line like: "Your Level : 22 Learned: 95% " - elseif (useLevel ~= nil) and (tonumber(useLevel) ~= nil) then - dbot.abilityPkg.useLevel = tonumber(useLevel) or 300 - - end -- if -end -- dbot.ability.trigger.levelFn - - -function dbot.ability.setupFn() - -- Add a trigger series that will pull out the level at which the character can use the ability - check (AddTriggerEx(dbot.ability.trigger.startName, - "^.*(" .. - "------------------------------------------------------|" .. - "is not a valid skill or spell" .. - ").*$", - "drlHaveAbilityStartTriggerFn(\"%1\")", - drlTriggerFlagsBaseline + trigger_flag.OneShot + trigger_flag.OmitFromOutput, - custom_colour.Custom11, - 0, "", "", sendto.script, 0)) -end -- dbot.ability.setupFn - - ---------------------------------------------------------------------------------------------------- -- -- Module to track wishes