Module:Inventory: Difference between revisions

178 bytes added ,  15:46, 3 July 2022
support population item sets
mNo edit summary
(support population item sets)
Line 88: Line 88:
else
else
   --[logic for population tables]--
   --[logic for population tables]--
  local descprefix = 'Item from '
  if chance == '*' then
    descprefix = 'Set of items from '
  end
   favilinkhtml = mw.html.create('div')
   favilinkhtml = mw.html.create('div')
               :addClass('qud-inv-favilink-wrapper')
               :addClass('qud-inv-favilink-wrapper')
Line 94: Line 98:
                     :wikitext('?'))
                     :wikitext('?'))
               :node(mw.html.create('span')
               :node(mw.html.create('span')
                     :wikitext('Item from [[Population:' .. objname .. '|' .. objname .. ']]'))
                     :wikitext(descprefix .. '[[Population:' .. objname .. '|' .. objname .. ']]'))
end
end


local chancestr = '*'
if chance ~= '*' then
  chancestr = '(' .. chance .. '%)'
end
local inventoryhtml = mw.html.create('div')
local inventoryhtml = mw.html.create('div')
inventoryhtml
inventoryhtml
Line 106: Line 114:
             :node(mw.html.create('span')
             :node(mw.html.create('span')
                   :addClass('qud-item-chance chance-' .. chance)
                   :addClass('qud-item-chance chance-' .. chance)
                   :wikitext('(' .. chance .. '%)')))
                   :wikitext(chancestr)))