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

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
m (5 revisions imported)
 
(3 intermediate revisions by one other user 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 EquipmentGraphicKai = {}
+
local EquipmentGraphicKai = EquipmentAsset()
  
function EquipmentGraphicKai:create_equip(args)
+
function EquipmentGraphicKai:get_source(equip, args)
return Equipment(args[1])
+
return args.fairy and (args.fairy == "only" and equip:fairy() or equip:cg_fairy()) or (args.flying and equip:cg_flying() or equip:cg())
 
end
 
end
  
function EquipmentGraphicKai:graphic(equip, args, link)
+
function EquipmentGraphicKai:get(equip, args, link)
 
if not args then
 
if not args then
 
args = equip
 
args = equip
 
equip = args.equip
 
equip = args.equip
 +
link = args.link
 
end
 
end
return Formatting:format_image{args.fairy and (args.fairy == "only" and equip:fairy() or equip:cg_fairy()) or equip:cg(), size = args.size, link = link, caption = args.caption}
+
args[1] = self:get_source(equip, args)
end
+
args.link = link
 
+
return Formatting:format_image(args)
function EquipmentGraphicKai:Graphic(args)
 
local equip = self:create_equip(args)
 
if args.link then
 
if args.link == "nil" then
 
return self:graphic(equip, args, nil)
 
elseif args.link == "false" then
 
return self:graphic(equip, args, false)
 
else
 
return self:graphic(equip, args, args.link)
 
end
 
else
 
return self:graphic(equip, args, equip:link())
 
end
 
 
end
 
end
  
 
return EquipmentGraphicKai
 
return EquipmentGraphicKai

Latest revision as of 12:34, 12 May 2021

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

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

local EquipmentGraphicKai = EquipmentAsset()

function EquipmentGraphicKai:get_source(equip, args)
	return args.fairy and (args.fairy == "only" and equip:fairy() or equip:cg_fairy()) or (args.flying and equip:cg_flying() or equip:cg())
end

function EquipmentGraphicKai:get(equip, args, link)
	if not args then
		args = equip
		equip = args.equip
		link = args.link
	end
	args[1] = self:get_source(equip, args)
	args.link = link
	return Formatting:format_image(args)
end

return EquipmentGraphicKai