Module:Damage: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 129: Line 129:
             local passive_index = string.match(k, "%d")
             local passive_index = string.match(k, "%d")
             local passive_values = split(is_custom and v or
             local passive_values = split(is_custom and v or
            frame:preprocess('{{:' .. passive_name .. '}}{{#arrayprint:' .. passive_name .. '}}'));
                frame:preprocess('{{:' .. passive_name .. '}}{{#arrayprint:' .. passive_name .. '}}'));


             if is_custom then
             if is_custom then
Line 596: Line 596:
             text = { 'Normal',
             text = { 'Normal',
                 OPTIONS.is_append and
                 OPTIONS.is_append and
                 link(PASSIVES[OPTIONS.append_index].name, PASSIVES[OPTIONS.append_index].alias or OPTIONS.append_name or nil, PASSIVES[OPTIONS.append_index].suffix, PASSIVES[OPTIONS.append_index].exist) },
                 link(PASSIVES[OPTIONS.append_index].name,
                    PASSIVES[OPTIONS.append_index].alias or OPTIONS.append_name or nil,
                    PASSIVES[OPTIONS.append_index].suffix, PASSIVES[OPTIONS.append_index].exist) },
             keywords = { OPTIONS.is_append and ('passive' .. OPTIONS.append_index) or nil },
             keywords = { OPTIONS.is_append and ('passive' .. OPTIONS.append_index) or nil },
             is_visible = OPTIONS.is_append or false
             is_visible = OPTIONS.is_append or false
Line 644: Line 646:
             text = {
             text = {
                 (inArgs('count') and not OPTIONS.use_avg) and
                 (inArgs('count') and not OPTIONS.use_avg) and
                 (table.concat({ 'Per', args.count_name or 'Instance' }, ' ')) or 'Average',
                 (table.concat({ 'Per', args.count_name or 'Group' }, ' ')) or 'Average',
                 'Max'
                 'Max'
             },
             },
Line 788: Line 790:
         mode_row:tag('td'):wikitext(frame:expandTemplate { title = mode })
         mode_row:tag('td'):wikitext(frame:expandTemplate { title = mode })
         local damage_entries = returnDamageInOrder()
         local damage_entries = returnDamageInOrder()
        local last_number
        local last_unique_cell


         for _, damage_key in ipairs(damage_entries) do
         for _, damage_key in ipairs(damage_entries) do
             if args.dump_names ~= 'true' then
             if args.dump_names ~= 'true' then
                 local damage_number = FINAL_DAMAGE[mode][damage_key]
                 local damage_number = FINAL_DAMAGE[mode][damage_key]
                -- Display ranges.
                 damage_number = doRangeText(damage_number)
                 damage_number = doRangeText(damage_number)


                 mode_row:tag('td'):wikitext(damage_number
                 if last_number ~= damage_number then
                    -- Error out if it doesn't exist
                    -- Display ranges.
                    or frame:expandTemplate {
                    local new_cell = mode_row:tag('td'):wikitext(damage_number
                        title = 'color',
                        -- Error out if it doesn't exist
                        args = { 'red', '#ERROR' }
                        or frame:expandTemplate {
                     })
                            title = 'color',
                            args = { 'red', '#ERROR' }
                        })
                    last_unique_cell = new_cell
                else
                     last_unique_cell:attr('colspan', (last_unique_cell:getAttr('colspan') or 1) + 1)
                end
                last_number = damage_number
             else
             else
                 mode_row:tag('td'):wikitext(damage_key)
                 mode_row:tag('td'):wikitext(damage_key)