| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
モジュール:Utility/ImageWithName
ナビゲーションに移動
検索に移動
このモジュールについての説明文ページを モジュール: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, rarityfunc)
opts = opts or { lang = 'ja' }
opts.lang = opts.lang or 'ja'
local classes = buildClasses(opts)
local name = namefunc(id, opts.lang)
local cfg2 = cfg[opts.lang][key]
local rarity = opts.rarity or rarityfunc and rarityfunc(id)
local params = {
imagefunc(id, { rarity = rarity }) -- 画像
}
-- リンク
if cfg2.hasLink then
table.insert(params, name)
end
-- レアリティー
if cfg2.hasRarity then
table.insert(params, rarity)
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.hopup(id, opts)
local rarityFunction = function(id)
return mw.loadData('Module:Stat/Hopup')[id].rarity
end
return getSimpleResource('hopup', id, opts, iu.hopup, nu.hopup, rarityFunction)
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