Module:Room features: Difference between revisions

variant categories will now be sorted by their category type
No edit summary
(variant categories will now be sorted by their category type)
 
Line 7:
 
local infobox_cat_map = {
['Monstermonster'] = 'Monsters',
['NPCnpc'] = 'Non-player characters',
['Sceneryscenery'] = 'Scenery',
['Skill_nodeskill_node'] = 'Nodes',
['Ventureventure'] = 'Ventures',
['Shopshop'] = 'Shops',
['variant_category'] = 'Variants',
['Variant_Category'] = 'Nodes', -- merge with nodes, since the only variants with locations should be nodes
}
 
Line 27:
'?Location object.Image#-=image_sub',
'?Location object.Infobox=infobox_sub',
'?Location object.Variant type=vartype_sub',
'?Location quantity',
'?#-',
Line 48 ⟶ 49:
results_by_type[v] = {}
end
-- FIXME: Variant category pages (like [[Sparring Guard]]) do not
-- have an infobox so are not shown
for i,v in ipairs(query) do
local keyinfobox_type = infobox_cat_map[(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
if key ~= nil then
19,555

edits