Module:SkillTable

local p = {}

function p.skill_table(frame) max_lv = frame.args["max_level"]

if frame.args["tp_cost"] ~= "" then tp_costs = mw.text.split(frame.args["tp_cost"], ";", true) end

params = {} for i = 1, 6 do       if frame.args["param"..i] ~= "" then params[i] = { frame.args["param"..i], frame.args["param"..i.."_type"], mw.text.split(frame.args["param"..i.."_value"], ";", true) }       end end

out_table = mw.html.create("table") :addClass("wikitable"):css("width", math.max(80 / (10 / max_lv), 40) .. "%") :tag("tr") :tag("th"):attr("colspan", max_lv + 1):wikitext(frame.args["skill_name"]):done :done :tag("td"):attr("colspan", max_lv + 1):wikitext(frame.args["skill_desc"]):done :done:tag("tr") :tag("th"):css("width", "20%"):wikitext("Level"):done

for i = 1, max_lv do       out_table:tag("th"):css("width", (80 / max_lv) .."%"):wikitext(i):done end

if tp_costs ~= nil then local tr = out_table:tag("tr") :tag("th"):wikitext("TP Cost"):done for i = 1, max_lv do           tr:tag("td"):css("text-align", "center"):wikitext(tp_costs[i]):done end tr:done end

for i = 1, #params do       local tr = out_table:tag("tr") :tag("th"):wikitext(params[i][1]):done

for j = 1, max_lv do           tr:tag("td"):css("text-align", "center"):wikitext(params[i][3][j] .. params[i][2]):done end

tr:done end

return out_table:done end

return p