Line 16: |
Line 16: |
| local i = s:id() or s:true_id() | | local i = s:id() or s:true_id() |
| local is = i and (i < 10 and '00' .. i or i < 100 and '0' .. i or i) or '?' | | local is = i and (i < 10 and '00' .. i or i < 100 and '0' .. i or i) or '?' |
− | return '[[File:KanMusu' .. is .. 'Banner.png]]<br>[[' .. s:base_name() .. '|' .. s:name() .. ']]' | + | return '[[File:KanMusu' .. is .. 'Banner.png|160px|link=' .. s:base_name() .. ']]<br>[[' .. s:base_name() .. '|' .. s:name() .. ']]' |
| end | | end |
| | | |
| local function getEquipmentCard(eq) | | local function getEquipmentCard(eq) |
− | return '[[File:Equipment' .. (Equipment(eq):id() or '?') .. '-1.png|150px|link=' .. eq .. ']]' | + | return '[[File:Equipment' .. (Equipment(eq):id() or '?') .. '-1.png|100px|link=' .. eq .. ']]' |
| end | | end |
| | | |
Line 44: |
Line 44: |
| ]=] | | ]=] |
| | | |
− | -- [[Category:Todo]]: need something better here
| + | local fleetNames = require('Module:Fleet/Names') |
− | local friendTypes = require('Module:Fleets/Names') | + | |
− | | + | local function getFleetName(fleet, event) |
− | local function getFleetType(fleet, event) | + | local names = fleetNames[event] or {} |
− | local names = friendTypes[event] or {} | |
| if names[1] then | | if names[1] then |
− | for i, o in ipairs(names) do | + | for _, f in ipairs(names) do |
− | for i, ship in ipairs(o.ships) do | + | for i, ship in ipairs(f.ships) do |
− | if _.ifindBy(fleet, function (e) return _.startsWith(e.ship, ship) end) then | + | for j, e in ipairs(fleet) do |
− | return o.name
| + | if f.flagship then |
| + | if i == 1 and j == 1 and string.sub(e.ship, 1, string.len(ship)) == ship then |
| + | return f.name |
| + | end |
| + | else |
| + | if string.sub(e.ship, 1, string.len(ship)) == ship then |
| + | return f.name |
| + | end |
| + | end |
| end | | end |
| end | | end |
Line 59: |
Line 66: |
| else | | else |
| for name, ships in pairs(names) do | | for name, ships in pairs(names) do |
− | for i, ship in ipairs(ships) do | + | for _, ship in ipairs(ships) do |
− | if _.ifindBy(fleet, function (e) return _.startsWith(e.ship, ship) end) then | + | for _, e in ipairs(fleet) do |
− | return name
| + | if string.sub(e.ship, 1, string.len(ship)) == ship then |
| + | return name |
| + | end |
| end | | end |
| end | | end |
Line 86: |
Line 95: |
| for i, e in pairs(data) do | | for i, e in pairs(data) do |
| if not args.map or _.ifind(e.maps, args.map) then | | if not args.map or _.ifind(e.maps, args.map) then |
− | local fleetType = getFleetType(e.fleet, args.friend) | + | local fleetType = getFleetName(e.fleet, args.friend) |
| groups[fleetType] = groups[fleetType] or {} | | groups[fleetType] = groups[fleetType] or {} |
| table.insert(groups[fleetType], e) | | table.insert(groups[fleetType], e) |