Fandom

Fire Emblem Wiki

Module:ClassInfo

5,308pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

--This module is invoked by Template:Classstat, Template:ClassPromotions
--and Template:ClassSkills
 
local getArgs = require('Module:Arguments').getArgs
local getColor = require('Module:Color').colorByGame
local common = require('Module:Common')
local p = {}
 
local games = {
    fe1= '[[Fire Emblem: Ankoku Ryū to Hikari no Tsurugi|FE1]]',
    fe2= '[[Fire Emblem Gaiden|FE2]]',
    fe3= '[[Fire Emblem: Mystery of the Emblem|FE3]]',
    fe4= '[[Fire Emblem: Genealogy of the Holy War|FE4]]',
    fe5= '[[Fire Emblem: Thracia 776|FE5]]',
    fe6= '[[Fire Emblem: Binding Blade|FE6]]',
    fe7= '[[Fire Emblem: Rekka no Ken|FE7]]',
    fe8= '[[Fire Emblem: The Sacred Stones|FE8]]',
    fe9= '[[Fire Emblem: Path of Radiance|FE9]]',
    fe10='[[Fire Emblem: Radiant Dawn|FE10]]',
    fe11='[[Fire Emblem: Shadow Dragon|FE11]]',
    fe12='[[Fire Emblem: Shin Monshō no Nazo ~Hikari to Kage no Eiyū~|FE12]]',
    fe13='[[Fire Emblem Awakening|FE13]]',
    fe14='[[Fire Emblem Fates|FE14]]',
    ts=  '[[TearRing Saga: Utna Heroes Saga|TS]]',
    tms= '[[Tokyo Mirage Sessions ♯FE|TMS♯FE]]',
}
 
local function setRow(arg, game, ext)
    local class = common.colorLinks(game)
    local color = getColor[game]
    local val
    if(ext ~= nil) then
        val = string.gsub(arg[game..'-'..ext], '*', '||')
    else
        val = '\n| '..string.gsub(arg[game], '*', '||')
    end
 
    return
        '\n|style="background:'..color..'" class='..class..
        '|<b>'..games[game]..'</b> '..val..
        '\n|-'
end
 
function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end
 
function p._main(args)
    local out, cols
    local rows = ''
    local nP = 5      -- number of extended parameters
    local nFEG = 14 -- number of FE games
 
    -- COLUMNS
    if(args.type ==  'stat') then
        cols =
            '!![[HP]]  !! [[Str]] !! [[Mag]] !! [[Skl]] !! [[Spd]]'..
            '!![[Lck]] !! [[Def]] !! [[Res]] !! [[Mov]] !! [[Con]]'..
            '!![[Weight (character stat)|Wt.]]'..
            '!![[Weapon Rank|Wp.Rank]]'
    elseif(args.type == 'promotion') then
        cols = '!!Base Class !!width=50%|Promotion Method !!Promoted Class(es)'
    else
        cols = '!!Skill !!Requirements'
    end
 
    -- ROWS
    -- FE games
    for i = 1, nFEG do
        if(args['fe'..i] ~= nil) then rows = rows..setRow(args, 'fe'..i) end
        for j = 1, nP do
            if(args['fe'..i..'-'..j] ~= nil) then
                rows = rows..setRow(args, 'fe'..i, j) end
        end
    end
 
    -- TearRing Saga
    if(args['ts'] ~= nil) then rows = rows..setRow(args, 'ts') end
    for j = 1, nP do
        if(args['ts-'..j] ~= nil) then
            rows = rows..setRow(args, 'ts', j) end
    end
 
    -- TMS♯FE
    if(args['tms'] ~= nil) then rows = rows..setRow(args, 'tms') end
    for j = 1, nP do
        if(args['tms-'..j] ~= nil) then
            rows = rows..setRow(args, 'tms', j) end
    end
 
    -- FINAL OUTPUT
    out =
    '\n{|class="wikitable" style="text-align:center"'..
    '\n|-\n! '..
        cols..
    '\n|-'..
        rows..
    '\n|}'
 
    return out
end
 
 
return p
--[[Category:Modules]]

Also on Fandom

Random Wiki