- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:EnemyShipCard"
Jump to navigation
Jump to search
com>Fujihita (Add constructor for self-invocation) |
m (9 revisions imported) |
||
(7 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
local EnemyShip = require('Module:EnemyShip') | local EnemyShip = require('Module:EnemyShip') | ||
local Formatting = require('Module:Formatting') | local Formatting = require('Module:Formatting') | ||
+ | local getArgs = require('Module:GetArgs') | ||
local EnemyShipCard = { | local EnemyShipCard = { | ||
Line 11: | Line 12: | ||
ship = args.ship | ship = args.ship | ||
end | end | ||
− | return Formatting:format_image{ship:battle_card(), size = args.size or self._battle_card_size, link = | + | return Formatting:format_image{ship:battle_card(), size = args.size or self._battle_card_size, link = ship:base_name(), caption = ship:name()} |
end | end | ||
function EnemyShipCard:create_ship(args) | function EnemyShipCard:create_ship(args) | ||
− | return EnemyShip(args | + | return EnemyShip(args[1], args[2]) |
end | end | ||
− | function EnemyShipCard(frame) | + | function EnemyShipCard:BattleCard(args) |
+ | local ship = self:create_ship(args) | ||
+ | return EnemyShipCard:battle_card(ship, args) | ||
+ | end | ||
+ | |||
+ | function EnemyShipCard.getFrame(frame) | ||
local args = getArgs{frame = frame:getParent()} | local args = getArgs{frame = frame:getParent()} | ||
− | + | return EnemyShipCard:BattleCard(args) | |
− | return | ||
end | end | ||
− | + | ||
return EnemyShipCard | return EnemyShipCard |
Latest revision as of 12:31, 12 May 2021
Documentation for this module may be created at Module:EnemyShipCard/doc
local EnemyShip = require('Module:EnemyShip')
local Formatting = require('Module:Formatting')
local getArgs = require('Module:GetArgs')
local EnemyShipCard = {
_battle_card_size = "160x40px",
}
function EnemyShipCard:battle_card(ship, args)
if not args then
args = ship
ship = args.ship
end
return Formatting:format_image{ship:battle_card(), size = args.size or self._battle_card_size, link = ship:base_name(), caption = ship:name()}
end
function EnemyShipCard:create_ship(args)
return EnemyShip(args[1], args[2])
end
function EnemyShipCard:BattleCard(args)
local ship = self:create_ship(args)
return EnemyShipCard:battle_card(ship, args)
end
function EnemyShipCard.getFrame(frame)
local args = getArgs{frame = frame:getParent()}
return EnemyShipCard:BattleCard(args)
end
return EnemyShipCard