Advertisement

Module:MasteryCombinations

Documentation for this module may be created at Module:MasteryCombinations/doc

local functions = {
 
    main = function(frame)
 
        --intended to use within a template only!
        local args = frame:getParent().args

        --primary mastery
        local primary = string.gsub(args[1], "%s+", "")
        local masteries = { "warfare", "defense", "earth", "storm", "rogue", "hunting", "nature", "spirit", "dream", "rune" }
        
        --common class, header and first row
        local wikitext = string.format("{| class=\"article-table\"\n! Masteries\n! Class\n|-\n|[[File:%s.png|40px]]\n|[[%s]]", primary, args[primary])

        for i = 1, 10 do
            local secondary = masteries[i]
            if primary ~= secondary then
                wikitext = wikitext .. string.format("\n|-\n|[[File:%s.png|40px]]<b>&nbsp;+&nbsp;</b>[[File:%s.png|link=%s Mastery|40px]]\n|[[%s]]", primary, secondary, secondary, args[secondary])
            end
        end
           
        wikitext = wikitext .. "\n|}"
        return wikitext
    
    end

} 
 
return functions

-- [[Category:Modules]]