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

「モジュール:StatTable/Firerate」の版間の差分

提供:Apex Data
ナビゲーションに移動 検索に移動
(デスクトップ向けのグラフの最小幅を変更)
(他のStatTableと統一的なコードになるようにリファクタリング)
7行目: 7行目:


local configuration = {
local configuration = {
__debug__enableAllHopup = false,
en = {
en = {
auto        = 'Auto',
auto        = 'Auto',
38行目: 37行目:
}
}


local function addData(dataset, data, firerates, res, variableRate)
local function addData(dataset, data, res, variableRate)
local fireratesType = type(firerates)
local fireratesType = type(data.firerates)
if fireratesType == 'table' then
if fireratesType == 'table' then
-- 可変レートの場合
-- 可変レートの場合
if #firerates == 2 then
if #data.firerates == 2 then
local minChargeData      = aw.shallowCopy(data)
local minChargeData      = aw.shallowCopy(data)
minChargeData.firerate  = firerates[1]
minChargeData.firerate  = data.firerates[1]
if variableRate then
if variableRate then
minChargeData.option = res.minfire
minChargeData.option = res.minfire
53行目: 52行目:
local maxChargeData      = aw.shallowCopy(data)
local maxChargeData      = aw.shallowCopy(data)
maxChargeData.firerate  = firerates[2]
maxChargeData.firerate  = data.firerates[2]
if variableRate then
if variableRate then
maxChargeData.option = res.maxfire
maxChargeData.option = res.maxfire
63行目: 62行目:
-- ショットガンボルトがつく場合
-- ショットガンボルトがつく場合
else
else
for level, firerate in ipairs(firerates) do
for level, firerate in ipairs(data.firerates) do
local boltData = aw.shallowCopy(data)
local boltData = aw.shallowCopy(data)
boltData.firerate = firerate
boltData.firerate = firerate
73行目: 72行目:
-- ショットガンボルトがつかない場合
-- ショットガンボルトがつかない場合
else
else
data.firerate = firerates
data.firerate = data.firerates
table.insert(dataset, data)
table.insert(dataset, data)
end
end
79行目: 78行目:


local p = {}
local p = {}
function p._main(args)
function p._main(args, __debug)
args = args or {}
args = args or {}
if __debug == nil then
__debug = true
end
local lang  = args.lang or 'ja'
local lang  = args.lang or 'ja'
91行目: 93行目:
ammo      = stat.ammo,
ammo      = stat.ammo,
ammoicon  = stat.ammo,
ammoicon  = stat.ammo,
firerates = apex.getFirerate(stat, {}),
level    = -1,
level    = -1,
name      = name,
name      = name,
shortname = stat.localization['Japanese_Short'],
shortname = stat.localization['Japanese_Short'],
}
}
local firerate = apex.getFirerate(stat, {})
local special  = aw.stringstarts(stat.ammo, 'special_')
local special  = aw.stringstarts(stat.ammo, 'special_')
-- Altfire mode
-- Altfire mode
if stat.altfire and aw.isNumberAndGreaterThanZero(stat.altfire.firerate) then
if stat.altfire and aw.isNumberAndGreaterThanZero(stat.altfire.firerate) then
local basicData  = aw.shallowCopy(baseData)
baseData.option = res.burstAverage
basicData.option = res.burstAverage
addData(dataset, baseData, res)
addData(dataset, basicData, firerate, res)
if aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
if aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
local maxData = aw.shallowCopy(baseData)
local maxData     = aw.shallowCopy(baseData)
maxData.option = res.burst
maxData.firerates = stat.firerate
addData(dataset, maxData, stat.firerate, res)
maxData.option   = res.burst
addData(dataset, maxData, res)
end
end
local altfireData = aw.shallowCopy(baseData)
local altfireData     = aw.shallowCopy(baseData)
altfireData.option = (stat.altfire.is_semi_auto == true or stat.is_semi_auto) and res.single or res.auto
altfireData.firerates = stat.altfire.firerate
addData(dataset, altfireData, stat.altfire.firerate, res)
altfireData.option   = (stat.altfire.is_semi_auto == true or stat.is_semi_auto) and res.single or res.auto
addData(dataset, altfireData, res)
-- Burst mode
-- Burst mode
elseif aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
elseif aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
local basicData  = aw.shallowCopy(baseData)
baseData.option = res.burstAverage
basicData.option = res.burstAverage
addData(dataset, baseData, res)
addData(dataset, basicData, firerate, res)
local maxData = aw.shallowCopy(baseData)
local maxData     = aw.shallowCopy(baseData)
maxData.option = res.burst
maxData.firerates = stat.firerate
addData(dataset, maxData, stat.firerate, res)
maxData.option   = res.burst
addData(dataset, maxData, res)
-- Other
-- Other
else
else
addData(dataset, baseData, firerate, res, name == 'ディヴォーションLMG')
addData(dataset, baseData, res, name == 'ディヴォーションLMG')
end
end
-- Revved Up mode
-- Revved Up mode
if aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_revvedup, stat.firerate) then
if aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_revvedup, stat.firerate) then
local revvedUpData   = aw.shallowCopy(baseData)
local revvedUpData     = aw.shallowCopy(baseData)
revvedUpData.ammoicon = baseData.ammo .. '_revved_up'
revvedUpData.ammoicon = baseData.ammo .. '_revved_up'
revvedUpData.option   = iu.grenade('テルミットグレネード') .. ' <span class="text-desktoponly">連射速度上昇モード</span>'
revvedUpData.firerates = stat.firerate_revvedup
addData(dataset, revvedUpData, stat.firerate_revvedup, res)
revvedUpData.option   = iu.grenade('テルミットグレネード') .. ' <span class="text-desktoponly">連射速度上昇モード</span>'
addData(dataset, revvedUpData, res)
end
end
-- Selectfire Receiver
-- Selectfire Receiver
if (configuration.__debug__enableAllHopup or Hopup.selectfire_receiver.enabled) and stat.selectfire_receiver and aw.isNumberAndGreaterThanZero(stat.selectfire_receiver.firerate) then
if (__debug or Hopup.selectfire_receiver.enabled) and type(stat.selectfire_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.selectfire_receiver.firerate) then
local selectfireReceiverData = aw.shallowCopy(baseData)
local selectfireReceiverData     = aw.shallowCopy(baseData)
selectfireReceiverData.hopup = { 'selectfire_receiver' }
selectfireReceiverData.firerates = stat.selectfire_receiver.firerate
addData(dataset, selectfireReceiverData, stat.selectfire_receiver.firerate, res)
selectfireReceiverData.hopup     = { 'selectfire_receiver' }
addData(dataset, selectfireReceiverData, res)
end
end
-- Anvil Receiver
-- Anvil Receiver
if (configuration.__debug__enableAllHopup or Hopup.anvil_receiver.enabled) and stat.anvil_receiver and aw.isNumberAndGreaterThanZero(stat.anvil_receiver.firerate) then
if (__debug or Hopup.anvil_receiver.enabled) and type(stat.anvil_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.anvil_receiver.firerate) then
local anvilReceiverData = aw.shallowCopy(baseData)
local anvilReceiverData = aw.shallowCopy(baseData)
anvilReceiverData.firerates = stat.anvil_receiver.firerate
anvilReceiverData.hopup = { 'anvil_receiver' }
anvilReceiverData.hopup = { 'anvil_receiver' }
addData(dataset, anvilReceiverData, stat.anvil_receiver.firerate, res)
addData(dataset, anvilReceiverData, res)
end
end
-- Double Tap Trigger
-- Double Tap Trigger
if (configuration.__debug__enableAllHopup or Hopup.double_tap_trigger.enabled) and stat.double_tap_trigger and aw.isNumberAndGreaterThanZero(stat.double_tap_trigger.firerate) then
if (__debug or Hopup.double_tap_trigger.enabled) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanZero(stat.double_tap_trigger.firerate) then
local doubleTapTriggerFirerate = apex.getFirerate(stat, { useDoubleTapTrigger = true })
local doubleTapTriggerData    = aw.shallowCopy(baseData)
local doubleTapTriggerData = aw.shallowCopy(baseData)
doubleTapTriggerData.firerates = apex.getFirerate(stat, { useDoubleTapTrigger = true })
doubleTapTriggerData.hopup = { 'double_tap_trigger' }
doubleTapTriggerData.hopup     = { 'double_tap_trigger' }
doubleTapTriggerData.option = res.burstAverage
doubleTapTriggerData.option   = res.burstAverage
addData(dataset, doubleTapTriggerData, doubleTapTriggerFirerate, res)
addData(dataset, doubleTapTriggerData, res)
if aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
if aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
local maxDoubleTapTriggerData = aw.shallowCopy(doubleTapTriggerData)
local maxDoubleTapTriggerData     = aw.shallowCopy(doubleTapTriggerData)
maxDoubleTapTriggerData.option = res.burst
maxDoubleTapTriggerData.firerates = stat.double_tap_trigger.firerate
addData(dataset, maxDoubleTapTriggerData, stat.double_tap_trigger.firerate, res)
maxDoubleTapTriggerData.option   = res.burst
addData(dataset, maxDoubleTapTriggerData, res)
end
end
end
end
-- Deadeye's Tempo
-- Deadeye's Tempo
if (configuration.__debug__enableAllHopup or Hopup.deadeyes_tempo.enabled) and stat.deadeyes_tempo then
if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then
local deadeyesTempoFirerate = apex.getFirerate(stat, { useDeadeyesTempo = true })
local deadeyesTempoFirerate = apex.getFirerate(stat, { useDeadeyesTempo = true })
local deadeyesTempoData = aw.shallowCopy(baseData)
local deadeyesTempoData = aw.shallowCopy(baseData)
181行目: 188行目:
tableutil.RankCell.new('', 'firerate', true),
tableutil.RankCell.new('', 'firerate', true),
tableutil.AmmoCell.new('', 'ammoicon', {
tableutil.AmmoCell.new('', 'ammoicon', {
attributes     = { align = 'center' },
attributes = { align = 'center' },
headerStyle   = { width = '36px' },
cellClass  = 'st-desktop',
footerClass = 'st-desktop',
headerClass = 'st-desktop',
headerStyle = { width = '36px' },
}),
}),
tableutil.WeaponNameCell.new(res.weaponname, 'name', {
tableutil.WeaponNameCell.new(res.weaponname, 'name', {
236行目: 246行目:
args = getArgs(frame)
args = getArgs(frame)
return p._main(args)
return p._main(args, false)
end
end


return p
return p

2021年8月27日 (金) 15:44時点における版

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

local aw        = require('Module:Utility/Library')
local apex      = require('Module:Utility/ApexLibrary')
local iu        = require('Module:Utility/Image')
local tableutil = require('Module:Utility/TableUtil/Apex')
local Hopup     = mw.loadData('Module:Stat/Hopup')
local getArgs  -- lazily initialized

local configuration = {
	en = {
		auto         = 'Auto',
		burst        = 'Burst',
		burstAverage = 'Burst Average',
		firerate     = 'Firerate [rps]',
		graph        = 'Graph',
		hopup        = 'Hop-Up',
		maxcharge    = 'Max charge',
		maxfire      = 'Max fire',
		mincharge    = 'Min charge',
		minfire      = 'Min fire',
		single       = 'Single',
		weaponname   = 'Weapon name',
	},
	ja = {
		auto         = 'オート',
		burst        = 'バースト',
		burstAverage = 'バースト平均',
		firerate     = '射撃レート [rps]',
		graph        = 'グラフ',
		hopup        = 'ホップアップ',
		maxcharge    = '最大溜め',
		maxfire      = '最大時',
		mincharge    = '最小溜め',
		minfire      = '最小時',
		single       = '単発',
		weaponname   = '武器名',
	},
}

local function addData(dataset, data, res, variableRate)
	local fireratesType = type(data.firerates)
	if fireratesType == 'table' then
		-- 可変レートの場合
		if #data.firerates == 2 then
			local minChargeData      = aw.shallowCopy(data)
			minChargeData.firerate   = data.firerates[1]
			if variableRate then
				minChargeData.option = res.minfire
			else
				minChargeData.option = res.mincharge
			end
			table.insert(dataset, minChargeData)
			
			local maxChargeData      = aw.shallowCopy(data)
			maxChargeData.firerate   = data.firerates[2]
			if variableRate then
				maxChargeData.option = res.maxfire
			else
				maxChargeData.option = res.maxcharge
			end
			table.insert(dataset, maxChargeData)
		
		-- ショットガンボルトがつく場合
		else
			for level, firerate in ipairs(data.firerates) do
				local boltData = aw.shallowCopy(data)
				boltData.firerate = firerate
				boltData.level    = level - 1
				table.insert(dataset, boltData)
			end
		end
	
	-- ショットガンボルトがつかない場合
	else
		data.firerate = data.firerates
		table.insert(dataset, data)
	end
end

local p = {}
function p._main(args, __debug)
	args = args or {}
	if __debug == nil then
		__debug = true
	end
	
	local lang  = args.lang or 'ja'
	local res   = configuration[lang]
	local stats = mw.loadData('Module:Stat/Weapon')
	
	local dataset = {}
	for name, stat in pairs(stats) do
		local baseData = {
			ammo      = stat.ammo,
			ammoicon  = stat.ammo,
			firerates = apex.getFirerate(stat, {}),
			level     = -1,
			name      = name,
			shortname = stat.localization['Japanese_Short'],
		}
		local special  = aw.stringstarts(stat.ammo, 'special_')
	
		-- Altfire mode
		if stat.altfire and aw.isNumberAndGreaterThanZero(stat.altfire.firerate) then
			baseData.option = res.burstAverage
			addData(dataset, baseData, res)
			
			if aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
				local maxData     = aw.shallowCopy(baseData)
				maxData.firerates = stat.firerate
				maxData.option    = res.burst
				addData(dataset, maxData, res)
			end
			
			local altfireData     = aw.shallowCopy(baseData)
			altfireData.firerates = stat.altfire.firerate
			altfireData.option    = (stat.altfire.is_semi_auto == true or stat.is_semi_auto) and res.single or res.auto
			addData(dataset, altfireData, res)
		
		-- Burst mode
		elseif aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
			baseData.option = res.burstAverage
			addData(dataset, baseData, res)
			
			local maxData     = aw.shallowCopy(baseData)
			maxData.firerates = stat.firerate
			maxData.option    = res.burst
			addData(dataset, maxData, res)
		
		-- Other
		else
			addData(dataset, baseData, res, name == 'ディヴォーションLMG')
		end
		
		-- Revved Up mode
		if aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_revvedup, stat.firerate) then
			local revvedUpData     = aw.shallowCopy(baseData)
			revvedUpData.ammoicon  = baseData.ammo .. '_revved_up'
			revvedUpData.firerates = stat.firerate_revvedup
			revvedUpData.option    = iu.grenade('テルミットグレネード') .. ' <span class="text-desktoponly">連射速度上昇モード</span>'
			addData(dataset, revvedUpData, res)
		end
		
		-- Selectfire Receiver
		if (__debug or Hopup.selectfire_receiver.enabled) and type(stat.selectfire_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.selectfire_receiver.firerate) then
			local selectfireReceiverData     = aw.shallowCopy(baseData)
			selectfireReceiverData.firerates = stat.selectfire_receiver.firerate
			selectfireReceiverData.hopup     = { 'selectfire_receiver' }
			addData(dataset, selectfireReceiverData, res)
		end
			
		-- Anvil Receiver
		if (__debug or Hopup.anvil_receiver.enabled) and type(stat.anvil_receiver) == 'table' and aw.isNumberAndGreaterThanZero(stat.anvil_receiver.firerate) then
			local anvilReceiverData = aw.shallowCopy(baseData)
			anvilReceiverData.firerates = stat.anvil_receiver.firerate
			anvilReceiverData.hopup = { 'anvil_receiver' }
			addData(dataset, anvilReceiverData, res)
		end
			
		-- Double Tap Trigger
		if (__debug or Hopup.double_tap_trigger.enabled) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanZero(stat.double_tap_trigger.firerate) then
			local doubleTapTriggerData     = aw.shallowCopy(baseData)
			doubleTapTriggerData.firerates = apex.getFirerate(stat, { useDoubleTapTrigger = true })
			doubleTapTriggerData.hopup     = { 'double_tap_trigger' }
			doubleTapTriggerData.option    = res.burstAverage
			addData(dataset, doubleTapTriggerData, res)
			
			if aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
				local maxDoubleTapTriggerData     = aw.shallowCopy(doubleTapTriggerData)
				maxDoubleTapTriggerData.firerates = stat.double_tap_trigger.firerate
				maxDoubleTapTriggerData.option    = res.burst
				addData(dataset, maxDoubleTapTriggerData, res)
			end
		end
			
		-- Deadeye's Tempo
		if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then
			local deadeyesTempoFirerate = apex.getFirerate(stat, { useDeadeyesTempo = true })
			local deadeyesTempoData = aw.shallowCopy(baseData)
			deadeyesTempoData.hopup = { 'deadeyes_tempo' }
			if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.rechamber) then
				deadeyesTempoData.option = res.maxfire
			end
			addData(dataset, deadeyesTempoData, deadeyesTempoFirerate, res)
		end
	end
	
	local metadata = {
		tableutil.RankCell.new('', 'firerate', true),
		tableutil.AmmoCell.new('', 'ammoicon', {
			attributes  = { align = 'center' },
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			headerClass = 'st-desktop',
			headerStyle = { width = '36px' },
		}),
		tableutil.WeaponNameCell.new(res.weaponname, 'name', {
			ammoIndex      = 'ammo',
			attributes     = { align = 'left' },
			cellClass      = 'st-dashed-right st-mobile-none-right st-mobile-padding0-right',
			headerColspan  = 3,
			optionIndex    = 'option',
			shortnameIndex = 'shortname',
		}),
		tableutil.MagazineCell.new(res.mag, 'level', {
			ammoIndex      = 'ammo',
			attributes     = { align = 'left' },
			cellClass      = 'st-dashed-both st-mobile-none-both st-mobile-padding0-both',
			headerColspan  = 0,
		}),
		tableutil.HopupCell.new(res.hopup, 'hopup', {
			attributes     = { align = 'left' },
			cellClass      = 'st-dashed-left st-mobile-none-left st-mobile-padding0-both',
			headerColspan  = 0,
		}),
		tableutil.LineValueCell.new(res.firerate, 'firerate', {
			cellClass   = 'st-mobile-graph st-mobile-textshadow st-mobile-last',
			footerClass = 'st-mobile-axis st-mobile-last',
			format      = function(val)
				return string.format('%.2f', val)
			end,
			headerClass = 'st-mobile-last',
			headerStyle = {
				['min-width'] = '80px',
				['max-width'] = '8em',
			},
			preferredGridCount = 3,
		}),
		tableutil.LineCell.new(res.graph, 'firerate', {
			cellClass   = 'st-desktop st-desktop-graph',
			footerClass = 'st-desktop',
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '200px',
			},
			maximumValue = 25,
		}),
	}
	local node = tableutil.createTable(dataset, metadata)
	return tostring(node)
end

function p.main(frame)
	if not getArgs then
		getArgs = require('Module:Arguments').getArgs
	end
	args = getArgs(frame)
	
	return p._main(args, false)
end

return p