• 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"

From Kancolle Wiki
Jump to navigation Jump to search
com>Fujihita
(Define module for testing purposes)
 
com>Fujihita
(Add constructor for self-invocation)
Line 14: Line 14:
 
end
 
end
 
   
 
   
function EnemyShipCard:BattleCard(args)
+
function EnemyShipCard:create_ship(args)
 +
return EnemyShip(args.name, args.model)
 +
end
 +
 +
function EnemyShipCard(frame)
 +
local args = getArgs{frame = frame:getParent()}
 
local ship = self:create_ship(args)
 
local ship = self:create_ship(args)
 
return self:battle_card(ship, args)
 
return self:battle_card(ship, args)
end
 
 
function EnemyShipCard:create_ship(args)
 
return EnemyShip(args.name, args.model)
 
 
end
 
end
 
   
 
   
 
return EnemyShipCard
 
return EnemyShipCard

Revision as of 09:01, 15 April 2015

Documentation for this module may be created at Module:EnemyShipCard/doc

local EnemyShip = require('Module:EnemyShip')
local Formatting = require('Module:Formatting')
 
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 = args.link, caption = args.caption}
end
 
function EnemyShipCard:create_ship(args)
	return EnemyShip(args.name, args.model)
end
 
function EnemyShipCard(frame)
	local args = getArgs{frame = frame:getParent()}
	local ship = self:create_ship(args)
	return self:battle_card(ship, args)
end
 
return EnemyShipCard