Module:Sandbox/LVL: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 87: Line 87:
             local val = calculate_bps(hero, bb)
             local val = calculate_bps(hero, bb)
             if val > 0 then
             if val > 0 then
                -- Calculate shots needed using the raw, unrounded value
                -- math.ceil rounds 5.0001 up to 6
                local shots = math.ceil(100 / val)
               
                 table.insert(hero_list, {
                 table.insert(hero_list, {
                     name = hero["Name"],
                     name = hero["Name"],
                     bps = val
                     bps = val,
                    shots = shots
                 })
                 })
             end
             end
Line 104: Line 109:
     headerRow:tag('th'):wikitext('Hero')
     headerRow:tag('th'):wikitext('Hero')
     headerRow:tag('th'):wikitext('% per shot')
     headerRow:tag('th'):wikitext('% per shot')
    headerRow:tag('th'):wikitext('Shots to Proc') -- New Column


     for _, h in ipairs(hero_list) do
     for _, h in ipairs(hero_list) do
         local row = html:tag('tr')
         local row = html:tag('tr')
        -- Expand HeroIcon template
         local icon_template = frame:expandTemplate{ title = 'HeroIcon', args = { h.name } }
         local icon_template = frame:expandTemplate{ title = 'HeroIcon', args = { h.name } }
         row:tag('td'):wikitext(icon_template)
         row:tag('td'):wikitext(icon_template)
         row:tag('td'):wikitext(string.format("%.1f", h.bps))
         row:tag('td'):wikitext(string.format("%.1f", h.bps))
        row:tag('td'):wikitext(tostring(h.shots)) -- New Value
     end
     end