🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:Utility/Image」の版間の差分
ナビゲーションに移動
検索に移動
(バックパックのファイル名指定の際の最小レベル設定を間違っていた問題の修正) |
(弾薬のaltの言語切り替えに対応) |
||
53行目: | 53行目: | ||
function p.ammo(id, opts) | function p.ammo(id, opts) | ||
local linkname, name | opts = opts or { lang = 'ja' } | ||
opts.lang = opts.lang or 'ja' | |||
local linkname, name, altname | |||
if aw.stringends(id, '_revved_up') then | if aw.stringends(id, '_revved_up') then | ||
local baseid = string.sub(id, 1, string.len(id) - 10) | local baseid = string.sub(id, 1, string.len(id) - 10) | ||
linkname = nu.ammo(baseid) | linkname = nu.ammo(baseid) | ||
name = '連射速度上昇時' .. linkname | name = '連射速度上昇時' .. linkname | ||
altname = '連射速度上昇時' .. nu.ammo(baseid, opts) | |||
elseif aw.stringends(id, '_amped') then | elseif aw.stringends(id, '_amped') then | ||
local baseid = string.sub(id, 1, string.len(id) - 6) | local baseid = string.sub(id, 1, string.len(id) - 6) | ||
linkname = nu.ammo(baseid) | linkname = nu.ammo(baseid) | ||
name = '増幅時' .. linkname | name = '増幅時' .. linkname | ||
altname = '増幅時' .. nu.ammo(baseid, opts) | |||
else | else | ||
linkname = nu.ammo(id) | linkname = nu.ammo(id) | ||
name = linkname | name = linkname | ||
altname = nu.ammo(id, opts) | |||
end | end | ||
local newopts = opts and aw.shallowCopy(opts) or {} | local newopts = opts and aw.shallowCopy(opts) or {} | ||
77行目: | 83行目: | ||
return string.format( | return string.format( | ||
'[[File:%s|x%dpx|link=%s|alt=%s]]', | '[[File:%s|x%dpx|link=%s|alt=%s]]', | ||
filename, newopts.size, newopts.link, | filename, newopts.size, newopts.link, altname) | ||
end | end | ||
2021年8月27日 (金) 11:39時点における版
このモジュールについての説明文ページを モジュール:Utility/Image/doc に作成できます
local p = {} local cfg = mw.loadData('Module:Utility/Image/configuration') local aw = require('Module:Utility/Library') local nu = require('Module:Utility/Name') 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, altname) if opts.link and opts.link ~= '' then opts.link = string.format(opts.link, name) end local filename = opts.filename or string.format(cfg2.filename, name) local classtext = buildClasses(cfg2.classes or cfg.classes, opts) return string.format( '[[File:%s|%dpx|link=%s|alt=%s|class=%s]]', filename, opts.size, opts.link, altname or 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.levels[math.min(5, 1 + level)] newopts.size = newopts.size or cfg.attachment.default_size or cfg.default_size return imagecore(cfg.attachment, name, newopts) end function p.gear(name, level, opts) local newopts = opts and aw.shallowCopy(opts) or {} newopts.link = newopts.link or cfg.gear.default_link or cfg.default_link newopts.rarity = newopts.rarity or cfg.levels[math.min(5, 1 + level)] newopts.size = newopts.size or cfg.gear.default_size or cfg.default_size if name == 'バックパック' then newopts.filename = string.format(cfg.gear.filename_backpack, math.max(1, math.min(level, 3))) end return imagecore(cfg.gear, name, newopts) end function p.ammo(id, opts) opts = opts or { lang = 'ja' } opts.lang = opts.lang or 'ja' local linkname, name, altname if aw.stringends(id, '_revved_up') then local baseid = string.sub(id, 1, string.len(id) - 10) linkname = nu.ammo(baseid) name = '連射速度上昇時' .. linkname altname = '連射速度上昇時' .. nu.ammo(baseid, opts) elseif aw.stringends(id, '_amped') then local baseid = string.sub(id, 1, string.len(id) - 6) linkname = nu.ammo(baseid) name = '増幅時' .. linkname altname = '増幅時' .. nu.ammo(baseid, opts) else linkname = nu.ammo(id) name = linkname altname = nu.ammo(id, opts) end local newopts = opts and aw.shallowCopy(opts) or {} newopts.link = newopts.link or cfg.ammo.default_link or cfg.default_link newopts.size = newopts.size or cfg.ammo.default_size or cfg.default_size if newopts.link and newopts.link ~= '' then newopts.link = string.format(newopts.link, linkname) end local filename = string.format(cfg.ammo.filename, name) return string.format( '[[File:%s|x%dpx|link=%s|alt=%s]]', filename, newopts.size, newopts.link, altname) end local function image(cfg2, name, opts, altname, rarity) opts = opts and aw.shallowCopy(opts) or {} opts.link = opts.link or cfg2.items and cfg2.items[name].default_link or cfg2.default_link or cfg.default_link opts.rarity = opts.rarity or cfg2.items and cfg2.items[name].default_rarity or cfg2.default_rarity or cfg.default_rarity opts.size = opts.size or cfg2.items and cfg2.items[name].default_size or cfg2.default_size or cfg.default_size return imagecore(cfg2, name, opts, altname) end function p.grenade(name, opts) return image(cfg.grenade, name, opts) end function p.hopup(id, opts) opts = opts or {} local name = nu.hopup(id, 'ja') local altname = nu.hopup(id, opts and opts.lang) if not opts.rarity then opts.rarity = mw.loadData('Module:Stat/Hopup')[id].rarity end return image(cfg.hopup, name, opts, altname, rarity) 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 function p.passive(id, opts) local name = nu.passive(id, 'ja') local altname = nu.passive(id, opts and opts.lang) return image(cfg.passive, name, opts, altname) end function p.tactical(id, opts) local name = nu.tactical(id, 'ja') local altname = nu.tactical(id, opts and opts.lang) return image(cfg.tactical, name, opts, altname) end return p