• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 4: Line 4:  
-- TODO: Get stats from Module:Data/Ship instead of relying on Module:ELiteShipsKai to retrieve from Module:Data/Ships/<ShipName>
 
-- TODO: Get stats from Module:Data/Ship instead of relying on Module:ELiteShipsKai to retrieve from Module:Data/Ships/<ShipName>
 
-- TODO: Automate coloring without Module:EliteShipsKai
 
-- TODO: Automate coloring without Module:EliteShipsKai
 +
-- TODO: Handle equipment
    
local ListOfSortable = {}
 
local ListOfSortable = {}
Line 15: Line 16:  
}
 
}
   −
local function GenerateTable(shipClass, remodelSuffix, notes, coloring, ...)
+
local function GenerateTable(equipmentOrShip, itemType, remodelSuffix, notes, coloring, ...)
local shipClass = shipClass or frame.args[1] or "??"
+
local success,data
local success, data = U.loadData("Data/Ship")
+
if equipmentOrShip == 'Equipment' then
if not success then return "No data for ships: " .. shipClass end
+
success, data = U.loadData("Data/Equipment")
 +
elseif equipmentOrShip == "Ship" then
 +
success, data = U.loadData("Data/Ship")
 +
else
 +
return "Invalid equipOrShip value: " .. equipOrShip
 +
end
 +
if not success then return "No data for ships: " .. itemType end
 
 
 
local result = string.format(template.header)
 
local result = string.format(template.header)
Line 30: Line 37:  
 
 
for k, v in pairs(data) do
 
for k, v in pairs(data) do
if v.type == shipClass and v.remodellv ~= '' then
+
if v.type == itemType and v.remodellv ~= '' then
 
local name = v.name[3]
 
local name = v.name[3]
 
local success = 0
 
local success = 0
Line 55: Line 62:     
function ListOfSortable.ParseAndGenerate(frame)
 
function ListOfSortable.ParseAndGenerate(frame)
local shipClass = {}
+
local equipmentOrShip = {}
if frame.args['shipClass']   ~= nil then shipClass = frame.args['shipClass'] end
+
if frame.args['equipmentOrShip'] ~= nil then equipmentOrShip = frame.args['equipmentOrShip'] end
 +
local itemType = {}
 +
if frame.args['itemType']     ~= nil then itemType        = frame.args['itemType'] end
 
local remodelSuffix = {}
 
local remodelSuffix = {}
if frame.args['remodelSuffix'] ~= nil then remodelSuffix = U.split(frame.args['remodelSuffix'], ',') end
+
if frame.args['remodelSuffix']   ~= nil then remodelSuffix   = U.split(frame.args['remodelSuffix'], ',') end
 
local notes = {}
 
local notes = {}
if frame.args['notes']   ~= nil then notes = U.split(frame.args['notes'], ',\n') end
+
if frame.args['notes']     ~= nil then notes     = U.split(frame.args['notes'], ',\n') end
 
local coloring = {}
 
local coloring = {}
if frame.args['coloring']   ~= nil then coloring = U.split(frame.args['coloring'], ',\n') end
+
if frame.args['coloring']     ~= nil then coloring     = U.split(frame.args['coloring'], ',\n') end
 
 
return GenerateTable(shipClass, remodelSuffix, notes, coloring)
+
return GenerateTable(equipmentOrShip, itemType, remodelSuffix, notes, coloring)
 
end
 
end
   Line 107: Line 116:  
-- "ammo_operator = <",
 
-- "ammo_operator = <",
 
-- "reference_type = 2"}))
 
-- "reference_type = 2"}))
 +
 +
local frame = {}
 +
frame.args = {}
 +
frame.args['equipmentOrShip'] = "Equipment"
 +
frame.args['itemType'] = "Small Caliber Main Gun"
 +
frame.args['itemType'] = "Destroyer"
 +
frame.args['remodelSuffix'] = ""
 +
frame.args['notes'] = ""
 +
frame.args['coloring'] = ""
 +
mw.log(ListOfSortable.ParseAndGenerate(frame))
 
 
 
local frame = {}
 
local frame = {}
 
frame.args = {}
 
frame.args = {}
frame.args['shipClass'] = "Destroyer"
+
frame.args['equipmentOrShip'] = "Ship"
 +
frame.args['itemType'] = "Destroyer"
 
frame.args['remodelSuffix'] = "B Kai,D Kai,Mk.II,Zwei,Kai"
 
frame.args['remodelSuffix'] = "B Kai,D Kai,Mk.II,Zwei,Kai"
 
frame.args['notes'] = "Mikazuki/Kai_notes = Can equip [[Daihatsu Landing Craft|Daihatsu]],\nMutsuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]],\nKisaragi/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]],\nSatsuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]] & [[Special Type 2 Amphibious Landing Craft|Type 2 Landing Craft]],\nFumizuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]] & [[Special Type 2 Amphibious Landing Craft|Type 2 Landing Craft]]"
 
frame.args['notes'] = "Mikazuki/Kai_notes = Can equip [[Daihatsu Landing Craft|Daihatsu]],\nMutsuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]],\nKisaragi/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]],\nSatsuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]] & [[Special Type 2 Amphibious Landing Craft|Type 2 Landing Craft]],\nFumizuki/Kai Ni_notes = 2nd remodel. Can equip [[Daihatsu Landing Craft|Daihatsu]] & [[Special Type 2 Amphibious Landing Craft|Type 2 Landing Craft]]"
Line 117: Line 137:  
end
 
end
   −
--return { render = render, test = test } --swap comments to test
+
return { render = render, test = test } --swap comments to test
return ListOfSortable
+
--return ListOfSortable
    
-- TEST: p.test()
 
-- TEST: p.test()
1,031

edits

Navigation menu