本模块仅用于{{FGO_数据总表}},可用来生成适用于Fate/Grand Order整个游戏的游戏数据表格。
-- Originally designed and coded by Maya (U:MJH) local FGOData = require('Module:FGOData') local generateClassTitles = function (title) local retstr = '! style="min-width:100px" |' .. title for i = 1, #(FGOData.classKeys) do retstr = retstr .. '!! style="' .. FGOData.getFromDefaultedTable(FGOData.classTextStyle, FGOData.classKeys[i]) .. 'min-width:100px;" |' .. FGOData.getClassTitle(FGOData.classKeys[i]) end return retstr end local generateClassTable = function (tbl, stylelookup, name, formatter) local retstr = [[<div style="max-width:100%;overflow:auto"> {| class="wikitable" style="text-align:center;font-weight:bold;background:#FFF" |- ]] .. generateClassTitles('职阶') retstr = retstr .. [[ |- ! style="height:2em" |]] .. name for i = 1, #(FGOData.classKeys) do classVal = FGOData.getFromDefaultedTable(tbl, FGOData.classKeys[i]) if i == 1 then retstr = retstr .. [[ |]] else retstr = retstr .. '||' end retstr = retstr .. stylelookup(classVal) .. formatter(classVal) end retstr = retstr .. [[ |} </div>]] return retstr end local FGOTables = { classMultTable = function () local retstr = [[<div style="max-width:100%;overflow:auto"> {| class="wikitable" style="text-align:center;font-weight:bold;background:#FFF" |- ! colspan="]] .. (#(FGOData.classKeys) + 1) .. [[" | 职阶克制关系 |- ]] .. generateClassTitles([[攻击\防御]]) for i = 1, #(FGOData.classKeys) do retstr = retstr .. [[ |- ! style="]] .. FGOData.getFromDefaultedTable(FGOData.classTextStyle, FGOData.classKeys[i]) .. '" |' .. FGOData.getClassTitle(FGOData.classKeys[i]) for j = 1, #(FGOData.classKeys) do local classMult = FGOData.getFromDefaultedTable2d(FGOData.classMultFromTo, FGOData.classKeys[i], FGOData.classKeys[j]) if j == 1 then retstr = retstr .. [[ |]] else retstr = retstr .. '||' end retstr = retstr .. FGOData.getClassMultStyle(classMult) .. string.format('%.1f', classMult) end end retstr = retstr .. [[ |} </div>]] return retstr end, hiddenAlignMultTable = function () local retstr = [[<div style="max-width:100%;overflow:auto"> {| class="wikitable" style="text-align:center;font-weight:bold;background:#FFF;line-height:2em" |- ! colspan="]] .. (#(FGOData.hiddenAlignNamesChinese) + 1) .. [[" | 隐藏属性克制关系 |- ! style="min-width:80px" | 攻击\防御]] for i = 1, #(FGOData.hiddenAlignNamesChinese) do retstr = retstr .. '!! style="min-width:50px" |' .. FGOData.hiddenAlignNamesChinese[i] end for i = 1, #(FGOData.hiddenAlignNamesChinese) do retstr = retstr .. [[ |- ! ]] .. FGOData.hiddenAlignNamesChinese[i] for j = 1, #(FGOData.hiddenAlignNamesChinese) do local alignMult = FGOData.getFromDefaultedTable2d(FGOData.hiddenAlignMultFromTo, i, j) if j == 1 then retstr = retstr .. [[ |]] else retstr = retstr .. '||' end retstr = retstr .. FGOData.getHiddenAlignMultStyle(alignMult) .. string.format('%.1f', alignMult) end end retstr = retstr .. [[ |} </div>]] return retstr end, classAtkCoeffTable = function () return generateClassTable( FGOData.classAtkCoeff, FGOData.getClassAtkCoeffStyle, '伤害系数', function(s) return string.format('%.2f', s) end) end, baseStarDropRateTable = function () return generateClassTable( FGOData.baseStarDropRate, FGOData.getBaseStarDropRateStyle, '暴击星掉落率', function(s) return s .. '%' end) end, baseStarWeightTable = function () return generateClassTable( FGOData.baseStarWeight, FGOData.getBaseStarWeightStyle, '暴击星集中度', function(s) return s end) end, baseInstakillRateTable = function () return generateClassTable( FGOData.baseInstakillRate, FGOData.getBaseInstakillRateStyle, '被即死率', function(s) return s .. '%' end) end } return FGOTables