Module:Inventory: Difference between revisions

10 bytes added ,  15:49, 3 July 2022
m
no edit summary
(support population item sets)
mNo edit summary
Line 89: Line 89:
   --[logic for population tables]--
   --[logic for population tables]--
   local descprefix = 'Item from '
   local descprefix = 'Item from '
   if chance == '*' then
   if quantity == '*' then
     descprefix = 'Set of items from '
     descprefix = 'Set of items from '
   end
   end
Line 101: Line 101:
end
end


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