2012-05-18 09:18:49 -06:00
|
|
|
local _ENV = mkmodule('plugins.sort.items')
|
|
|
|
|
|
|
|
local utils = require('utils')
|
|
|
|
|
|
|
|
orders = orders or {}
|
|
|
|
|
|
|
|
-- Relies on NULL being auto-translated to NULL, and then sorted
|
|
|
|
orders.exists = {
|
|
|
|
key = function(item)
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
orders.type = {
|
|
|
|
key = function(item)
|
|
|
|
return item:getType()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
orders.description = {
|
|
|
|
key = function(item)
|
2012-05-20 11:57:45 -06:00
|
|
|
return dfhack.items.getDescription(item,0)
|
2012-05-18 09:18:49 -06:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2012-09-28 08:01:17 -06:00
|
|
|
orders.base_quality = {
|
2012-05-18 09:18:49 -06:00
|
|
|
key = function(item)
|
|
|
|
return item:getQuality()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2012-09-28 08:01:17 -06:00
|
|
|
orders.quality = {
|
|
|
|
key = function(item)
|
|
|
|
return item:getOverallQuality()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2012-05-18 09:18:49 -06:00
|
|
|
orders.improvement = {
|
|
|
|
key = function(item)
|
|
|
|
return item:getImprovementQuality()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
orders.wear = {
|
|
|
|
key = function(item)
|
|
|
|
return item:getWear()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
orders.material = {
|
|
|
|
key = function(item)
|
|
|
|
local mattype = item:getActualMaterial()
|
|
|
|
local matindex = item:getActualMaterialIndex()
|
|
|
|
local info = dfhack.matinfo.decode(mattype, matindex)
|
|
|
|
if info then
|
|
|
|
return info:toString()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2022-04-12 12:48:19 -06:00
|
|
|
return _ENV
|