diff --git a/aard_inventory.xml b/aard_inventory.xml index 241e84d..39f9ba0 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -87,7 +87,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.0012" + version="2.0013" > 291) then + dbot.warn("inv.priority.locIsAllowed: Invalid level parameter") + return false + end -- if + + -- Check if the specified priority exists for the specified level + local priorityTable, retval = inv.priority.get(priorityName, level) + if (priorityTable == nil) then + dbot.warn("inv.priority.locIsAllowed: Priority \"" .. priorityName .. + "\" does not have a priority table " .. "for level " .. level) + return false + end -- if + + local value = tonumber(priorityTable["~" .. wearableLoc] or "") or 0 + if (value == 0) then + return true + else + return false + end -- if + +end -- inv.priority.locIsAllowed + + function inv.priority.addDefault() local retval @@ -12909,9 +12952,9 @@ function inv.set.createWithHandicap(priorityName, level, handicap) end -- if end -- for - -- prune slots that don't have any items + -- prune slots that don't have any items or slots that are ignored for _,w in ipairs(inv.wearables[objWearable]) do - if (newSet[w].id == -1) then + if (newSet[w].id == -1) or (not inv.priority.locIsAllowed(w, priorityName, level)) then newSet[w] = nil end -- if end -- for @@ -12939,6 +12982,11 @@ function inv.set.createWithHandicap(priorityName, level, handicap) end -- if end -- if + -- Check if the priority explicitly bans the "second" wield slot + if (dualWieldAvailable) then + dualWieldAvailable = inv.priority.locIsAllowed(inv.wearLoc[invWearableLocSecond], priorityName, level) + end -- if + -- We already know the highest scoring solo weapon (it is in the "wielded" slot). We now -- find the highest scoring combination of compatible weapons ("wielded" + "second") if the -- char has access to dual wield. @@ -12987,7 +13035,7 @@ function inv.set.createWithHandicap(priorityName, level, handicap) -- Check if we want dual weapons or primary weapon + shield + hold. If we are using dual weapons, -- whack the shield and hold items in the set because we won't be using them. Otherwise, stick with -- the highest scoring weapon, shield, and hold items that we found in the initial search. - if (bestWeaponSet.score > scorePrimary + scoreShield + scoreHold) then + if dualWieldAvailable and (bestWeaponSet.score > scorePrimary + scoreShield + scoreHold) then newSet[inv.wearLoc[invWearableLocWielded]] = bestWeaponSet.primary newSet[inv.wearLoc[invWearableLocSecond]] = bestWeaponSet.offhand newSet[inv.wearLoc[invWearableLocShield]] = nil