Module:Room features: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
(variant categories will now be sorted by their category type)
 
Line 7: Line 7:


local infobox_cat_map = {
local infobox_cat_map = {
['Monster'] = 'Monsters',
['monster'] = 'Monsters',
['NPC'] = 'Non-player characters',
['npc'] = 'Non-player characters',
['Scenery'] = 'Scenery',
['scenery'] = 'Scenery',
['Skill_node'] = 'Nodes',
['skill_node'] = 'Nodes',
['Venture'] = 'Ventures',
['venture'] = 'Ventures',
['Shop'] = 'Shops',
['shop'] = 'Shops',
['variant_category'] = 'Variants',
['Variant_Category'] = 'Nodes', -- merge with nodes, since the only variants with locations should be nodes
}
}


Line 27: Line 27:
'?Location object.Image#-=image_sub',
'?Location object.Image#-=image_sub',
'?Location object.Infobox=infobox_sub',
'?Location object.Infobox=infobox_sub',
'?Location object.Variant type=vartype_sub',
'?Location quantity',
'?Location quantity',
'?#-',
'?#-',
Line 48: Line 49:
results_by_type[v] = {}
results_by_type[v] = {}
end
end
-- FIXME: Variant category pages (like [[Sparring Guard]]) do not
-- have an infobox so are not shown
for i,v in ipairs(query) do
for i,v in ipairs(query) do
local key = infobox_cat_map[v.infobox_sub or v.infobox]
local infobox_type = (v.infobox_sub=='Variant_Category' and v.vartype_sub) or v.infobox_sub or v.infobox or ''
--convert to all lower case with underscores instead of spaces, for best possible matching
infobox_type = string.lower(infobox_type)
infobox_type = string.gsub(infobox_type,' ','_')
local key = infobox_cat_map[infobox_type]
-- Can be nil - See East Beach for example
-- Can be nil - See East Beach for example
if key ~= nil then
if key ~= nil then