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

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
(Re-apply reverted edit with fix)
m (11 revisions imported)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local Equipment = require('Module:Equipment')
+
local EquipmentAsset = require('Module:EquipmentAsset')
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
  
local EquipmentCardKai = {}
+
local EquipmentCardKai = EquipmentAsset()
  
function EquipmentCardKai:card(equip, args, link)
+
function EquipmentCardKai:get_source(equip, as_item)
 +
return equip:card(as_item)
 +
end
 +
 
 +
function EquipmentCardKai:get(equip, args, link)
 
if not args then
 
if not args then
 
args = equip
 
args = equip
 
equip = args.equipment or args.equip
 
equip = args.equipment or args.equip
 +
link = args.link
 
end
 
end
return Formatting:format_image{equip:card(), size = args.size, link = link, caption = args.caption}
+
if args.icon then
end
+
        args[1] = equip:icon(args.item)
 
+
    else
function EquipmentCardKai:Card(args)
+
        args[1] = self:get_source(equip, args.item)
local equip = self:create_equip(args)
+
    end
if args.link then
+
args.link = link
if args.link == "nil" then
+
return Formatting:format_image(args)
return self:card(equip, args, nil)
 
elseif args.link == "false" then
 
return self:card(equip, args, false)
 
else
 
return self:card(equip, args, args.link)
 
end
 
else
 
return self:card(equip, args, equip:link())
 
end
 
end
 
 
 
function EquipmentCardKai:create_equip(args)
 
return Equipment(args[1])
 
 
end
 
end
  
 
return EquipmentCardKai
 
return EquipmentCardKai

Latest revision as of 12:29, 12 May 2021

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

local EquipmentAsset = require('Module:EquipmentAsset')
local Formatting = require('Module:Formatting')

local EquipmentCardKai = EquipmentAsset()

function EquipmentCardKai:get_source(equip, as_item)
	return equip:card(as_item)
end

function EquipmentCardKai:get(equip, args, link)
	if not args then
		args = equip
		equip = args.equipment or args.equip
		link = args.link
	end
	if args.icon then
        args[1] = equip:icon(args.item)
    else
        args[1] = self:get_source(equip, args.item)
    end
	args.link = link
	return Formatting:format_image(args)
end

return EquipmentCardKai