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
|
|
|
|
}
|
|
|
|
|
|
|
|
orders.quality = {
|
|
|
|
key = function(item)
|
|
|
|
return item:getQuality()
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
return _ENV
|