🌟現在、鉄壁 鉄壁ヘッドショットには対応済みです。
鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。

「モジュール:WeaponInfobox/Duration」の版間の差分

提供:Apex Data
ナビゲーションに移動 検索に移動
(単一の値を表示する際のズーム時間用の倍率計算が間違っていた問題の修正)
(単一の値を表示するコードをリファクタリング)
375行目: 375行目:


-- Duration for single value
-- Duration for single value
local function renderRow(tbl, name, fmt, num, muls, isSpecial, footer, opts)
local function renderRow(tbl, name, num, cfg, opts)
opts = opts or {}
opts = opts or {}
if isSpecial then
if cfg.isSpecial then
num = num * muls[3]
num = num * cfg.muls[3]
end
end
391行目: 391行目:
:addClass('cell-type-number')
:addClass('cell-type-number')
:attr('align', 'left')
:attr('align', 'left')
:wikitext(string.format(fmt, num))
:wikitext(string.format(cfg.fmt, num))
:done()
:done()
:tag('td')
:tag('td')
:attr('align', 'left')
:attr('align', 'left')
:wikitext(footer)
:wikitext(cfg.unit)
:done()
:done()
return row
return row
408行目: 408行目:
-- Reload
-- Reload
if aw.isNumber(stat.time.reload.tactical) then
if aw.isNumber(stat.time.reload.tactical) then
local reloadConfig = {
fmt  = duration.reload.format,
muls = stock.reload,
unit = duration.reload.unit,
isSpecial = isSpecial,
}
renderRow(
renderRow(
tbl,
tbl,
duration.reload.name,
duration.reload.name,
duration.reload.format,
stat.time.reload.tactical,
stat.time.reload.tactical,
stock.reload,
reloadConfig)
isSpecial,
duration.reload.unit)
if canModdedLoader then
if canModdedLoader then
renderRow(
renderRow(
tbl,
tbl,
iu.passive('modded_loader') .. ' ',
iu.passive('modded_loader') .. ' ',
duration.reload.format,
stat.time.reload.tactical * 0.75,
stat.time.reload.tactical * 0.75,
stock.reload,
reloadConfig,
isSpecial,
duration.reload.unit,
secondOpts)
secondOpts)
end
end
430行目: 430行目:
-- Reload (Empty)
-- Reload (Empty)
if aw.isNumber(stat.time.reload.full) and stat.time.reload.tactical ~= stat.time.reload.full then
if aw.isNumber(stat.time.reload.full) and stat.time.reload.tactical ~= stat.time.reload.full then
local reloademptyConfig = {
fmt  = duration.reloadempty.format,
muls = stock.reload,
unit = duration.reloadempty.unit,
isSpecial = isSpecial,
}
renderRow(
renderRow(
tbl,
tbl,
duration.reloadempty.name,
duration.reloadempty.name,
duration.reloadempty.format,
stat.time.reload.full,
stat.time.reload.full,
stock.reload,
reloademptyConfig)
isSpecial,
duration.reloadempty.unit)
if canModdedLoader then
if canModdedLoader then
renderRow(
renderRow(
tbl,
tbl,
iu.passive('modded_loader') .. ' ',
iu.passive('modded_loader') .. ' ',
duration.reloadempty.format,
stat.time.reload.full * 0.75,
stat.time.reload.full * 0.75,
stock.reload,
reloademptyConfig,
isSpecial,
duration.reloadempty.unit,
secondOpts)
secondOpts)
end
end
454行目: 454行目:
-- Zoom In
-- Zoom In
if aw.isNumber(stat.time.zoom_in) then
if aw.isNumber(stat.time.zoom_in) then
local zoominConfig = {
fmt  = duration.zoomin.format,
muls = stock.zoom,
unit = duration.zoomin.unit,
isSpecial = isSpecial,
}
renderRow(
renderRow(
tbl,
tbl,
duration.zoomin.name,
duration.zoomin.name,
duration.zoomin.format,
stat.time.zoom_in,
stat.time.zoom_in,
stock.zoom,
zoominConfig)
isSpecial,
duration.zoomin.unit)
-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
473行目: 476行目:
tbl,
tbl,
label .. ' ',
label .. ' ',
duration.zoomin.format,
stat.time.hcog_classic.zoom_in,
stat.time.hcog_classic.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
488行目: 488行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_in,
stat.time.hcog_ranged.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
renderRow(
renderRow(
tbl,
tbl,
iu.scope('2~4倍可変式AOG') .. ' ',
iu.scope('2~4倍可変式AOG') .. ' ',
duration.zoomin.format,
stat.time.aog_variable.zoom_in,
stat.time.aog_variable.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
else
else
507行目: 501行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_in,
stat.time.hcog_ranged.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
518行目: 509行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_in,
stat.time.hcog_ranged.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
532行目: 520行目:
tbl,
tbl,
iu.scope('6倍スナイパー') .. ' ',
iu.scope('6倍スナイパー') .. ' ',
duration.zoomin.format,
stat.time.sniper.zoom_in,
stat.time.sniper.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
545行目: 530行目:
tbl,
tbl,
iu.scope('4~8倍可変式スナイパー') .. ' ',
iu.scope('4~8倍可変式スナイパー') .. ' ',
duration.zoomin.format,
stat.time.sniper_variable.zoom_in,
stat.time.sniper_variable.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
558行目: 540行目:
tbl,
tbl,
iu.scope('4~10倍デジタルスレット') .. ' ',
iu.scope('4~10倍デジタルスレット') .. ' ',
duration.zoomin.format,
stat.time.sniper_threat.zoom_in,
stat.time.sniper_threat.zoom_in,
stock.zoom,
zoominConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
569行目: 548行目:
-- Zoom Out
-- Zoom Out
if aw.isNumber(stat.time.zoom_out) then
if aw.isNumber(stat.time.zoom_out) then
local zoomoutConfig = {
fmt  = duration.zoomout.format,
muls = stock.zoom,
unit = duration.zoomout.unit,
isSpecial = isSpecial,
}
renderRow(
renderRow(
tbl,
tbl,
duration.zoomout.name,
duration.zoomout.name,
duration.zoomout.format,
stat.time.zoom_out,
stat.time.zoom_out,
stock.zoom,
zoomoutConfig)
isSpecial,
duration.zoomout.unit)
-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
588行目: 570行目:
tbl,
tbl,
label .. ' ',
label .. ' ',
duration.zoomin.format,
stat.time.hcog_classic.zoom_out,
stat.time.hcog_classic.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
603行目: 582行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_out,
stat.time.hcog_ranged.zoom_out,
stock.zoom,
zoomoutConfigt,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
renderRow(
renderRow(
tbl,
tbl,
iu.scope('2~4倍可変式AOG') .. ' ',
iu.scope('2~4倍可変式AOG') .. ' ',
duration.zoomin.format,
stat.time.aog_variable.zoom_out,
stat.time.aog_variable.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
else
else
622行目: 595行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_out,
stat.time.hcog_ranged.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
633行目: 603行目:
tbl,
tbl,
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
iu.scope('3倍HCOG\'レンジャー\'') .. ' ',
duration.zoomin.format,
stat.time.hcog_ranged.zoom_out,
stat.time.hcog_ranged.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
647行目: 614行目:
tbl,
tbl,
iu.scope('6倍スナイパー') .. ' ',
iu.scope('6倍スナイパー') .. ' ',
duration.zoomin.format,
stat.time.sniper.zoom_out,
stat.time.sniper.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
660行目: 624行目:
tbl,
tbl,
iu.scope('4~8倍可変式スナイパー') .. ' ',
iu.scope('4~8倍可変式スナイパー') .. ' ',
duration.zoomin.format,
stat.time.sniper_variable.zoom_out,
stat.time.sniper_variable.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end
673行目: 634行目:
tbl,
tbl,
iu.scope('4~10倍デジタルスレット') .. ' ',
iu.scope('4~10倍デジタルスレット') .. ' ',
duration.zoomin.format,
stat.time.sniper_threat.zoom_out,
stat.time.sniper_threat.zoom_out,
stock.zoom,
zoomoutConfig,
isSpecial,
duration.zoomin.unit,
secondOpts)
secondOpts)
end
end

2021年8月6日 (金) 13:06時点における版

このモジュールについての説明文ページを モジュール:WeaponInfobox/Duration/doc に作成できます

require('Module:Utility/mw.html Extensions')

local p = {}
local cfg = mw.loadData('Module:WeaponInfobox/configuration')
local attachment = mw.loadData('Module:Stat/Attachment')

local aw = require('Module:Utility/Library')
local iu = require('Module:Utility/Image')
local proto = require('Module:Utility/Prototypes')

-- Constants
local leftBorder = {
	['border-left-width'] = '1px',
	['border-left-style'] = 'solid',
}
local leftBorderWithoutTopRightBorder = {
	['border-top'] = '0 none transparent',
	['border-right'] = '0 none transparent',
	['border-left-width'] = '1px',
	['border-left-style'] = 'solid',
}

-- Protos
local ZoomProto = {
	zoom_in  = proto.NumberRange(0),
	zoom_out = proto.NumberRange(0),
}

-- Duration for multiple value
local function createMultipleRow(tbl, name, default, common, rare, epic, opts)
	opts = opts or {}
	
	local row = tbl:tag('tr')
	
	if aw.isNumberAndGreaterThanZero(opts.offset) then
		for i = 1, opts.offset do
			local hasLeftBorder = opts.offsetStyles and opts.offsetStyles[i] and opts.offsetStyles[i].leftBorder
			if hasLeftBorder then
				row:tag('th')
					:css(leftBorderWithoutTopRightBorder)
					:wikitext(' ')
			else
				row:tag('th')
					:css('border', '0 none transparent')
					:wikitext(' ')
			end
		end
	end
	
	row:tag('th')
		:attrIf(aw.isNumber(opts.colspan), { colspan = opts.colspan })
		:cssIf(aw.isNumberAndGreaterThanZero(opts.offset), leftBorder)
		:wikitext(name)
	
	row
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(default)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:tag('span')
				:addClass('text-rarity')
				:addClass('text-rarity-common')
				:wikitext(common)
				:done()
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:tag('span')
				:addClass('text-rarity')
				:addClass('text-rarity-rare')
				:wikitext(rare)
				:done()
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:tag('span')
				:addClass('text-rarity')
				:addClass('text-rarity-epic')
				:wikitext(epic)
				:done()
			:done()
	
	return row
end

local function renderDurationWithStock(stat, duration, stock, canModdedLoader, isSniper)
	local tbl = mw.html.create('table')
		:addClass('intable')
	
	local rootOpts = { colspan = 2 }
	local secondOpts = { offset = 1 }
	
	-- Header
	local stockName = isSniper and 'スナイパーストック' or '標準ストック'
	tbl:tag('tr')
		:tag('th')
			:attr('colspan', 2)
			:wikitext(name)
			:done()
		:tag('th'):done()
		:tag('th'):wikitext(iu.attachment(stockName, 1)):done()
		:tag('th'):wikitext(iu.attachment(stockName, 2)):done()
		:tag('th'):wikitext(iu.attachment(stockName, 3))
	
	-- Reload
	if aw.isNumber(stat.time.reload.tactical) then
		createMultipleRow(
			tbl,
			duration.reload.name,
			string.format(duration.reload.format, stat.time.reload.tactical),
			string.format(duration.reload.format, stat.time.reload.tactical * stock.reload[1]),
			string.format(duration.reload.format, stat.time.reload.tactical * stock.reload[2]),
			string.format(duration.reload.format, stat.time.reload.tactical * stock.reload[3]),
			rootOpts)
		if canModdedLoader then
			createMultipleRow(
				tbl,
				iu.passive('modded_loader'),
				string.format(duration.reload.format, stat.time.reload.tactical * 0.75),
				string.format(duration.reload.format, stat.time.reload.tactical * 0.75 * stock.reload[1]),
				string.format(duration.reload.format, stat.time.reload.tactical * 0.75 * stock.reload[2]),
				string.format(duration.reload.format, stat.time.reload.tactical * 0.75 * stock.reload[3]),
				secondOpts)
		end
		
		-- Reload (Empty)
		if aw.isNumber(stat.time.reload.full) and stat.time.reload.tactical ~= stat.time.reload.full then
			createMultipleRow(
				tbl,
				duration.reloadempty.name,
				string.format(duration.reloadempty.format, stat.time.reload.full),
				string.format(duration.reloadempty.format, stat.time.reload.full * stock.reload[1]),
				string.format(duration.reloadempty.format, stat.time.reload.full * stock.reload[2]),
				string.format(duration.reloadempty.format, stat.time.reload.full * stock.reload[3]),
				rootOpts)
			if canModdedLoader then
				createMultipleRow(
					tbl,
					iu.passive('modded_loader'),
					string.format(duration.reloadempty.format, stat.time.reload.full * 0.75),
					string.format(duration.reloadempty.format, stat.time.reload.full * 0.75 * stock.reload[1]),
					string.format(duration.reloadempty.format, stat.time.reload.full * 0.75 * stock.reload[2]),
					string.format(duration.reloadempty.format, stat.time.reload.full * 0.75 * stock.reload[3]),
					secondOpts)
			end
		end
	end
	
	-- Zoom In
	if aw.isNumber(stat.time.zoom_in) then
		createMultipleRow(
			tbl,
			duration.zoomin.name,
			string.format(duration.zoomin.format, stat.time.zoom_in),
			string.format(duration.zoomin.format, stat.time.zoom_in * stock.zoom[1]),
			string.format(duration.zoomin.format, stat.time.zoom_in * stock.zoom[2]),
			string.format(duration.zoomin.format, stat.time.zoom_in * stock.zoom[3]),
			rootOpts)
		
		-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
		if proto.validateTypes(stat.time.hcog_classic, ZoomProto) then
			local label
			if proto.validateTypes(stat.time.threat, ZoomProto) then
				label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト') .. iu.scope('1倍デジタルスレット')
			else
				label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. '<br>' .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト')
			end
			
			createMultipleRow(
				tbl,
				label,
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_in),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_in * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_in * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_in * stock.zoom[3]),
				secondOpts)
		end
		
		-- 3x HCOG 'Ranger', 2x-4x Variable AOG
		if proto.validateTypes(stat.time.hcog_ranged, ZoomProto) then
			if proto.validateTypes(stat.time.aog_variable, ZoomProto) then
				if stat.time.hcog_ranged.zoom_in ~= stat.time.aog_variable.zoom_in then
					createMultipleRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\''),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[3]),
						secondOpts)
					createMultipleRow(
						tbl,
						iu.scope('2~4倍可変式AOG'),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_in),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_in * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_in * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_in * stock.zoom[3]),
						secondOpts)
				else
					createMultipleRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG'),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[3]),
						secondOpts)
				end
			else
				createMultipleRow(
					tbl,
					iu.scope('3倍HCOG\'レンジャー\''),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[1]),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[2]),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_in * stock.zoom[3]),
					secondOpts)
			end
		end
		
		-- 6x Sniper Scope
		if proto.validateTypes(stat.time.sniper, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('6倍スナイパー'),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_in),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_in * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_in * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_in * stock.zoom[3]),
				secondOpts)
		end
		
		-- 4x-8x Variable Sniper Scope
		if proto.validateTypes(stat.time.sniper_variable, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('4~8倍可変式スナイパー'),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_in),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_in * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_in * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_in * stock.zoom[3]),
				secondOpts)
		end
		
		-- 4x-10x Digital Sniper Threat
		if proto.validateTypes(stat.time.sniper_threat, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('4~10倍デジタルスレット'),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_in),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_in * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_in * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_in * stock.zoom[3]),
				secondOpts)
		end
	end
	
	-- Zoom Out
	if aw.isNumber(stat.time.zoom_out) then
		createMultipleRow(
			tbl,
			duration.zoomout.name,
			string.format(duration.zoomout.format, stat.time.zoom_out),
			string.format(duration.zoomout.format, stat.time.zoom_out * stock.zoom[1]),
			string.format(duration.zoomout.format, stat.time.zoom_out * stock.zoom[2]),
			string.format(duration.zoomout.format, stat.time.zoom_out * stock.zoom[3]),
			rootOpts)
		
		-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
		if proto.validateTypes(stat.time.hcog_classic, ZoomProto) then
			local label
			if proto.validateTypes(stat.time.threat, ZoomProto) then
				label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト') .. iu.scope('1倍デジタルスレット')
			else
				label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. '<br>' .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト')
			end
			
			createMultipleRow(
				tbl,
				label,
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_out),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_out * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_out * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.hcog_classic.zoom_out * stock.zoom[3]),
				secondOpts)
		end
		
		-- 3x HCOG 'Ranger', 2x-4x Variable AOG
		if proto.validateTypes(stat.time.hcog_ranged, ZoomProto) then
			if proto.validateTypes(stat.time.aog_variable, ZoomProto) then
				if stat.time.hcog_ranged.zoom_out ~= stat.time.aog_variable.zoom_out then
					createMultipleRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\''),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[3]),
						secondOpts)
					createMultipleRow(
						tbl,
						iu.scope('2~4倍可変式AOG'),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_out),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_out * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_out * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.aog_variable.zoom_out * stock.zoom[3]),
						secondOpts)
				else
					createMultipleRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG'),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[1]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[2]),
						string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[3]),
						secondOpts)
				end
			else
				createMultipleRow(
					tbl,
					iu.scope('3倍HCOG\'レンジャー\''),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[1]),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[2]),
					string.format(duration.zoomin.format, stat.time.hcog_ranged.zoom_out * stock.zoom[3]),
					secondOpts)
			end
		end
		
		-- 6x Sniper Scope
		if proto.validateTypes(stat.time.sniper, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('6倍スナイパー'),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_out),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_out * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_out * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper.zoom_out * stock.zoom[3]),
				secondOpts)
		end
		
		-- 4x-8x Variable Sniper Scope
		if proto.validateTypes(stat.time.sniper_variable, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('4~8倍可変式スナイパー'),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_out),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_out * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_out * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper_variable.zoom_out * stock.zoom[3]),
				secondOpts)
		end
		
		-- 4x-10x Digital Sniper Threat
		if proto.validateTypes(stat.time.sniper_threat, ZoomProto) then
			createMultipleRow(
				tbl,
				iu.scope('4~10倍デジタルスレット'),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_out),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_out * stock.zoom[1]),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_out * stock.zoom[2]),
				string.format(duration.zoomin.format, stat.time.sniper_threat.zoom_out * stock.zoom[3]),
				secondOpts)
		end
	end
	
	return tbl
end

-- Duration for single value
local function renderRow(tbl, name, num, cfg, opts)
	opts = opts or {}
	
	if cfg.isSpecial then
		num = num * cfg.muls[3]
	end
	
	local row = tbl:tag('tr')
		:addClassIf(opts.class and type(opts.class) == 'string', opts.class)
		:tag('th')
			:attrIf(opts.headerAlign and type(opts.headerAlign) == 'string', { align = opts.headerAlign })
			:wikitext(name)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'left')
			:wikitext(string.format(cfg.fmt, num))
			:done()
		:tag('td')
			:attr('align', 'left')
			:wikitext(cfg.unit)
			:done()
	return row
end

local function renderDurationWithoutStock(stat, duration, stock, canModdedLoader, isSpecial)
	local secondOpts = { class = 'no-list-style', headerAlign = 'right' }
	local tbl = mw.html.create('table')
		:addClass('condensedtable')
		:addClass('listtable')
	
	-- Reload
	if aw.isNumber(stat.time.reload.tactical) then
		local reloadConfig = {
			fmt  = duration.reload.format,
			muls = stock.reload,
			unit = duration.reload.unit,
			isSpecial = isSpecial,
		}
		renderRow(
			tbl,
			duration.reload.name,
			stat.time.reload.tactical,
			reloadConfig)
		if canModdedLoader then
			renderRow(
				tbl,
				iu.passive('modded_loader') .. '&nbsp;',
				stat.time.reload.tactical * 0.75,
				reloadConfig,
				secondOpts)
		end
		
		-- Reload (Empty)
		if aw.isNumber(stat.time.reload.full) and stat.time.reload.tactical ~= stat.time.reload.full then
			local reloademptyConfig = {
				fmt  = duration.reloadempty.format,
				muls = stock.reload,
				unit = duration.reloadempty.unit,
				isSpecial = isSpecial,
			}
			renderRow(
				tbl,
				duration.reloadempty.name,
				stat.time.reload.full,
				reloademptyConfig)
			if canModdedLoader then
				renderRow(
					tbl,
					iu.passive('modded_loader') .. '&nbsp;',
					stat.time.reload.full * 0.75,
					reloademptyConfig,
					secondOpts)
			end
		end
	end
	
	-- Zoom In
	if aw.isNumber(stat.time.zoom_in) then
		local zoominConfig = {
			fmt  = duration.zoomin.format,
			muls = stock.zoom,
			unit = duration.zoomin.unit,
			isSpecial = isSpecial,
		}
		renderRow(
			tbl,
			duration.zoomin.name,
			stat.time.zoom_in,
			zoominConfig)
		
		-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
		if proto.validateTypes(stat.time.hcog_classic, ZoomProto) then
			local label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト')
			if proto.validateTypes(stat.time.threat, ZoomProto) then
				label = label .. iu.scope('1倍デジタルスレット')
			end
			
			renderRow(
				tbl,
				label .. '&nbsp;',
				stat.time.hcog_classic.zoom_in,
				zoominConfig,
				secondOpts)
		end
		
		-- 3x HCOG 'Ranger', 2x-4x Variable AOG
		if proto.validateTypes(stat.time.hcog_ranged, ZoomProto) then
			if proto.validateTypes(stat.time.aog_variable, ZoomProto) then
				if stat.time.hcog_ranged.zoom_in ~= stat.time.aog_variable.zoom_in then
					renderRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. '&nbsp;',
						stat.time.hcog_ranged.zoom_in,
						zoominConfig,
						secondOpts)
					renderRow(
						tbl,
						iu.scope('2~4倍可変式AOG') .. '&nbsp;',
						stat.time.aog_variable.zoom_in,
						zoominConfig,
						secondOpts)
				else
					renderRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. '&nbsp;',
						stat.time.hcog_ranged.zoom_in,
						zoominConfig,
						secondOpts)
				end
			else
				renderRow(
					tbl,
					iu.scope('3倍HCOG\'レンジャー\'') .. '&nbsp;',
					stat.time.hcog_ranged.zoom_in,
					zoominConfig,
					secondOpts)
			end
		end
		
		-- 6x Sniper Scope
		if proto.validateTypes(stat.time.sniper, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('6倍スナイパー') .. '&nbsp;',
				stat.time.sniper.zoom_in,
				zoominConfig,
				secondOpts)
		end
		
		-- 4x-8x Variable Sniper Scope
		if proto.validateTypes(stat.time.sniper_variable, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('4~8倍可変式スナイパー') .. '&nbsp;',
				stat.time.sniper_variable.zoom_in,
				zoominConfig,
				secondOpts)
		end
		
		-- 4x-10x Digital Sniper Threat
		if proto.validateTypes(stat.time.sniper_threat, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('4~10倍デジタルスレット') .. '&nbsp;',
				stat.time.sniper_threat.zoom_in,
				zoominConfig,
				secondOpts)
		end
	end
	
	-- Zoom Out
	if aw.isNumber(stat.time.zoom_out) then
		local zoomoutConfig = {
			fmt  = duration.zoomout.format,
			muls = stock.zoom,
			unit = duration.zoomout.unit,
			isSpecial = isSpecial,
		}
		renderRow(
			tbl,
			duration.zoomout.name,
			stat.time.zoom_out,
			zoomoutConfig)
		
		-- HCOG Classic/Bruiser, Holosight, 1x Digital Threat
		if proto.validateTypes(stat.time.hcog_classic, ZoomProto) then
			local label = iu.scope('1倍HCOG\'クラシック\'') .. iu.scope('2倍HCOG\'ブルーザー\'') .. iu.scope('1倍ホロサイト') .. iu.scope('1~2倍可変式ホロサイト')
			if proto.validateTypes(stat.time.threat, ZoomProto) then
				label = label .. iu.scope('1倍デジタルスレット')
			end
			
			renderRow(
				tbl,
				label .. '&nbsp;',
				stat.time.hcog_classic.zoom_out,
				zoomoutConfig,
				secondOpts)
		end
		
		-- 3x HCOG 'Ranger', 2x-4x Variable AOG
		if proto.validateTypes(stat.time.hcog_ranged, ZoomProto) then
			if proto.validateTypes(stat.time.aog_variable, ZoomProto) then
				if stat.time.hcog_ranged.zoom_out ~= stat.time.aog_variable.zoom_out then
					renderRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. '&nbsp;',
						stat.time.hcog_ranged.zoom_out,
						zoomoutConfigt,
						secondOpts)
					renderRow(
						tbl,
						iu.scope('2~4倍可変式AOG') .. '&nbsp;',
						stat.time.aog_variable.zoom_out,
						zoomoutConfig,
						secondOpts)
				else
					renderRow(
						tbl,
						iu.scope('3倍HCOG\'レンジャー\'') .. iu.scope('2~4倍可変式AOG') .. '&nbsp;',
						stat.time.hcog_ranged.zoom_out,
						zoomoutConfig,
						secondOpts)
				end
			else
				renderRow(
					tbl,
					iu.scope('3倍HCOG\'レンジャー\'') .. '&nbsp;',
					stat.time.hcog_ranged.zoom_out,
					zoomoutConfig,
					secondOpts)
			end
		end
		
		-- 6x Sniper Scope
		if proto.validateTypes(stat.time.sniper, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('6倍スナイパー') .. '&nbsp;',
				stat.time.sniper.zoom_out,
				zoomoutConfig,
				secondOpts)
		end
		
		-- 4x-8x Variable Sniper Scope
		if proto.validateTypes(stat.time.sniper_variable, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('4~8倍可変式スナイパー') .. '&nbsp;',
				stat.time.sniper_variable.zoom_out,
				zoomoutConfig,
				secondOpts)
		end
		
		-- 4x-10x Digital Sniper Threat
		if proto.validateTypes(stat.time.sniper_threat, ZoomProto) then
			renderRow(
				tbl,
				iu.scope('4~10倍デジタルスレット') .. '&nbsp;',
				stat.time.sniper_threat.zoom_out,
				zoomoutConfig,
				secondOpts)
		end
	end
	
	return tbl
end

function p.renderDuration(stat, lang)
	local duration = cfg[lang].duration
	local isSniper = stat.category == 'sniper' or stat.category == 'marksman_weapon'
	local stock
	if isSniper then
		stock = attachment.sniper_stock
	else
		stock = attachment.standard_stock
	end
	local canModdedLoader = stat.category == 'light_machine_gun' or stat.ammo == 'minigun'
	local isSpecial = aw.stringstarts(stat.ammo, 'special_') and not (stat.ammo == 'special_sniper')
	
	local isSimple = not stat.attachments.stock or isSpecial
	local node
	if isSimple then
		node = renderDurationWithoutStock(stat, duration, stock, canModdedLoader, isSpecial)
	else
		node = renderDurationWithStock(stat, duration, stock, canModdedLoader, isSniper)
	end
	
	return node, isSimple
end

function p._main(name, lang)
	lang = lang or 'ja'
	
	local stat = mw.loadData('Module:Stat/Weapon')[name]
	local node, _ = p.renderDuration(stat, lang)
	return tostring(node)
end

return p