1) Fixed broken support for items of type "Raw material:[whatever]". If you previously had

any ore you will want to run "dinv forget type Raw" and then run "dinv refresh all" to
   properly identify it.
master
Durel 7 years ago
parent 4aeadb1b17
commit 44e998a858

@ -7921,7 +7921,7 @@ end -- inv.items.search
-- name bob
-- keyword shardblade
-- Note: This must be called from within a co-routine because inv.items.convertRelative() can block
function inv.items.searchCR(queryString, allowIgnored)
function inv.items.searchCR(rawQueryString, allowIgnored)
local retval = DRL_RET_SUCCESS
local arrayOfKvArrays = {}
local kvArray = {}
@ -7931,11 +7931,15 @@ function inv.items.searchCR(queryString, allowIgnored)
local element
local numWordsInQuery = 0
if (queryString == nil) then
if (rawQueryString == nil) then
dbot.warn("inv.items.searchCR: Missing query string parameter")
return DRL_RET_INVALID_PARAM
end -- if
-- Raw materials are the one type that has a space in the name (e.g., "Raw material:Ore").
-- Internally, we treat the type as "RawMaterial:[whatever]".
local queryString = string.gsub(rawQueryString, "type[ ]+[rR]aw[ ]+[mM]aterial", "type RawMaterial")
-- Count the number of words in the query string. We use an obscure form of gsub() for this.
-- The gsub function's 2nd return value is the number of substitutions made. If we do a dummy
-- substitution for each block of non-space characters in the query, we can get a count of the
@ -8409,6 +8413,8 @@ function inv.items.displayItem(objId, verbosity, wearableLoc)
typeExtended = weaponType
elseif (typeField == invmon.typeStr[invmonTypeContainer]) then
typeExtended = "Contain"
elseif (typeField == "RawMaterial:Ore") then
typeExtended = "Ore"
elseif (wearable == "") or (wearable == invmon.typeStr[invmonTypeHold]) then
typeExtended = typeField
else
@ -9100,7 +9106,7 @@ function inv.items.trigger.itemIdStats(line)
dbot.debug("stats for item " .. inv.items.identifyPkg.objId .. ":\"" .. line .. "\"")
local isPartialId, id, name, level, weight, wearable, score, keywords, itemType, worth, flags,
affectMods, continuation, material, foundAt, ownedBy, clan
affectMods, continuation, material, foundAt, ownedBy, clan, rawMaterial
isPartialId = string.find(line, "A full appraisal will reveal further information on this item")
@ -9112,6 +9118,8 @@ function inv.items.trigger.itemIdStats(line)
_, _, score = string.find(line, "Score%s+:%s([0-9,]+)%s+")
_, _, keywords = string.find(line, "Keywords%s+:%s+(.-)%s+|")
_, _, itemType = string.find(line, "| Type%s+:%s+(%a+)%s+")
_, _, rawMaterial = string.find(line, "| Type%s+:%s+(Raw material:%a+)")
_, _, worth = string.find(line, "Worth%s+:%s+([0-9,]+)%s+")
_, _, flags = string.find(line, "Flags%s+:%s+(.-)%s+|")
_, _, affectMods = string.find(line, "Affect Mods:%s+(.-)%s+|")
@ -9244,7 +9252,13 @@ function inv.items.trigger.itemIdStats(line)
dbot.debug("Keywords = \"" .. mergedKeywords .. "\"")
end -- if
if (itemType ~= nil) then
if (itemType ~= nil) or (rawMaterial ~= nil) then
-- All item types, with the exception of "Raw material:[whatever]" are a single word. As a
-- result, we treat "Raw material" as a one-off and strip out the space for our internal use.
if (rawMaterial ~= nil) then
itemType = string.gsub(rawMaterial, "Raw material", "RawMaterial")
end -- if
inv.items.setStatField(inv.items.identifyPkg.objId, invStatFieldType, itemType)
dbot.debug("Type = \"" .. itemType .. "\"")
end -- if
@ -19974,7 +19988,7 @@ invmon.typeStr[invmonTypePotion] = "Potion"
invmon.typeStr[invmonTypeFurniture] = "Furniture"
invmon.typeStr[invmonTypeTrash] = "Trash"
invmon.typeStr[invmonTypeContainer] = "Container"
invmon.typeStr[invmonTypeDrinkContainer] = "Drink container"
invmon.typeStr[invmonTypeDrinkContainer] = "Drink"
invmon.typeStr[invmonTypeKey] = "Key"
invmon.typeStr[invmonTypeFood] = "Food"
invmon.typeStr[invmonTypeBoat] = "Boat"

Loading…
Cancel
Save