| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。  | 
「モジュール:Utility/ImageWithName」の版間の差分
		
		
		
		
		
		ナビゲーションに移動
		検索に移動
		
				
		
		
	
 (ページの作成:「local p = {} local cfg = mw.loadData('Module:Utility/ImageWithName/configuration')  local function buildClasses(opts) 	local classes 	if type(opts.classes) == 'string' th…」)  | 
				 (戦術アビリティのリソース取得に対応)  | 
				||
| 23行目: | 23行目: | ||
local nu = require('Module:Utility/Name')  | local nu = require('Module:Utility/Name')  | ||
function   | local function getSimpleResource(key, id, opts, imagefunc, namefunc)  | ||
	opts      = opts      or { lang = 'ja' }  | 	opts      = opts      or { lang = 'ja' }  | ||
	opts.lang = opts.lang or 'ja'  | 	opts.lang = opts.lang or 'ja'  | ||
	local classes = buildClasses(opts)  | 	local classes = buildClasses(opts)  | ||
	local   | 	local name = namefunc(id, lang)  | ||
	local cfg2 = cfg[opts.lang][key]  | |||
	local params = {  | |||
		imagefunc(id) -- 画像  | |||
	}  | |||
	-- リンク  | |||
	if cfg2.hasLink then  | |||
		table.insert(params, name)  | |||
	end  | |||
	-- クラス用ID  | |||
	if cfg2.hasId then  | |||
		table.insert(params, id)  | |||
	end  | |||
	-- 追加クラス  | |||
	table.insert(params, classes)  | |||
	-- 表示名  | |||
	table.insert(params, name)  | |||
	return string.format(cfg2.format, unpack(params))  | |||
end  | |||
function p.ammo(id, opts)  | |||
	return getSimpleResource('ammo', id, opts, iu.ammo, nu.ammo)  | |||
end  | |||
function p.tactical(id, opts)  | |||
	return getSimpleResource('tactical', id, opts, iu.tactical, nu.tactical)  | |||
end  | end  | ||
2021年3月28日 (日) 10:42時点における版
このモジュールについての説明文ページを モジュール:Utility/ImageWithName/doc に作成できます
local p = {}
local cfg = mw.loadData('Module:Utility/ImageWithName/configuration')
local function buildClasses(opts)
	local classes
	if type(opts.classes) == 'string' then
		if opts.desktopOnly then
			classes = ' ' .. opts.classes .. ' text-desktoponly'
		else
			classes = ' ' .. opts.classes
		end
	else
		if opts.desktopOnly then
			classes = ' text-desktoponly'
		else
			classes = ''
		end
	end
	return classes
end
local iu = require('Module:Utility/Image')
local nu = require('Module:Utility/Name')
local function getSimpleResource(key, id, opts, imagefunc, namefunc)
	opts      = opts      or { lang = 'ja' }
	opts.lang = opts.lang or 'ja'
	
	local classes = buildClasses(opts)
	local name = namefunc(id, lang)
	local cfg2 = cfg[opts.lang][key]
	local params = {
		imagefunc(id) -- 画像
	}
	
	-- リンク
	if cfg2.hasLink then
		table.insert(params, name)
	end
	
	-- クラス用ID
	if cfg2.hasId then
		table.insert(params, id)
	end
	
	-- 追加クラス
	table.insert(params, classes)
	
	-- 表示名
	table.insert(params, name)
	
	return string.format(cfg2.format, unpack(params))
end
function p.ammo(id, opts)
	return getSimpleResource('ammo', id, opts, iu.ammo, nu.ammo)
end
function p.tactical(id, opts)
	return getSimpleResource('tactical', id, opts, iu.tactical, nu.tactical)
end
local function getLevelResource(level, opts, namefunc)
	level     = level     or 0
	opts      = opts      or { lang = 'ja' }
	opts.lang = opts.lang or 'ja'
	if level == 0 and opts.useShortLabel then
		return cfg[lang].level.none
	end
	
	if level > 5 then
		level = 5
	end
	
	local classes = buildClasses(opts)
	if level == 0 and classes == '' then
		return string.format(
			cfg[opts.lang].level.none_format,
			iu.attachment(namefunc('ja'), level),
			namefunc(opts.lang))
	end
	
	return string.format(
		cfg[opts.lang].level.format[1 + level],
		iu.attachment(namefunc('ja'), level),
		classes,
		namefunc(opts.lang))
end
function p.extmag(id, level, opts)
	return getLevelResource(level, opts, function(lang)
		return nu.extmag(id, lang)
	end)
end
function p.bolt(level, opts)
	return getLevelResource(level, opts, function(lang)
		return nu.bolt(lang)
	end)
end
return p