| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。  | 
「モジュール:Utility/Image」の版間の差分
		
		
		
		
		
		ナビゲーションに移動
		検索に移動
		
				
		
		
	
 (適切に設定がロードされていなかった不具合の修正)  | 
				 (アタッチメントの画像に対応)  | 
				||
| 1行目: | 1行目: | ||
local p = {}  | local p = {}  | ||
local cfg = mw.loadData('Module:Utility/Image/configuration')  | local cfg = mw.loadData('Module:Utility/Image/configuration')  | ||
local aw = require('Module:Utility/Library')  | |||
local function buildClasses(base, params)  | local function buildClasses(base, params)  | ||
| 17行目: | 19行目: | ||
end  | end  | ||
local function   | local function imagecore(cfg2, name, opts)  | ||
	if opts.link and opts.link ~= '' then  | 	if opts.link and opts.link ~= '' then  | ||
		opts.link = string.format(opts.link, name)  | 		opts.link = string.format(opts.link, name)  | ||
| 32行目: | 29行目: | ||
		'[[File:%s|%dpx|link=%s|alt=%s|class=%s]]',  | 		'[[File:%s|%dpx|link=%s|alt=%s|class=%s]]',  | ||
		filename, opts.size, opts.link, name, classtext)  | 		filename, opts.size, opts.link, name, classtext)  | ||
end  | |||
function p.attachment(name, level, opts)  | |||
	local newopts = opts and aw.shallowCopy(opts) or {}  | |||
	newopts.link   = newopts.link   or cfg.attachment.default_link or cfg.default_link  | |||
	newopts.rarity = newopts.rarity or cfg.attachment.levels[math.min(5, level)]  | |||
	newopts.size   = newopts.size   or cfg.attachment.default_size or cfg.default_size  | |||
	return imagecore(cfg.attachment, name, newopts)  | |||
end  | |||
local function image(cfg2, name, opts)  | |||
	opts = opts and aw.shallowCopy(opts) or {}  | |||
	opts.link   = opts.link   or cfg2.items[name].default_link   or cfg2.default_link   or cfg.default_link  | |||
	opts.rarity = opts.rarity or cfg2.items[name].default_rarity or cfg2.default_rarity or cfg.default_rarity  | |||
	opts.size   = opts.size   or cfg2.items[name].default_size   or cfg2.default_size   or cfg.default_size  | |||
	return imagecore(cfg2, name, opts)  | |||
end  | end  | ||
2021年2月19日 (金) 10:46時点における版
このモジュールについての説明文ページを モジュール:Utility/Image/doc に作成できます
local p = {}
local cfg = mw.loadData('Module:Utility/Image/configuration')
local aw = require('Module:Utility/Library')
local function buildClasses(base, params)
	local classes = {}
	for _, value in ipairs({ 'body', 'rarity', 'size' }) do
		local baseClassName = base[value]
		local param = params[value]
		if param ~= nil then
			local classname = string.format(baseClassName, param)
			table.insert(classes, classname)
		else
			table.insert(classes, baseClassName)
		end
	end
	return table.concat(classes, ' ')
end
local function imagecore(cfg2, name, opts)
	if opts.link and opts.link ~= '' then
		opts.link = string.format(opts.link, name)
	end
	
	local filename  = string.format(cfg2.filename, name)
	local classtext = buildClasses(cfg.classes, opts)
	return string.format(
		'[[File:%s|%dpx|link=%s|alt=%s|class=%s]]',
		filename, opts.size, opts.link, name, classtext)
end
function p.attachment(name, level, opts)
	local newopts = opts and aw.shallowCopy(opts) or {}
	newopts.link   = newopts.link   or cfg.attachment.default_link or cfg.default_link
	newopts.rarity = newopts.rarity or cfg.attachment.levels[math.min(5, level)]
	newopts.size   = newopts.size   or cfg.attachment.default_size or cfg.default_size
	return imagecore(cfg.attachment, name, newopts)
end
local function image(cfg2, name, opts)
	opts = opts and aw.shallowCopy(opts) or {}
	opts.link   = opts.link   or cfg2.items[name].default_link   or cfg2.default_link   or cfg.default_link
	opts.rarity = opts.rarity or cfg2.items[name].default_rarity or cfg2.default_rarity or cfg.default_rarity
	opts.size   = opts.size   or cfg2.items[name].default_size   or cfg2.default_size   or cfg.default_size
	return imagecore(cfg2, name, opts)
end
function p.hopup(name, opts)
	return image(cfg.hopup, name, opts)
end
function p.item(name, opts)
	return image(cfg.item, name, opts)
end
function p.scope(name, opts)
	return image(cfg.scope, name, opts)
end
return p