Line 96: |
Line 96: |
| end | | end |
| -- Air superiority is a bit different so account for it | | -- Air superiority is a bit different so account for it |
− | if headers["Air Superiority"] or headers["Air Parity"] then | + | if headers["Air Superiority"] or headers["Air Supremacy"] then |
| th = mw.html.create("th") | | th = mw.html.create("th") |
| th:wikitext("Air") | | th:wikitext("Air") |
Line 106: |
Line 106: |
| local firstRow = mw.html.create("tr") | | local firstRow = mw.html.create("tr") |
| local firstCol = mw.html.create("td") | | local firstCol = mw.html.create("td") |
| + | local nodeName = nodeLetter |
| + | if values["label"] ~= nil then |
| + | nodeName = nodeName .. "<br>" .. values["label"] |
| + | end |
| + | |
| firstCol | | firstCol |
− | :wikitext(nodeLetter) | + | :wikitext(nodeName) |
| :css("text-align","center") | | :css("text-align","center") |
| + | :css("font-weight","bold") |
| :attr("rowspan",tostring(getRowSize(values))) | | :attr("rowspan",tostring(getRowSize(values))) |
| if nodeLetter == bossNode then | | if nodeLetter == bossNode then |
Line 134: |
Line 140: |
| end | | end |
| end | | end |
− | if values[1]["Air Superiority"] ~= "" or values[1]["Air Parity"] ~= "" then | + | if values[1]["Air Superiority"] ~= "" or values[1]["Air Supremacy"] ~= "" then |
| td = mw.html.create("td") | | td = mw.html.create("td") |
| td:css("font-weight","bold") | | td:css("font-weight","bold") |
| td:css("text-align","center") | | td:css("text-align","center") |
− | if values[1]["Air Parity"] ~= "" then | + | if values[i]["Air Superiority"] ~= "" then |
| td | | td |
| :wikitext("AS") | | :wikitext("AS") |
| :wikitext("<br>") | | :wikitext("<br>") |
− | :wikitext(values[1]["Air Parity"]) | + | :wikitext(values[i]["Air Superiority"]) |
− | elseif values[1]["Air Superiority"] ~= "" then | + | end |
− | if values[1]["Air Parity"] ~= "" then td:wikitext("<br><br>") end | + | if values[i]["Air Supremacy"] ~= "" then |
| + | if values[i]["Air Superiority"] ~= "" then td:wikitext("<br>") end |
| td | | td |
| :wikitext("AS+") | | :wikitext("AS+") |
| :wikitext("<br>") | | :wikitext("<br>") |
− | :wikitext(values[1]["Air Superiority"]) | + | :wikitext(values[i]["Air Supremacy"]) |
| end | | end |
| firstRow:node(td) | | firstRow:node(td) |
Line 183: |
Line 190: |
| end | | end |
| end | | end |
− | if values[i]["Air Superiority"] ~= "" or values[i]["Air Parity"] ~= "" then | + | if values[i]["Air Superiority"] ~= "" or values[i]["Air Supremacy"] ~= "" then |
| td = mw.html.create("td") | | td = mw.html.create("td") |
| td:css("font-weight","bold") | | td:css("font-weight","bold") |
| td:css("text-align","center") | | td:css("text-align","center") |
− | if values[i]["Air Parity"] ~= "" then | + | if values[i]["Air Superiority"] ~= "" then |
| td | | td |
| :wikitext("AS") | | :wikitext("AS") |
| :wikitext("<br>") | | :wikitext("<br>") |
− | :wikitext(values[i]["Air Parity"]) | + | :wikitext(values[i]["Air Superiority"]) |
− | elseif values[i]["Air Superiority"] ~= "" then | + | end |
− | if values[i]["Air Parity"] ~= "" then td:wikitext("<br><br>") end | + | if values[i]["Air Supremacy"] ~= "" then |
| + | if values[i]["Air Superiority"] ~= "" then td:wikitext("<br>") end |
| td | | td |
| :wikitext("AS+") | | :wikitext("AS+") |
| :wikitext("<br>") | | :wikitext("<br>") |
− | :wikitext(values[i]["Air Superiority"]) | + | :wikitext(values[i]["Air Supremacy"]) |
| end | | end |
| row:node(td) | | row:node(td) |
Line 216: |
Line 224: |
| local bossNode = "" | | local bossNode = "" |
| local mapEncounterTable = {} | | local mapEncounterTable = {} |
− | -- get list of params that are used, eg maybe none of the nodes have air_parity info. | + | -- get list of params that are used, eg maybe none of the nodes have air_supremacy info. |
| -- In that case, don't bother adding column for it in the final html table | | -- In that case, don't bother adding column for it in the final html table |
| local usedParams = {["Xp"] = false, | | local usedParams = {["Xp"] = false, |
Line 222: |
Line 230: |
| ["Node Info"] = false, | | ["Node Info"] = false, |
| ["Form"] = false, | | ["Form"] = false, |
− | ["Air Parity"] = false, | + | ["Air Supremacy"] = false, |
| ["Air Superiority"] =false} | | ["Air Superiority"] =false} |
| local validNodeLetters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} | | local validNodeLetters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} |
Line 228: |
Line 236: |
| for k,v in pairs(frame.args) do | | for k,v in pairs(frame.args) do |
| for i,letter in pairs(validNodeLetters) do | | for i,letter in pairs(validNodeLetters) do |
− | if valid(letter,mw.text.split(mw.text.split(k,"_")[1],"")) then | + | local split = mw.text.split(k,"_") |
| + | if valid(letter,mw.text.split(string.upper(split[1]),"")) then |
| mapEncounterTable[letter] = {} | | mapEncounterTable[letter] = {} |
| if letter>bossNode then | | if letter>bossNode then |
Line 239: |
Line 248: |
| bossNode = frame.args["boss"] | | bossNode = frame.args["boss"] |
| end | | end |
| + | |
| | | |
| -- mapping node information to | | -- mapping node information to |
Line 246: |
Line 256: |
| for letter,_ in pairs(mapEncounterTable) do | | for letter,_ in pairs(mapEncounterTable) do |
| -- if letter is equal to the first letter in nodePattern, | | -- if letter is equal to the first letter in nodePattern, |
− | if letter == mw.text.split(nodePattern,"")[1] then | + | if letter == mw.text.split(string.upper(nodePattern),"")[1] then |
| if mw.text.split(nodePattern,"")[2] ~= "_" then | | if mw.text.split(nodePattern,"")[2] ~= "_" then |
| local patternNum = mw.text.split(mw.text.split(nodePattern,"_")[1],"")[2] | | local patternNum = mw.text.split(mw.text.split(nodePattern,"_")[1],"")[2] |
| + | |
| -- If the second char is not a number, invalid. | | -- If the second char is not a number, invalid. |
| if tonumber(patternNum) == nil then return "<span style='color:red'>Please check your module invocation arguments. Something is invalid</span>" end | | if tonumber(patternNum) == nil then return "<span style='color:red'>Please check your module invocation arguments. Something is invalid</span>" end |
Line 272: |
Line 283: |
| ["Node Info"] = "", | | ["Node Info"] = "", |
| ["Form"] = "", | | ["Form"] = "", |
− | ["Air Parity"] = "", | + | ["Air Supremacy"] = "", |
| ["Air Superiority"] = ""} | | ["Air Superiority"] = ""} |
| mapEncounterTable[letter][patternNum] = nodePatternInfo | | mapEncounterTable[letter][patternNum] = nodePatternInfo |
Line 278: |
Line 289: |
| mapEncounterTable[letter][patternNum][paramName] = patternInfo | | mapEncounterTable[letter][patternNum][paramName] = patternInfo |
| usedParams[paramName] = true | | usedParams[paramName] = true |
| + | end |
| + | local split = mw.text.split(nodePattern,"_") |
| + | if split[2] == "label" then |
| + | local letter = string.upper(mw.text.split(split[1],"")[1]) |
| + | mapEncounterTable[letter]["label"] = patternInfo |
| end | | end |
| end | | end |
Line 292: |
Line 308: |
| local nodeInfoImageTable = { | | local nodeInfoImageTable = { |
| ["fuel"] = '[[File:Fuel.png|Fuel|25px]]', | | ["fuel"] = '[[File:Fuel.png|Fuel|25px]]', |
− | ["ammo"] = '[[File:Ammo.png|Ammo|25px]]', | + | ["ammo"] = '[[File:Ammunition.png|Ammo|25px]]', |
| ["steel"] = '[[File:Steel.png|Steel|25px]]', | | ["steel"] = '[[File:Steel.png|Steel|25px]]', |
| ["bauxite"] = '[[File:Bauxite.png|Bauxite|25px]]' | | ["bauxite"] = '[[File:Bauxite.png|Bauxite|25px]]' |
Line 369: |
Line 385: |
| } | | } |
| if str ~= nil then | | if str ~= nil then |
− | for word,replacement in pairs(nodeInfoImageTable) do | + | |
− | str = str:gsub(word,replacement)
| + | local originalString = str |
− | end
| + | str = string.lower(str) |
| + | |
| for vesselName,wikicode in pairs(enemyShipTable) do | | for vesselName,wikicode in pairs(enemyShipTable) do |
| str = str:gsub(vesselName,wikicode) | | str = str:gsub(vesselName,wikicode) |
− | end
| |
− | for form,wikicode in pairs(formTable) do
| |
− | str = str:gsub(form,wikicode)
| |
| end | | end |
| local i = 0 | | local i = 0 |
Line 391: |
Line 405: |
| if count == 3 then | | if count == 3 then |
| str = str:sub(0,i) .. "<br>" .. str:sub(i+1,#str) | | str = str:sub(0,i) .. "<br>" .. str:sub(i+1,#str) |
| + | end |
| + | if count == 0 or string.find(string.lower(str),"maelstrom") ~= nil then |
| + | str = originalString |
| + | end |
| + | for word,replacement in pairs(nodeInfoImageTable) do |
| + | str = str:gsub(word,replacement) |
| + | end |
| + | for form,wikicode in pairs(formTable) do |
| + | str = str:gsub(form,wikicode) |
| end | | end |
| return str | | return str |