Module:Traits: Difference between revisions

no edit summary
No edit summary
No edit summary
Tag: Reverted
Line 49: Line 49:
     }
     }


     local details = { { STR.LIGHT, STR.CRITICAL, STR.REVERSED },
     local details = {
         { STR.HEAVY, STR.HASTE,    STR.REGEN2,  STR.RUTHLESS, STR.POWERFUL, STR.REVERSED }, { STR.KB1 },
        { STR.LIGHT, STR.CRITICAL, STR.REVERSED },
         { STR.REGEN1 }, { STR.USEFUL } }
         { STR.HEAVY, STR.HASTE,    STR.REGEN2,  STR.RUTHLESS, STR.POWERFUL, STR.REVERSED },
        { STR.KB1 },
         { STR.REGEN1 },
        { STR.USEFUL }
    }


     -- Default values
     -- Default values
Line 94: Line 98:
         return char:gsub('/', '')
         return char:gsub('/', '')
     end
     end
    local buffs = args.buffs and split(args.buffs)


     local trait_table = mw.html.create('div'):attr('class', 'content-table'):tag('table'):attr({
     local trait_table = mw.html.create('div'):attr('class', 'content-table'):tag('table'):attr({
Line 150: Line 156:
                 local th_detail = tr2:tag('th'):wikitext(prop[detail_key]);
                 local th_detail = tr2:tag('th'):wikitext(prop[detail_key]);
                 th:attr('colspan', tonumber(th:getAttr('colspan') or 1) + 1)
                 th:attr('colspan', tonumber(th:getAttr('colspan') or 1) + 1)
                if prop[detail_key] == 'Duration' then
                    if (trait_name == STR.KB1 or trait_name == STR.KB2) and args.buffs then
                        for _, buff in ipairs(buffs) do
                            if trait_name == STR.KB1 then
                                th_detail:attr('colspan', (th_detail:getAttr('colspan') or 0) + 1)
                                tr2:tag('th'):wikitext(buff)
                            else
                                tr2:tag('th'):wikitext(buff)
                            end
                           
                            th:attr('colspan', (th:getAttr('colspan') or 1) + 1)
                        end
                    end
                end
             end
             end
         end
         end
       


         -- Unnamed argument.
         -- Unnamed argument.
Line 179: Line 201:
                         DURATION = args['duration' .. trait_count],
                         DURATION = args['duration' .. trait_count],
                         CHANCE = args['chance' .. trait_count] or default_value['chance'],
                         CHANCE = args['chance' .. trait_count] or default_value['chance'],
                         DAMAGE = args['dmg' .. trait_count] or default_value['dmg']
                         DAMAGE = args['dmg' .. trait_count] or default_value['dmg'],
                        DEF_IGNORE = args['def_ignore' .. trait_count],
                        DEF_IGNORE_PVP = args['pvp_def_ignore' .. trait_count]
                     }
                     }
                 });
                 });
Line 241: Line 265:
                             end
                             end


                             local detail_cell = (is_pvp and tr4 or tr3):tag('td'):wikitext(detail_text):attr('rowspan', has_pvp_values and (not args[short_detail_improved .. '_pvp']) and 2 or 1);
                             local detail_cell = (is_pvp and tr4 or tr3):tag('td'):wikitext(detail_text):attr('rowspan',
                            has_pvp_values and (not args[short_detail_improved .. '_pvp']) and 2 or 1);
                         end
                         end
                     end
                     end