• 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 13: Line 13:  
!style="background-color:#3baef5;color:white;width:15%"|乙<br>Medium
 
!style="background-color:#3baef5;color:white;width:15%"|乙<br>Medium
 
!style="background-color:#3baef5;color:white;width:15%"|甲<br>Hard]],
 
!style="background-color:#3baef5;color:white;width:15%"|甲<br>Hard]],
all = [[|-
+
all = [=[|-
 
!colspan="5" style="background-color:white"|All
 
!colspan="5" style="background-color:white"|All
 
|-
 
|-
|colspan="5" style="text-align:center"|%s]],
+
|colspan="5" style="text-align:center;font-size:12px;line-height:12px"|%s<br>[[%s]]]=],
 
row = [=[|-
 
row = [=[|-
 
|style="text-align:center;background-color:#eef2f7;font-size:12px;line-height:12px"|%s<br>[[%s]]
 
|style="text-align:center;background-color:#eef2f7;font-size:12px;line-height:12px"|%s<br>[[%s]]
Line 36: Line 36:  
local tbl = {}
 
local tbl = {}
 
local types = {}
 
local types = {}
 +
-- TODO: assuming 0-1 ship rewards on all difficulties
 +
local ship = false
 
local assetTypes = { item = 'Item Icon', equipment = 'Equipment Card', ship = 'Ship Banner' }
 
local assetTypes = { item = 'Item Icon', equipment = 'Equipment Card', ship = 'Ship Banner' }
 
local assetSizes = { item = '75px', equipment = '75px', ship = '240px' }
 
local assetSizes = { item = '75px', equipment = '75px', ship = '240px' }
 
local function setData(diff)
 
local function setData(diff)
 
for _, v in ipairs(data[diff] or {}) do
 
for _, v in ipairs(data[diff] or {}) do
local name = v.item or v.equipment or v.ship or '??'
  −
if not U.ifind(index, name) then table.insert(index, name) end
   
types[name] = v.item and 'item' or v.equipment and 'equipment' or v.ship and 'ship' or '??'
 
types[name] = v.item and 'item' or v.equipment and 'equipment' or v.ship and 'ship' or '??'
tbl[name] = tbl[name] or {}
+
if v.ship then
tbl[name][diff] = { count = v.count or 1, level = v.level }
+
ship = v.ship
 +
else
 +
local name = v.item or v.equipment
 +
if not U.ifind(index, name) then table.insert(index, name) end
 +
tbl[name] = tbl[name] or {}
 +
tbl[name][diff] = { count = v.count or 1, level = v.level }
 +
end
 
end
 
end
 
end
 
end
Line 56: Line 62:  
local function getCell(name, diff)
 
local function getCell(name, diff)
 
return getCount(name, diff) .. getLevel(name, diff)
 
return getCount(name, diff) .. getLevel(name, diff)
 +
end
 +
local function getAsset(name)
 +
local typ = types[name]
 +
return string.format("[[File:%s %s.png|%s|link=%s]]", assetTypes[typ] or '??', name, assetSizes[typ] or '??', name)
 
end
 
end
 
setData('Hard')
 
setData('Hard')
Line 61: Line 71:  
setData('Easy')
 
setData('Easy')
 
setData('Casual')
 
setData('Casual')
 +
if ship then
 +
table.insert(result, string.format(template.all, getAsset(name), name))
 +
end
 
for _, name in ipairs(index) do
 
for _, name in ipairs(index) do
local typ = types[name]
+
table.insert(result, string.format(template.row, getAsset(name), name, getCell(name, 'Casual'), getCell(name, 'Easy'), getCell(name, 'Medium'), getCell(name, 'Hard')))
local asset = string.format("[[File:%s %s.png|%s|link=%s]]", assetTypes[typ] or '??', name, assetSizes[typ] or '??', name)
  −
table.insert(result, string.format(template.row, asset, name, getCell(name, 'Casual'), getCell(name, 'Easy'), getCell(name, 'Medium'), getCell(name, 'Hard')))
   
end
 
end
 
table.insert(result, template.footer)
 
table.insert(result, template.footer)
cssedit, gkautomate
7,064

edits

Navigation menu