Line 307: |
Line 307: |
| --finding name of wiki page of ship | | --finding name of wiki page of ship |
| shipname = shipmodule.data[id]["name"][3] | | shipname = shipmodule.data[id]["name"][3] |
− | shipbasename = mw.text.split(shipname, '%s')[1] | + | pagename = shipname |
− | pagename = shipbasename
| + | if string.sub(shipmodule.data[id],1,-2) == "Mist" then -- fleet of fog check |
− | if string.sub(shipbasename,1,-2) == "Mist" then | + | if string.sub(shipmodule.data[id], -1) == '1' then |
− | if string.sub(shipbasename, -1) == '1' then | |
| pagename = 'Iona_(fog)' | | pagename = 'Iona_(fog)' |
− | elseif string.sub(shipbasename, -1) == '2' then | + | elseif string.sub(shipmodule.data[id], -1) == '2' then |
| pagename = 'Takao_(fog)' | | pagename = 'Takao_(fog)' |
− | elseif string.sub(shipbasename, -1) == '3' then | + | elseif string.sub(shipmodule.data[id], -1) == '3' then |
| pagename = 'Haruna_(fog)' | | pagename = 'Haruna_(fog)' |
| else | | else |
| pagename = 'Fleet of Fog' | | pagename = 'Fleet of Fog' |
| end | | end |
| + | else |
| + | shipbasename = mw.text.split(shipname, '%s')[1] |
| + | --Chitose/Chiyoda-Kou check; submarines should be unaffected |
| + | if mw.text.split(shipbasename, '%p')[2] ~= nil and mw.text.split(shipbasename, '%p')[2] == "Kou" then |
| + | shipbasename = mw.text.split(shipbasename, '%p')[1] |
| + | end |
| + | --Prinz/Graf/Teste check (for ship names that are 2 or more words) |
| + | if mw.text.split(shipname, '%s')[2] ~= nil and mw.text.split(shipname, '%s')[2] ~= "Kai" then |
| + | shipbasename = shipbasename .. mw.text.split(shipname, '%s')[2] |
| + | end |
| + | pagename = shipbasename |
| end | | end |
| | | |