本模塊用來生成明日方舟關卡的介紹表格。
由於模板包裝({{Aklevelinfo}})已經實裝,本文檔不再更新。如果本模塊的用法發生了變化,該包裝模板的文檔會繼續更新。
本模塊採用了一種特定的描述字符串來方便地簡寫大量重複模板引用。模塊中已經提前定義了模板頭名字和一些特定參數;每一個模板實例應當用全角分號(;
)或半角分號(;
)分開;每一個模板的參數應當用頓號(、
)或斜槓(/
)分開。兩種符號可以混用。
例如,在主線2-1「敵人」一行,原本描述敵人需要這樣的 wikitext:
{{Akenicon|源石蟲·α|B2|size=90|unit=px}}{{Akenicon|獵狗|O1|size=90|unit=px}}{{Akenicon|士兵|01|size=90|unit=px}}{{Akenicon|重裝防禦者|08|size=90|unit=px}}{{Akenicon|暴徒|17|size=90|unit=px}}{{Akenicon|雞尾酒投擲者|A9|size=90|unit=px}}{{Akenicon|機動盾兵|19|size=90|unit=px}}
在模塊中,使用的模板(Akenicon)已經被提前定義,同時還為每一個模板自動賦了大小參數(size
);這些內容便可移除。再將參數分隔符(管道符,|
)替換成頓號或斜槓(此處用頓號)、每個模板實例之間用分號隔開(此處用全角),得到以下描述字符串:
源石蟲·α、B2;獵狗、O1;士兵、01;重裝防禦者、08;暴徒、17;雞尾酒投擲者、A9;機動盾兵、19
只要給模塊提供這個字符串就可以了。
因為技術原因,此語法不允許描述字符串以實例分隔符(即任意類型的分號)結尾:這種時候,解析器會以為最後一個模板引用是空引用(無參數)。敬請注意。
本模塊只有一個外部函數:主函數(main
)。
主函數沒有固定的參數數量。以下列出所有可能的參數。參數別名可以混用(中文和英文參數名可以交叉),但是若多個別名被同時使用,靠前的別名更優先。
參數 | 說明 | 類型 | 默認值 | |
---|---|---|---|---|
表格 ID | id |
整個表格的HTML ID。同時可以作為跳轉錨點。 | 選填 | 參數「關卡代碼」的值 |
表格 class | class |
整個表格的CSS class。 | 選填 | 無 |
關卡代碼 | level-code 關卡代碼 代碼 |
本關卡的代碼(如1-1 、DM-6 等)。若本參數為空則不會生成表格標題。 |
建議 | 無 |
關卡名稱 | level 關卡 |
本關卡的名稱。若本參數為空則不會生成表格標題。 | 建議 | 無 |
開放時間 | time 開放時間 時間 |
本關卡開放的時間,用於限時開啟的活動關卡。時間格式應滿足#time的格式,包含年、月、日、時、分。使用模板描述字符串:將開始和結束時間視為一對模板參數;如果因復刻有多個開啟時間,視每對開啟時間為一個模板。 | 選填 | 無 |
關卡消耗 | cost 消耗 |
進行本關卡需要消耗的資源。如果消耗理智,可以直接填入數字;否則,使用模板描述字符串:模板為{{Akmat}},已賦大小參數。 | 選填 | 0
|
部署上限 | max-dep 部署上限 |
本關卡的幹員部署上限。應當是一個數字。 | 建議 | 無 |
固定編隊 | preset 固定編隊 編隊 |
本關卡的固定編隊,用於陣容不可替換的關卡。使用模板描述字符串:模板為{{Akcharinfo}},已賦大小參數。 | 選填 | 無 |
自動部署幹員 | autodeploy 自動部署 |
本關卡的自動部署幹員,用於有由系統自動部署或者提前部署之幹員的關卡。使用模板描述字符串:模板為{{Akcharinfo}},已賦大小參數。 | 選填 | 無 |
推薦平均等級 | rec-lvl 推薦等級 |
本關卡的推薦平均等級。應當是諸如「LV.15」、「精英1 LV.30」這樣的字符串。 | 選填 | 無 |
敵方情報 | enemy 敵人 |
本關卡的敵方情報。使用模板描述字符串:模板為{{Akenicon}},已賦大小參數。 | 建議 | 無 |
特殊機制 | sp-mech 特殊機制 |
本關卡的特殊機制(諸如障礙物、地雷等我方召喚物,弩箭等敵方召喚物,和其他地圖特性)。應當是字符串;建議用如同<障礙物> (效果如<障礙物> )的方法標識機制名稱,並且在不同機制間用<br /> 換行。 |
選填 | 無 |
附加信息 | add-info 附加信息 |
本關卡的附加信息。如果本關卡有一些特殊的細節不便視為「機制」,可以以字符串形式填在這裡。 | 選填 | 無 |
首次掉落 | fd 首次掉落 |
本關卡的首次掉落數據。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 | 建議 | 無 |
常規掉落 | nd 常規掉落 |
本關卡的常規掉落數據。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 | 選填 | 無 |
額外掉落 | ed 額外掉落 |
本關卡的額外掉落數據。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 | 選填 | 無 |
特殊掉落 | sd 特殊掉落 |
本關卡的特殊掉落數據。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 | 選填 | 無 |
特殊掉落𝑛 | sd 𝑛 特殊掉落 𝑛 |
本關卡的特殊掉落數據,𝑛 ⩾ 2;參數名如同sd2 、特殊掉落4 等。用於復刻活動的特殊掉落數據不同的關卡;𝑛代表第幾次開放。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 |
選填 | 無 |
突襲附加條件 | hard-limit 突襲附加條件 突襲限制 |
本關卡的突襲附加條件。應當是字符串。 | 選填 | 無 |
突襲解鎖條件 | hard-unlock 突襲解鎖條件 突襲解鎖 |
本關卡的突襲解鎖條件。應當是字符串。 | 選填 | 無 |
突襲首次掉落 | hfd 突襲首次掉落 突襲掉落 |
本關卡的突襲首次掉落。使用模板描述字符串:模板為{{Akitem}},已賦大小參數。 | 選填 | 無 |
無敵人圖鑑 | no-enemy-data 無敵人圖鑑 無敵人資料 |
用於不能查看敵人圖鑑的關卡。為本參數賦值true 、t 、yes 、y 、是 (全部忽略大小寫)的時候,模塊會忽略「敵方情報」參數,並強制顯示「當前關卡無法查看敵人圖鑑」;其他賦值全部無效果。 |
選填 | 無 |
任何參數都可以省略或者留空;此時除非該參數有默認值,否則其在表格中對應的那一行(若有)就會被省略。
{{#invoke:Aklevelinfo|main |id= |class= |level= |level-code= |time= |cost= |max-dep= |rec-lvl= |enemy= |sp-mech= |add-info= |fd= |nd= |ed= |sd= |hard-limit= |hard-unlock= |hfd= }}
或
{{#invoke:Aklevelinfo|main |id= |class= |關卡= |關卡代碼= |開放時間= |消耗= |部署上限= |推薦等級= |特殊機制= |附加信息= |敵人= |首次掉落= |常規掉落= |額外掉落= |特殊掉落= |突襲附加條件= |突襲解鎖條件= |突襲首次掉落= }}
{{#invoke:Aklevelinfo|main |class=mw-collapsible mw-collapsed |level=火山製造 |level-code=OF-1 |time=201908271600/201909100359;202008111600/202008200359;202108091600/202108180359 |cost=8 |max-dep=8 |rec-lvl=LV.15 |enemy=源石蟲、B1;源石蟲·β、B3;酸液源石蟲、B4 |fd=fur、薩卡茲搖滾海報、dt=首次掉落;mat、至純源石、dt=三星獲得 |nd=mat、至純源石、dt=三星獲得 |ed=mat、至純源石、dt=三星獲得 |sd=mat、汐斯塔的黑曜石、num=8;mat、黑曜石節門票、num=2 |sd2=mat、汐斯塔的黑曜石、num=10;mat、黑曜石節門票、num=2 |sd3=mat、汐斯塔的黑曜石、num=8;mat、黑曜石節門票、num=2 |hard-limit=禁止部署近戰幹員 |hfd=mat、至純源石、dt=三星獲得、num=2 }}
會輸出
OF-1 火山製造 | |||
---|---|---|---|
開放 | 【首次】 2019/08/27 16:00 至 2019/09/10 03:59 | 【復刻】 2020/08/11 16:00 至 2020/08/20 03:59 | 【復刻】 2021/08/09 16:00 至 2021/08/18 03:59 |
消耗 | |||
部署 | 8人 | ||
推薦平 | LV.15 | ||
敵方 | |||
首次 | ![]() ![]() | ||
常規 | |||
特殊 | |||
額外 (小機率掉落) | |||
突襲附 | 禁止部署近戰幹員 | ||
突襲首 | |||
磨難險地 | 禁止部署近戰幹員 | ||
磨難險地 | |||
磨難險地 |
{{#invoke:Aklevelinfo|main |class=mw-collapsible mw-collapsed |關卡=水上滑梯 |代碼=OF-F1 |time= |消耗=黑曜石節門票、num=6 |部署上限=8 |推薦等級=LV.15 |自動部署=安德切爾、0、攻擊力強化·α型、1、20、0、false |固定編隊=安潔莉娜、2、秘杖·反重力模式、9、20、0、false;史都華德、0、強力擊·α型、1、20、0、false;傑西卡、0、強力擊·β型、1、20、0、false;芬、0、衝鋒號令·α型、1、20、0、false; 翎羽、0、迅捷打擊·α型、1、20、0、false;炎熔、0、戰術詠唱·α型、1、20、0、false; 黑角、0、、0、20、0、false |敵人=源石蟲、B1;源石蟲·β、B3;酸液源石蟲、B4 |首次掉落=fur、薩卡茲搖滾海報、dt=首次掉落;mat、至純源石、dt=三星獲得 |常規掉落=mat、至純源石、dt=三星獲得 |額外掉落=mat、至純源石、dt=三星獲得 |特殊掉落=mat、汐斯塔的黑曜石、num=8;mat、黑曜石節門票、num=2 |突襲附加條件=禁止部署近戰幹員 |突襲掉落=mat、至純源石、dt=三星獲得、num=2 }}
會輸出
OF-F1 水上滑梯 | |
---|---|
消耗 | |
部署 | 8人 |
自動部 | |
固定 | |
推薦平 | LV.15 |
敵方 | |
首次 | ![]() ![]() |
常規 | |
特殊 | |
額外 (小機率掉落) | |
突襲附 | 禁止部署近戰幹員 |
突襲首 |
-- This is to automate level description table generation for Arknights. -- Crappy code originally by U:公的驅逐艦 (One-Six) of Moegirlpedia. -- Gotta praise the Crocc. local getArgs = require('Module:Arguments').getArgs local Akcharinfo = require('Module:Akcharinfo')._main local p = {} -- F: is string empty? local function isEmpty( s ) return (s == nil or s == '') end -- F: get arguments, alias-aware. Aliases towards the front of the array have priority. local function getArgFromAlias ( args, argsAliasArray ) for i = 1, table.getn(argsAliasArray) do if ( args[argsAliasArray[i]] ~= nil ) then return args[argsAliasArray[i]] end end return nil end -- F: generate raw wikitext of repeated template calls from parameter array local function repeatedTempWT ( tempName, paraArray ) local outputStr = "" for i = 1, #paraArray do outputStr = outputStr.."{{"..tempName for j = 1, #paraArray[i] do outputStr = outputStr.."|"..paraArray[i][j] end outputStr = outputStr.."}}" end return outputStr end -- F: generate repeated module calls from parameter array local function repeatedModuleWT ( frame, moduleFunc, paraArray ) outputStr = "" for i = 1, #paraArray do outputStr = outputStr .. moduleFunc ( frame, paraArray[i] ) end return outputStr end -- F: generate parameter array from string; insert a common string for each instance local function parseArray ( s, ins, forModule ) -- When input string is entirely empty, return empty array. if ( isEmpty(s) ) then return {} end -- if common string is empty, make damn sure it's empty, not nil if ( isEmpty(ins) ) then ins = '' end if ( forModule ~= true ) then forModule = false end local parsedArray = {} -- \239\188\155 是UTF-8全角分號(";") for temp in (s:gsub("\239\188\155",";"):gsub("[;]?%s*$",";") ):gmatch("([^%;]*)%;%s*") do local tempArray = {} -- \227\128\129 是UTF-8頓號("、") for w in ( temp:gsub("\227\128\129","/"):gsub("[/]?%s*$","/")..ins):gmatch("([^%/]*)%/%s*") do if forModule and (string.match( w, "^[^=]*=.*$" )) then tempArray[ string.match( w, "^([^=]*)=" ) ] = string.match( w, "^[^=]*=(.*)$" ) else table.insert(tempArray, w) end end table.insert(parsedArray, tempArray) end return parsedArray end -- WIP. TODO: check for total cell width, autocollapse nonexistant cells to the left local function buildDropCells ( frame, args, datas, argsNameArray, timeArraySize ) local returnString = '<th'..(datas.thStyle and (' style='..datas.thStyle) or '')..'>'..datas.head..'</th><td>' local ri1 = getArgFromAlias( args, argsNameArray ) if timeArraySize <= 1 then returnString = isEmpty(ri1) and '' or ( returnString .. frame:preprocess( repeatedTempWT( datas.template, parseArray(ri1, datas.ins) ) ) .. '</td>' ) else local dataArray = { { ri1 } } for i = 1, timeArraySize do end end return returnString end -- make standard th cell local function thCell ( colspan, str1, str2, style ) return '<th ' .. ( colspan > 1 and ( 'colspan' .. colspan ) or '' ) .. 'style="min-width:'..( (#str1/9) + 0.2 )..'em;' .. ( style or '' ) .. '"><span style="white-space:nowrap;">' .. str1.. '</span>' .. ( str2 and ( '<wbr /><span style="white-space:nowrap;">' .. str2.. '</span>' ) or '' ) .. '</th>' end -- main: generate and output the level description table. -- Support arbitrary numbers of event reruns, but we will eventually run out of screen space; may need a outer scrollable shell. function p.main ( frame ) local args = getArgs(frame, { wrappers = { 'Template:Aklevelinfo', 'Template:沙盒' } }) return p._main ( frame, args ) end function p._main ( frame, args ) -- build access time row first, as it impact styling of the rest of the table (colspan count). local timeArray = parseArray( getArgFromAlias( args, { "time", "開放時間", "時間" } )) local timeStr = '<tr>' .. thCell( 1, '開放', '時間' ) -- td head for trivial rows. local defaultMainCell = "<td>" -- if time array is empty (check by if first instance exist), do not generate time array. if ( timeArray[1] == nil ) then timeStr = '' elseif ( #timeArray > 1 ) then -- trivial row colspan. defaultMainCell = "<td colspan="..#timeArray..">" for i = 1, #timeArray do timeStr = timeStr .. '<td><div style="display:grid"><div style="grid-area:1/1/2/2;white-space:nowrap;">' .. ( isEmpty(timeArray[i][3]) and (i == 1 and '【首次】' or '【復刻】') or'【'.. timeArray[i][3]..'】' ) .. '</div><div style="grid-area:1/2/2/3">' .. frame:callParserFunction( "#time:Y/m/d H:i", timeArray[i][1] ) .. '</div><div style="grid-area:2/1/3/2; text-align:center;">至</div><div style="grid-area:2/2/3/3">' .. ( isEmpty(timeArray[i][2]) and '現在' or frame:callParserFunction( "#time:Y/m/d H:i", timeArray[i][2] ) ) .. '</div></div></td>' end timeStr = timeStr .. '</tr>' else timeStr = timeStr .. '<td>' .. frame:callParserFunction( "#time:Y/m/d H:i", timeArray[1][1] ) .. ' 至 ' .. ( isEmpty(timeArray[1][2]) and '現在' or frame:callParserFunction( "#time:Y/m/d H:i", timeArray[1][2] ) ) .. "</td></tr>" end -- Get level code and level name, and build the title. local levelCode = getArgFromAlias( args, { "level-code", "關卡代碼", "代碼" } ) local level =getArgFromAlias( args, { "level", "關卡" } ) local titleStr = isEmpty(level) and '' or ( '<tr><th colspan=' .. ( #timeArray < 1 and '2' or ( #timeArray + 1 ) ) .. '>' .. ( levelCode and ( levelCode .. ' ' ) or '' ) .. level .. "</th></tr>" ) -- keeping level code for id use; keeping #timeArray for some colspan use level = nil local timeArraySize = #timeArray timeArray = nil -- end time and title. -- cost. If empty, say sanity cost 0; elseif number, use as sanity; else parse array and use repeatedTempWT. local costToEnmStr = "" local cost = getArgFromAlias( args, { "cost", "消耗" } ); if ( cost == nil ) then cost = "" end if (isEmpty(cost) ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '消耗', '理智' ) .. defaultMainCell .. frame:expandTemplate{ title = 'Akitem', args = { "mat", "理智", num="0", size="60"} } .. "</td></tr>" elseif ( cost:gsub("%d+","APREDEFINEDSTRING") == "APREDEFINEDSTRING" ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '消耗', '理智' ) .. defaultMainCell .. frame:expandTemplate{ title = 'Akitem', args = { "mat", "理智", num=cost, size="60"} } .. "</td></tr>" else costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '消耗', '' ) .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akmat", parseArray( cost, "size=60/") ) ) .. "</td></tr>" end cost = nil -- up to five trivial rows. -- Team preset, auto-deployment, and enemy row requires repeatedTempWT. local maxDeployment = getArgFromAlias( args, { "max-dep", "部署上限" } ) local presetArray = parseArray( getArgFromAlias( args, { "preset", "固定編隊", "編隊" } ), "size=90/", true ) local recAvgLvl = getArgFromAlias( args, { "rec-lvl", "推薦等級" } ) local autodeployedArray = parseArray( getArgFromAlias( args, { "autodeploy", "自動部署" } ), "size=90/", true ) local noEnemyData = string.lower ( getArgFromAlias( args, { "no-enemy-data", "無敵人圖鑑", "無敵人資料" } ) or '' ) noEnemyData = ( noEnemyData == "true" or noEnemyData == "yes" or noEnemyData == "t" or noEnemyData == "y" or noEnemyData == "是" ) local enemyParaArray = parseArray( getArgFromAlias( args, { "enemy", "敵人" } ), "size=90/" ) if ( not isEmpty(maxDeployment) ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '部署', '上限' ) .. defaultMainCell .. maxDeployment .. "人</td></tr>" end if ( autodeployedArray[1] ~= nil ) then costToEnmStr = costToEnmStr .. '<tr><th style="min-width:3.2em;" title="關卡開始時和/或進行中由系統部署的幹員,通常不可由玩家手動撤退">自動部<wbr />署幹員</th>' .. defaultMainCell .. repeatedModuleWT( frame, Akcharinfo, autodeployedArray ) .. "</td></tr>" end if ( presetArray[1] ~= nil ) then costToEnmStr = costToEnmStr .. '<tr><th style="min-width:2.2em;" title="關卡提供的固定編隊,玩家不可更改">固定<wbr />編隊</th>' .. defaultMainCell .. ( ( presetArray[1][1] == nil and ( presetArray[1] == '空' or string.lower(presetArray[1]) == 'empty' ) ) and '<span style="display:inline-block; margin:1em 0; font-style:italic;">該關卡固定編隊為空且不可更換</span>' or ( repeatedModuleWT( frame, Akcharinfo, presetArray ) ) ) .. "</td></tr>" end if ( not isEmpty(recAvgLvl) ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '推薦平', '均等級' ) .. defaultMainCell .. recAvgLvl .. "</td></tr>" end if ( noEnemyData or enemyParaArray[1] ~= nil ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '敵方', '情報' ) .. defaultMainCell .. ( noEnemydata and '<span style="display:inline-block; margin:1em 0; font-style:italic;">該關卡無法查看敵人圖鑑</span>' or frame:preprocess( repeatedTempWT( "Akenicon", enemyParaArray ) ) ) .. "</td></tr>" end maxDeployment = nil recAvgLvl = nil noEnemyData = nil enemyParaArray = nil -- Additional info, including special mechanism and "additional info" local spMech = getArgFromAlias( args, { "sp-mech", "特殊機制" } ) local addInfo = getArgFromAlias( args, { "add-info", "附加信息" } ) if ( not isEmpty(spMech) ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '特殊', '機制' ) .. defaultMainCell .. spMech .. "</td></tr>" end if ( not isEmpty(addInfo) ) then costToEnmStr = costToEnmStr .. '<tr>' .. thCell( 1, '附加', '信息' ) .. defaultMainCell .. addInfo .. "</td></tr>" end spMech = nil addInfo = nil -- item drops. fd, nd, and ed are trivial and requires repeatedTempWT; sd requires checking. local firstDropParaArray = parseArray( getArgFromAlias( args, { "fd", "首次掉落" } ), "size=60/" ) local normalDropParaArray = parseArray( getArgFromAlias( args, { "nd", "常規掉落" } ), "size=60/" ) local extraDropParaArray = parseArray( getArgFromAlias( args, { "ed", "額外掉落" } ), "size=60/" ) local dropStr = "" if ( firstDropParaArray[1] ~= nil ) then dropStr = dropStr .. '<tr>' .. thCell( 1, '首次', '掉落' ) .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akitem", firstDropParaArray ) ) .. "</td></tr>" end if ( normalDropParaArray[1] ~= nil ) then dropStr = dropStr .. '<tr>' .. thCell( 1, '常規', '掉落' ) .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akitem", normalDropParaArray ) ) .. "</td></tr>" end -- display sd's up to timeArraySize. local sd = getArgFromAlias( args, { "sd", "特殊掉落" } ) if ( timeArraySize > 1 ) then local sdStr = '<tr>' .. thCell( 1, '特殊', '掉落' ) .. '<td>' local sdStrIsEmpty = true if ( not isEmpty(sd) ) then sdStr = sdStr .. frame:preprocess( repeatedTempWT( "Akitem", parseArray(sd, "size=60/") ) ) sdStrIsEmpty = false end sdStr = sdStr .. "</td>" for i = 2, timeArraySize do sdStr = sdStr .. '<td>' local sdi = getArgFromAlias( args, { "sd"..i, "特殊掉落"..i } ) if ( not isEmpty(sdi) ) then sdStr = sdStr .. frame:preprocess( repeatedTempWT( "Akitem", parseArray(sdi, "size=60/") ) ) sdStrIsEmpty = false end sdStr = sdStr .. "</td>" end sdStr = sdStr .. "</tr>" if ( not sdStrIsEmpty ) then dropStr = dropStr .. sdStr end elseif ( not isEmpty(sd) ) then dropStr = dropStr .. '<tr>' .. thCell( 1, '特殊', '掉落' ) .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akitem", parseArray(sd, "size=60/") ) ) .. "</td></tr>" end sd = nil -- extra drop. if ( extraDropParaArray[1] ~= nil ) then dropStr = dropStr .. '<tr><th style="min-width:2.2em;">額外<wbr />掉落<br /><span style="font-size:75%;white-space:nowrap;">(小概率掉落)</span></th>' .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akitem", extraDropParaArray ) ) .. "</td></tr>" end firstDropParaArray = nil normalDropParaArray = nil extraDropParaArray = nil -- easy mode texts. All trivial for now. local easyLimit = getArgFromAlias( args, { "easy-limit", "劇情體驗附加條件", "劇情體驗限制" } ) local easyUnlock = getArgFromAlias( args, { "easy-unlock", "劇情體驗解鎖條件", "劇情體驗解鎖" } ) local easyFirstDropParaArray = parseArray( getArgFromAlias( args, { "劇情體驗", "劇情體驗首次掉落"} ), "size=60/" ) local easyStr = "" if ( not isEmpty(easyLimit) ) then easyStr = easyStr .. '<tr>' .. thCell( 1, '劇情體驗', '附加條件' ) .. defaultMainCell .. easyLimit .. "</td></tr>" end if ( not isEmpty(easyUnlock) ) then easyStr = easyStr .. '<tr>' .. thCell( 1, '劇情體驗', '解鎖條件') .. defaultMainCell .. easyUnlock .. "</td></tr>" end if ( easyFirstDropParaArray[1] ~= nil ) then easyStr = easyStr .. '<tr>' .. thCell( 1, '劇情體驗', '首次掉落' ) .. defaultMainCell .. frame:preprocess( repeatedTempWT( "Akitem", easyFirstDropParaArray ) ) .. "</td></tr>" end -- hard mode texts. All trivial for now. local hardLimit = getArgFromAlias( args, { "hard-limit", "突襲附加條件", "突襲限制" } ) local hardUnlock = getArgFromAlias( args, { "hard-unlock", "突襲解鎖條件", "突襲解鎖" } ) local hardFirstDropParaArray = parseArray( getArgFromAlias( args, { "hfd", "突襲首次掉落", "突襲掉落" } ), "size=60/" ) local hardStr = "" if ( not isEmpty(hardLimit) ) then hardStr = hardStr .. '<tr>' .. thCell( 1, '突襲附', '加條件', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. hardLimit .. "</td></tr>" end if ( not isEmpty(hardUnlock) ) then hardStr = hardStr .. '<tr>' .. thCell( 1, '突襲解', '鎖條件', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. hardUnlock .. "</td></tr>" end if ( hardFirstDropParaArray[1] ~= nil ) then hardStr = hardStr .. '<tr>' .. thCell( 1, '突襲首', '次掉落', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. frame:preprocess( repeatedTempWT( "Akitem", hardFirstDropParaArray ) ) .. "</td></tr>" end -- hard mode in mainline texts. All trivial for now. local hardLimit1 = getArgFromAlias( args, { "hard-limit", "磨難險地附加條件", "磨難險地限制" } ) local hardUnlock1 = getArgFromAlias( args, { "hard-unlock", "磨難險地解鎖條件", "磨難險地解鎖" } ) local hardFirstDropParaArray1 = parseArray( getArgFromAlias( args, { "hfd", "磨難險地首次掉落"} ), "size=60/" ) local hardenemyParaArray = parseArray( getArgFromAlias( args, { "enemy", "磨難險地敵人" } ), "size=90/" ) local hardStr1 = "" if ( not isEmpty(hardLimit1) ) then hardStr1 = hardStr1 .. '<tr>' .. thCell( 1, '磨難險地', '附加條件', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. hardLimit1 .. "</td></tr>" end if ( not isEmpty(hardUnlock1) ) then hardStr1 = hardStr1 .. '<tr>' .. thCell( 1, '磨難險地', '解鎖條件', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. hardUnlock1 .. "</td></tr>" end if ( hardFirstDropParaArray1[1] ~= nil ) then hardStr1 = hardStr1 .. '<tr>' .. thCell( 1, '磨難險地', '首次掉落', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. frame:preprocess( repeatedTempWT( "Akitem", hardFirstDropParaArray1 ) ) .. "</td></tr>" end if ( hardenemyParaArray[1] ~= nil ) then hardStr1 = hardStr1 .. '<tr>' .. thCell( 1, '磨難險地', '敵方情報', 'background-color:#300;color:#f00;' ) .. defaultMainCell:gsub(">$",' style="background-color:#400;color:#fff;">') .. ( frame:preprocess( repeatedTempWT( "Akenicon", hardenemyParaArray ) ) ) .. "</td></tr>" end -- return final table string. get class and id if defined. local tableId = isEmpty(args["id"]) and ( isEmpty(levelCode) and '' or ( '\32id="'..levelCode..'"' ) ) or ( '\32id="'..args["id"]..'"' ) local tableClass = isEmpty(args["class"]) and '' or ( '\32'..args["class"] ) local tableStyle = isEmpty(args["style"]) and '' or ( '\32style="'..args["style"]..'"' ) return '<table'..tableId..' class="wikitable'..tableClass..'"'..tableStyle..'>' .. titleStr .. timeStr .. costToEnmStr .. dropStr .. easyStr .. hardStr .. hardStr1 .. '</table>' end -- F: generated parsed (preprocessed) repeated template calls. May be useful for other processes. function p.repeatedTemp ( frame ) return frame:preprocess( repeatedTempWT( frame.args[1], parseArray(frame.args[2]) ) ) end return p