Line 1: |
Line 1: |
| + | -- [[Category:Net modules]] |
| + | |
| local p = {} | | local p = {} |
| local remiLib = require("Module:RemiLib") | | local remiLib = require("Module:RemiLib") |
Line 8: |
Line 10: |
| | | |
| -- checks if data is in the array as a key | | -- checks if data is in the array as a key |
| + | |
| + | function getLetterNum(x) |
| + | x = tostring(x) |
| + | local ab = mw.text.split(x, "-") |
| + | return ab[2] and ab[1] or x:sub(1, 1), ab[2] and ab[2]:sub(1, 1) or x:sub(2, 2) |
| + | end |
| + | |
| function valid(data, array) | | function valid(data, array) |
| local valid = {} | | local valid = {} |
Line 140: |
Line 149: |
| end | | end |
| encounterTable:node(headerRow) | | encounterTable:node(headerRow) |
− | local letterOrder = {"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 letterOrder = {"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","Z1", "Z2", "Z3", "Z4", "Z5", "Z6", "Z7", "Z8", "Z9", "ZZ1", "ZZ2", "ZZ3"} |
| for _,nodeLetter in pairs(letterOrder) do | | for _,nodeLetter in pairs(letterOrder) do |
| local values = info[nodeLetter] | | local values = info[nodeLetter] |
Line 329: |
Line 338: |
| ["X"]=true, | | ["X"]=true, |
| ["Y"]=true, | | ["Y"]=true, |
− | ["Z"]=true} | + | ["Z"]=true, |
| + | ["Z1"]=true, |
| + | ["Z2"]=true, |
| + | ["Z3"]=true, |
| + | ["Z4"]=true, |
| + | ["Z5"]=true, |
| + | ["Z6"]=true, |
| + | ["Z7"]=true, |
| + | ["Z8"]=true, |
| + | ["Z9"]=true, |
| + | ["ZZ1"]=true, |
| + | ["ZZ2"]=true, |
| + | ["ZZ3"]=true} |
| -- map all the nodes we'll be using into mapEncounterTable -> {"A":true,"B"=true} etc | | -- map all the nodes we'll be using into mapEncounterTable -> {"A":true,"B"=true} etc |
| for k,v in pairs(frame.args) do | | for k,v in pairs(frame.args) do |
| if string.lower(k) ~= "boss_node" and string.lower(k) ~= "final_form" and string.lower(k) ~= "post_final_form" then | | if string.lower(k) ~= "boss_node" and string.lower(k) ~= "final_form" and string.lower(k) ~= "post_final_form" then |
− | local letter = mw.text.split(k,"")[1] | + | local letter, num = getLetterNum(k) |
− | local num = mw.text.split(k,"")[2]
| |
| if validNodeLetters[letter] and tonumber(num) ~= nil then | | if validNodeLetters[letter] and tonumber(num) ~= nil then |
| mapEncounterTable[letter] = {} | | mapEncounterTable[letter] = {} |
Line 360: |
Line 380: |
| -- nodePattern should be like A1_xp, B3_lv, C1_form or something | | -- nodePattern should be like A1_xp, B3_lv, C1_form or something |
| for nodePattern,patternInfo in pairs(frame.args) do | | for nodePattern,patternInfo in pairs(frame.args) do |
− | local letter = mw.text.split(nodePattern,"")[1] | + | local letter, patternNum = getLetterNum(nodePattern) |
| + | |
| if mapEncounterTable[letter] ~= nil and nodePattern ~= "final_form" and nodePattern ~= "post_final_form" then | | if mapEncounterTable[letter] ~= nil and nodePattern ~= "final_form" and nodePattern ~= "post_final_form" then |
| if mw.text.split(nodePattern,"")[2] ~= "_" then | | if mw.text.split(nodePattern,"")[2] ~= "_" then |
Line 573: |
Line 594: |
| ["battleship_princess[%s$]"] = '[[File:Seikan557Banner.png|2|160px|Battleship Princess|link=Battleship Princess]]', | | ["battleship_princess[%s$]"] = '[[File:Seikan557Banner.png|2|160px|Battleship Princess|link=Battleship Princess]]', |
| ["harbor_princess[%s$]"] = '[[File:Seikan573Banner.png|2|160px|Harbor Princess|link=Harbor Princess]]', | | ["harbor_princess[%s$]"] = '[[File:Seikan573Banner.png|2|160px|Harbor Princess|link=Harbor Princess]]', |
− | ["harbor_princess_4%-5_final_form[%s$]"] = '[[File:Seikan613Banner.png|2|160px|Harbor Princess Final Form|link=Harbor Princess]]', | + | ["harbor_princess_damaged[%s$]"] = '[[File:Seikan613Banner.png|2|160px|Harbor Princess Final Form|link=Harbor Princess]]', |
| ["isolated_island_demon[%s$]"] = '[[File:Seikan574Banner.png|2|160px|Isolated Island Demon|link=Isolated Island Demon]]', | | ["isolated_island_demon[%s$]"] = '[[File:Seikan574Banner.png|2|160px|Isolated Island Demon|link=Isolated Island Demon]]', |
| ["isolated_island_princess[%s$]"] = '[[File:Seikan668Banner.png|2|160px|Isolated Island Princess|link=Isolated Island Princess]]', | | ["isolated_island_princess[%s$]"] = '[[File:Seikan668Banner.png|2|160px|Isolated Island Princess|link=Isolated Island Princess]]', |
Line 626: |
Line 647: |
| ["new_submarine_princess_b[%s$]"] = '[[File:Seikan1737Banner.png|2|160px|New Submarine Princess Flagship (B)|link=New Submarine Princess]]', | | ["new_submarine_princess_b[%s$]"] = '[[File:Seikan1737Banner.png|2|160px|New Submarine Princess Flagship (B)|link=New Submarine Princess]]', |
| ["new_submarine_princess_c[%s$]"] = '[[File:Seikan1738Banner.png|2|160px|New Submarine Princess Flagship (C)|link=New Submarine Princess]]', | | ["new_submarine_princess_c[%s$]"] = '[[File:Seikan1738Banner.png|2|160px|New Submarine Princess Flagship (C)|link=New Submarine Princess]]', |
| + | ["new_submarine_princess_d[%s$]"] = '[[File:Seikan1736Banner.png|2|160px|New Submarine Princess Flagship (D)|link=New Submarine Princess]]', |
| ["french_battleship_hime[%s$]"] = '[[File:Seikan1745Banner.png|2|160px|French Battleship Princess|link=French Battleship Princess]]', | | ["french_battleship_hime[%s$]"] = '[[File:Seikan1745Banner.png|2|160px|French Battleship Princess|link=French Battleship Princess]]', |
| ["french_battleship_hime_damaged[%s$]"] = '[[File:Seikan1748Banner.png|2|160px|French Battleship Princess - Damaged|link=French Battleship Princess]]', | | ["french_battleship_hime_damaged[%s$]"] = '[[File:Seikan1748Banner.png|2|160px|French Battleship Princess - Damaged|link=French Battleship Princess]]', |
Line 632: |
Line 654: |
| ["aircraft_carrier_summer_hime[%s$]"] = '[[File:Seikan1752Banner.png|2|160px|Aircraft Carrier Summer Princess|link=Aircraft Carrier Summer Princess]]', | | ["aircraft_carrier_summer_hime[%s$]"] = '[[File:Seikan1752Banner.png|2|160px|Aircraft Carrier Summer Princess|link=Aircraft Carrier Summer Princess]]', |
| ["european_princess[%s$]"] = '[[File:Seikan1755Banner.png|2|160px|European Princess|link=European Princess]]', | | ["european_princess[%s$]"] = '[[File:Seikan1755Banner.png|2|160px|European Princess|link=European Princess]]', |
− | ["european_princess_damaged[%s$]"] = '[[File:Seikan1758Banner.png|2|160px|European Princess - Damaged|link=European Princess]]' | + | ["european_princess_damaged[%s$]"] = '[[File:Seikan1758Banner.png|2|160px|European Princess - Damaged|link=European Princess]]', |
| + | ["night_strait_princesses[%s$]"] = '[[File:Seikan1767Banner.png|2|160px|Night Strait Princesses|link=Night Strait Princesses]]', |
| + | ["night_strait_princesses_damaged[%s$]"] = '[[File:Seikan1770Banner.png|2|160px|Night Strait Princesses - Damaged|link=Night Strait Princesses]]', |
| + | ["entombed_aa_guardian_princess[%s$]"] = '[[File:Seikan1773Banner.png|2|160px|Entombed Anti-Air Guardian Princess|link=Entombed Anti-Air Guardian Princess]]' |
| } | | } |
| | | |
Line 667: |
Line 692: |
| return "Nil was passed instead of a string" | | return "Nil was passed instead of a string" |
| end | | end |
| + | end |
| + | |
| + | function p.test() |
| + | return p.encounterTemplate({ |
| + | args = { |
| + | ["C_label"] = "C_label", |
| + | ["C1_node_info"] = "C1_node_info", |
| + | ["C1_form"] = "C1_form", |
| + | ["C1_xp"] = "C1_xp", |
| + | ["C1_enemy_air_power"] = "123", |
| + | ["C2_node_info"] = "C2_node_info", |
| + | ["C2_form"] = "C2_form", |
| + | ["C2_xp"] = "C2_xp", |
| + | ["C2_enemy_air_power"] = "123", |
| + | ["ZZ3_label"] = "ZZ3-label", |
| + | ["ZZ3-1_node_info"] = "ZZ3-1_node_info", |
| + | ["ZZ3-1_form"] = "ZZ3-1_form", |
| + | ["ZZ3-1_xp"] = "ZZ3-1_xp", |
| + | ["ZZ3-1_enemy_air_power"] = "123", |
| + | ["ZZ3-2_node_info"] = "ZZ3-2_node_info", |
| + | ["ZZ3-2_form"] = "ZZ3-2_form", |
| + | ["ZZ3-2_xp"] = "ZZ3-2_xp", |
| + | ["ZZ3-2_enemy_air_power"] = "123", |
| + | } |
| + | }) |
| end | | end |
| | | |
| return p | | return p |