• 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 1: Line 1:  
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
 +
 +
local format = require("Module:StringInterpolation").format
    
local ShipCardKai = {
 
local ShipCardKai = {
 
_card_size = "218x300px",
 
_card_size = "218x300px",
 
_battle_card_size = "160x40px",
 
_battle_card_size = "160x40px",
 +
_battle_card_layers = {
 +
takoyaki = {image = "Hell plane 2.png", top = "5px", left = "50px", size = "30x30px"},
 +
flagship = {image = "Flagship battle card icon.png", top = "5px", left = "137px"},
 +
},
 +
_battle_card_wrapper = [[<div style="position: relative; width: 160px; height: 40px;">${layers}</div>]],
 +
_battle_card_layer = [[<div style="position: absolute;">${image}</div>]],
 +
_image_layer = [[<div style="position: absolute; top: ${top}; left: ${left};">${image}</div>]],
 
}
 
}
   Line 25: Line 34:  
ship = args.ship
 
ship = args.ship
 
end
 
end
return Formatting:format_image{ship:battle_card(), size = args.size or self._battle_card_size, link = args.link, caption = args.caption}
+
local image = Formatting:format_image{ship:battle_card(), size = args.size or self._battle_card_size, link = args.link, caption = args.caption}
 +
local ship_layers = ship:battle_card_layers()
 +
if ship_layers or args.flagship then
 +
local layers = {format{self._battle_card_layer, image = image}}
 +
if ship_layers then
 +
for _, layer in ipairs(ship_layers) do
 +
self:_add_layer(layers, self._battle_card_layers[layer])
 +
end
 +
end
 +
if args.flagship then
 +
self:_add_layer(layers, self._battle_card_layers.flagship)
 +
end
 +
image = format{self._battle_card_wrapper, layers = table.concat(layers)}
 +
end
 +
return image
 +
end
 +
 
 +
function ShipCardKai:_add_layer(layers, layer)
 +
table.insert(layers, format{self._image_layer, image = Formatting:format_image{layer.image, caption = layer.caption, size = layer.size}, top = layer.top, left = layer.left})
 
end
 
end
  
Anonymous user

Navigation menu