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

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

提供:Apex Data
ナビゲーションに移動 検索に移動
(デバッグモードが有効になっていた問題の修正)
(ボセックコンパウンドボウの物資投下武器化に対応)
 
(同じ利用者による、間の37版が非表示)
1行目: 1行目:
local aw       = require('Module:Utility/Library')
local aw           = require('Module:Utility/Library')
local iu       = require('Module:Utility/Image')
local apex          = require('Module:Utility/ApexLibrary')
local tableutil = require('Module:Utility/TableUtil/Apex')
local iu           = require('Module:Utility/Image')
local Hopup     = mw.loadData('Module:Stat/Hopup')
local scale        = require('Module:Utility/Scale')
local tableutil     = require('Module:Utility/TableUtil/Apex')
local Hopup         = mw.loadData('Module:Stat/Hopup')
local configuration = mw.loadData('Module:StatTable/configuration')
local getArgs  -- lazily initialized
local getArgs  -- lazily initialized


local configuration = {
local function addData(dataset, data, fn)
__debug__enableAllHopup = false,
fn = fn or function(val) return val end
en = {
dmgslot    = 'Damage per Slot',
local head = data.head
graph      = 'Graph',
local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1)
hopup      = 'Hop-Up',
local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2)
infinity  = '∞',
local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3)
maxcharge = 'Max charge',
local legs = data.legs
mincharge  = 'Min charge',
local mul = data.pellets * data.slotammo
weaponname = 'Weapon name',
data.bodyDmgslot = fn(data.damage, 1, 1)                              * mul
},
data.headDmgslot = fn(apex.calcPartDamage(data.damage, head), head, 1) * mul
ja = {
data.lvl1Dmgslot = fn(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
dmgslot    = 'スロット当たりのダメージ',
data.lvl2Dmgslot = fn(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
graph      = 'グラフ',
data.lvl3Dmgslot = fn(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
hopup      = 'ホップアップ',
data.legsDmgslot = fn(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
infinity  = '∞',
data.flLgDmgslot = fn(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
maxcharge  = '最大溜め',
table.insert(dataset, data)
mincharge  = '最小溜め',
end
weaponname = '武器名',
 
},
}


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'
44行目: 48行目:
if type(stat.magazine) == 'table' then
if type(stat.magazine) == 'table' then
ammoPerSlot = stat.magazine[4] + stat.magazine_reserve
ammoPerSlot = stat.magazine[4] + stat.magazine_reserve
elseif stat.magazine == math.huge then
ammoPerSlot = stat.magazine_reserve
else
else
ammoPerSlot = stat.magazine + stat.magazine_reserve
ammoPerSlot = stat.magazine + stat.magazine_reserve
51行目: 57行目:
end
end
local ammoPerShot = stat.ammo_per_shot or 1
local baseDamage = stat.damage.base
local baseDamage = stat.damage.base
local baseData = {
local baseData = {
ammo      = stat.ammo,
ammo      = stat.ammo,
dmgslot  = ammoPerSlot * baseDamage,
ammoicon  = stat.ammo,
damage    = baseDamage,
head      = stat.damage_head_scale,
legs      = stat.damage_legs_scale,
name      = name,
name      = name,
pellets  = stat.pellet or 1,
shortname = stat.localization['Japanese_Short'],
shortname = stat.localization['Japanese_Short'],
slotammo  = math.floor(ammoPerSlot / ammoPerShot),
}
}
local ammoPerShot = stat.ammo_per_shot or 1
local virtualAmmoPerSlot = math.floor(ammoPerSlot / ammoPerShot)
-- チャージビーム (チャージライフル)
-- チャージビーム (チャージライフル)
if stat.damage.beam then
if stat.damage.beam then
local tickData = aw.shallowCopy(baseData)
addData(dataset, baseData, function(val, part, passive)
tickData.dmgslot = virtualAmmoPerSlot * (baseDamage + stat.damage.beam.base * stat.damage.beam.ticks)
return val + apex.calcDamageFromPartAndPassive(stat.damage.beam.base, part, passive) * stat.damage.beam.ticks
table.insert(dataset, tickData)
end)
-- 散弾 (ショットガン・トリプルテイク)
-- Other
elseif aw.isNumberAndGreaterThanX(stat.pellet, 1) then
local pelletData = aw.shallowCopy(baseData)
pelletData.dmgslot = virtualAmmoPerSlot * baseDamage * stat.pellet
table.insert(dataset, pelletData)
-- ハンマーポイント弾 (モザンビーク)
if (configuration.__debug__enableAllHopup or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then
local pelletUnshieldedData = aw.shallowCopy(pelletData)
pelletUnshieldedData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.hammerpoint_rounds * baseDamage) * stat.pellet
pelletUnshieldedData.hopup  = { 'hammerpoint_rounds' }
table.insert(dataset, pelletUnshieldedData)
end
-- それ以外
else
else
-- チャージ (30-30リピーター・ボセックコンパウンドボウ)
-- Chargefire
if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then
if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then
local minChargeData = aw.shallowCopy(baseData)
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
minChargeData.option = res.mincharge
baseData.option = res.mincharge
table.insert(dataset, minChargeData)
else
baseData.option = res.nocharge
end
addData(dataset, baseData)
local maxChargeData = aw.shallowCopy(baseData)
local maxChargeData   = aw.shallowCopy(baseData)
maxChargeData.dmgslot = virtualAmmoPerSlot * stat.damage.charged
maxChargeData.damage  = stat.damage.charged
maxChargeData.option = res.maxcharge
if stat.damage.headshot_charged then
table.insert(dataset, maxChargeData)
maxChargeData.head = stat.damage.headshot_charged
end
if stat.damage.legshot_charged then
maxChargeData.legs = stat.damage.legshot_charged
end
maxChargeData.option   = res.maxcharge
addData(dataset, maxChargeData)
-- チャージが無効の場合の通常出力
-- チャージが無効の場合の通常出力
else
else
table.insert(dataset, baseData)
addData(dataset, baseData)
end
end
-- 増幅モード (センチネル)
-- Amped mode
if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then
if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then
local ampedData = aw.shallowCopy(baseData)
local ampedData   = aw.shallowCopy(baseData)
ampedData.ammo    = ampedData.ammo .. '_amped'
ampedData.ammoicon = ampedData.ammo .. '_amped'
ampedData.dmgslot = virtualAmmoPerSlot * stat.damage.amped
ampedData.damage  = stat.damage.amped
ampedData.option = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>'
ampedData.option   = res.amped
table.insert(dataset, ampedData)
addData(dataset, ampedData)
end
end
-- セレクトファイアレシーバー (ハボックライフル)
-- Selectfire Receiver (HAVOC Rifle)
if (configuration.__debug__enableAllHopup or Hopup.selectfire_receiver.enabled) and stat.selectfire_receiver and stat.selectfire_receiver.damage and aw.isNumberAndGreaterThanX(stat.selectfire_receiver.damage.base, baseDamage) then
if (__debug or Hopup.selectfire_receiver.enabled) and type(stat.selectfire_receiver) == 'table' and stat.selectfire_receiver.damage and aw.isNumberAndGreaterThanX(stat.selectfire_receiver.damage.base, baseDamage) then
local selectfireReceiverData = aw.shallowCopy(baseData)
local selectfireReceiverData = aw.shallowCopy(baseData)
selectfireReceiverData.dmgslot = virtualAmmoPerSlot * stat.selectfire_receiver.damage.base
selectfireReceiverData.damage = stat.selectfire_receiver.damage.base
selectfireReceiverData.hopup   = { 'selectfire_receiver' }
if stat.selectfire_receiver.damage_head_scale then
table.insert(dataset, selectfireReceiverData)
selectfireReceiverData.head = stat.selectfire_receiver.damage_head_scale
end
selectfireReceiverData.hopup = { 'selectfire_receiver' }
if stat.selectfire_receiver.damage_legs_scale then
selectfireReceiverData.legs = stat.selectfire_receiver.damage_legs_scale
end
if stat.selectfire_receiver.ammo_per_shot then
selectfireReceiverData.slotammo = math.floor(ammoPerSlot / stat.selectfire_receiver.ammo_per_shot)
end
addData(dataset, selectfireReceiverData)
end
-- Skullpiercer Rifling
if (__debug or Hopup.skullpiercer_rifling.enabled) and type(stat.skullpiercer_rifling) == 'table' and aw.isNumberAndGreaterThanX(stat.skullpiercer_rifling.damage_head_scale, 1) then
local skullpiercerRiflingData = aw.shallowCopy(baseData)
skullpiercerRiflingData.head = stat.skullpiercer_rifling.damage_head_scale
skullpiercerRiflingData.hopup = { 'skullpiercer_rifling' }
addData(dataset, skullpiercerRiflingData)
end
end
-- ハンマーポイント弾 (P2020)
-- Hammerpoint Rounds
if (configuration.__debug__enableAllHopup or Hopup.hammerpoint_rounds.enabled) and aw.isNumberAndGreaterThanX(stat.damage.hammerpoint_rounds, 1) then
if (__debug or Hopup.hammerpoint_rounds.enabled) and type(stat.hammerpoint_rounds) == 'table' and aw.isNumberAndGreaterThanX(stat.hammerpoint_rounds.damage_unshielded_scale, 1) then
local hammerpointRoundsData = aw.shallowCopy(baseData)
local hammerpointRoundsData = aw.shallowCopy(baseData)
hammerpointRoundsData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.hammerpoint_rounds * baseDamage)
hammerpointRoundsData.damage = math.floor(stat.hammerpoint_rounds.damage_unshielded_scale * baseDamage)
hammerpointRoundsData.hopup   = { 'hammerpoint_rounds' }
hammerpointRoundsData.hopup = { 'hammerpoint_rounds' }
table.insert(dataset, hammerpointRoundsData)
addData(dataset, hammerpointRoundsData)
end
end
-- ディスラプター弾 (オルタネーター・RE-45オート)
-- Disruptor Rounds
if (configuration.__debug__enableAllHopup or Hopup.disruptor_rounds.enabled or special) and aw.isNumberAndGreaterThanX(stat.damage.disruptor_rounds, 1) then
if (__debug or Hopup.disruptor_rounds.enabled or special) and type(stat.disruptor_rounds) == 'table' and aw.isNumberAndGreaterThanX(stat.disruptor_rounds.damage_shield_scale, 1) then
local disruptorRoundsData = aw.shallowCopy(baseData)
local disruptorRoundsData = aw.shallowCopy(baseData)
disruptorRoundsData.dmgslot = virtualAmmoPerSlot * math.floor(stat.damage.disruptor_rounds * baseDamage)
disruptorRoundsData.hopup = { 'disruptor_rounds' }
disruptorRoundsData.hopup   = { 'disruptor_rounds' }
addData(dataset, disruptorRoundsData, function(val)
table.insert(dataset, disruptorRoundsData)
return apex.calcDisruptorDamage(val, stat.disruptor_rounds.damage_shield_scale)
end)
end
end
-- アンビルレシーバー (VK-47フラットライン・R-301カービン)
-- Anvil Receiver
if (configuration.__debug__enableAllHopup or Hopup.anvil_receiver.enabled) and stat.anvil_receiver and aw.isNumberAndGreaterThanX(stat.anvil_receiver.damage.base, baseDamage) then
if (__debug or Hopup.anvil_receiver.enabled) and type(stat.anvil_receiver) == 'table' and aw.isNumberAndGreaterThanX(stat.anvil_receiver.damage.base, baseDamage) then
local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2
local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2
local anvilReceiverData = aw.shallowCopy(baseData)
local anvilReceiverData   = aw.shallowCopy(baseData)
anvilReceiverData.dmgslot = math.floor(ammoPerSlot / anvilAmmoPerShot) * stat.anvil_receiver.damage.base
anvilReceiverData.damage  = stat.anvil_receiver.damage.base
anvilReceiverData.hopup   = { 'anvil_receiver' }
if stat.anvil_receiver.damage_head_scale then
table.insert(dataset, anvilReceiverData)
anvilReceiverData.head = stat.anvil_receiver.damage_head_scale
end
anvilReceiverData.hopup   = { 'anvil_receiver' }
if stat.anvil_receiver.damage_legs_scale then
anvilReceiverData.legs = stat.anvil_receiver.damage_legs_scale
end
anvilReceiverData.slotammo = math.floor(ammoPerSlot / anvilAmmoPerShot)
addData(dataset, anvilReceiverData)
end
end
-- シャッターキャップ (30-30リピーター・ボセックコンパウンドボウ)
-- Shatter Caps
if (configuration.__debug__enableAllHopup or Hopup.shatter_caps.enabled) and stat.shatter_caps and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then
if (__debug or Hopup.shatter_caps.enabled) and type(stat.shatter_caps) == 'table' and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then
local shatterCapsData    = aw.shallowCopy(baseData)
shatterCapsData.damage  = stat.shatter_caps.damage.base
if stat.shatter_caps.damage_head_scale then
shatterCapsData.head = stat.shatter_caps.damage_head_scale
end
shatterCapsData.hopup    = { 'shatter_caps' }
if stat.shatter_caps.damage_legs_scale then
shatterCapsData.legs = stat.shatter_caps.damage_legs_scale
end
shatterCapsData.pellets  = stat.shatter_caps.pellet
if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
local shatterCapsMinChargeData = aw.shallowCopy(baseData)
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
shatterCapsMinChargeData.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.base * stat.shatter_caps.pellet
shatterCapsData.option = res.mincharge
shatterCapsMinChargeData.option = res.mincharge
else
shatterCapsMinChargeData.hopup  = { 'shatter_caps' }
shatterCapsData.option = res.nocharge
table.insert(dataset, shatterCapsMinChargeData)
end
addData(dataset, shatterCapsData)
local shatterCapsMaxChargeData = aw.shallowCopy(shatterCapsMinChargeData)
local shatterCapsMaxChargeData   = aw.shallowCopy(shatterCapsData)
shatterCapsMaxChargeData.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.charged * stat.shatter_caps.pellet
shatterCapsMaxChargeData.damage  = stat.shatter_caps.damage.charged
shatterCapsMaxChargeData.option = res.maxcharge
if stat.shatter_caps.damage.headshot_charged then
table.insert(dataset, shatterCapsMaxChargeData)
shatterCapsMaxChargeData.head = stat.shatter_caps.damage.headshot_charged
end
if stat.shatter_caps.damage.legshot_charged then
shatterCapsMaxChargeData.legs = stat.shatter_caps.damage.legshot_charged
end
shatterCapsMaxChargeData.option   = res.maxcharge
addData(dataset, shatterCapsMaxChargeData)
else
else
local shatterCapsData = aw.shallowCopy(baseData)
addData(dataset, shatterCapsData)
shatterCapsData.dmgslot = virtualAmmoPerSlot * stat.shatter_caps.damage.base * stat.shatter_caps.pellet
shatterCapsData.hopup  = { 'shatter_caps' }
table.insert(dataset, shatterCapsData)
end
end
end
end
172行目: 217行目:
end
end
local metadata = {
local metadata = {
tableutil.RankCell.new('', 'dmgslot', true),
tableutil.RankCell.new('', 'bodyDmgslot', true),
tableutil.AmmoCell.new('', 'ammo', {
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', {
181行目: 229行目:
attributes    = { align = 'left' },
attributes    = { align = 'left' },
cellClass      = 'st-dashed-right st-mobile-none-right st-mobile-padding0-right',
cellClass      = 'st-dashed-right st-mobile-none-right st-mobile-padding0-right',
headerClass    = 'st-dashed-right st-mobile-none-right st-mobile-padding0-right',
headerColspan  = 2,
headerColspan  = 2,
optionIndex    = 'option',
optionIndex    = 'option',
188行目: 235行目:
tableutil.HopupCell.new(res.hopup, 'hopup', {
tableutil.HopupCell.new(res.hopup, 'hopup', {
attributes    = { align = 'left' },
attributes    = { align = 'left' },
cellClass      = 'st-dashed-left st-mobile-none-left st-mobile-padding0-left',
cellClass      = 'st-mobile-padding0-both',
headerClass    = 'st-dashed-left st-mobile-none-left st-mobile-padding0-left',
headerColspan  = 0,
headerColspan  = 0,
}),
}),
tableutil.LineValueCell.new(res.dmgslot, 'dmgslot', {
tableutil.ValueCell.new(res.legsshot, 'legsDmgslot', {
cellClass  = 'st-mobile-graph st-mobile-textshadow st-mobile-last',
cellClass  = 'st-desktop',
footerClass = 'st-desktop',
format      = formatFunction,
format      = formatFunction,
headerClass = 'st-mobile-graph st-mobile-last',
headerClass = 'st-desktop',
headerStyle = {
headerStyle = {
['min-width'] = '75px',
['min-width'] = '50px',
['max-width'] = '8em',
['max-width'] = '4em',
},
},
}),
}),
tableutil.LineCell.new(res.graph, 'dmgslot', {
tableutil.LineValueCell.new(res.bodyshot, 'bodyDmgslot', {
cellClass  = 'st-desktop-graph',
startIndex    = 'legsDmgslot',
headerClass = 'st-desktop-graph',
endIndex      = 'lvl1Dmgslot',
subStartIndex = 'flLgDmgslot',
subEndIndex  = 'lvl1Dmgslot',
cellClass    = 'st-mobile-graph st-mobile-medium st-mobile-textshadow',
footerClass  = 'st-mobile-axis',
format        = formatFunction,
headerStyle  = {
['min-width'] = '50px',
['max-width'] = '4em',
},
itemName      = res.normal,
subItemName  = res.fortified,
preferredGridCount = 3,
scale        = scale.LogScale.new():setClamp(true),
ticksFormat  = function(val)
return string.format('%sk', 0.001 * val)
end
}),
tableutil.ValueCell.new(res.headlvl3, 'lvl3Dmgslot', {
cellClass  = 'st-desktop',
footerClass = 'st-desktop',
format      = formatFunction,
headerClass = 'st-desktop',
headerStyle = {
headerStyle = {
['min-width'] = '160px',
['min-width'] = '50px',
['max-width'] = '4em',
},
}),
tableutil.ValueCell.new(res.headlvl2, 'lvl2Dmgslot', {
cellClass  = 'st-desktop',
footerClass = 'st-desktop',
format      = formatFunction,
headerClass = 'st-desktop',
headerStyle = {
['min-width'] = '50px',
['max-width'] = '4em',
},
}),
tableutil.ValueCell.new(res.headlvl1, 'lvl1Dmgslot', {
cellClass  = 'st-mobile-last',
footerClass = 'st-mobile-last',
format      = formatFunction,
headerClass = 'st-mobile-last',
headerStyle = {
['min-width'] = '50px',
['max-width'] = '4em',
},
}),
tableutil.LineCell.new(res.graph, 'bodyDmgslot', {
startIndex    = 'legsDmgslot',
endIndex      = 'lvl1Dmgslot',
subStartIndex = 'flLgDmgslot',
subEndIndex  = 'lvl1Dmgslot',
cellClass    = 'st-desktop st-desktop-graph',
footerClass  = 'st-desktop',
headerClass  = 'st-desktop',
headerStyle  = {
['min-width'] = '200px',
},
},
hoverEnabled  = true,
hoverFormat  = formatFunction,
itemName      = res.normal,
subItemName  = res.fortified,
scale        = scale.LogScale.new():setClamp(true),
}),
}),
}
}
219行目: 326行目:
args = getArgs(frame)
args = getArgs(frame)
return p._main(args)
return p._main(args, false)
end
end


return p
return p

2022年8月10日 (水) 13:52時点における最新版

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

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

local function addData(dataset, data, fn)
	fn = fn or function(val) return val end
	
	local head = data.head
	local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1)
	local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2)
	local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3)
	local legs = data.legs
	local mul  = data.pellets * data.slotammo
	data.bodyDmgslot = fn(data.damage, 1, 1)                               * mul
	data.headDmgslot = fn(apex.calcPartDamage(data.damage, head), head, 1) * mul
	data.lvl1Dmgslot = fn(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
	data.lvl2Dmgslot = fn(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
	data.lvl3Dmgslot = fn(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
	data.legsDmgslot = fn(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
	data.flLgDmgslot = fn(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
	table.insert(dataset, data)
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 ammoStats = mw.loadData('Module:Stat/Ammo')
	
	local dataset = {}
	for name, stat in pairs(stats) do
		local special = aw.stringstarts(stat.ammo, 'special_')
		
		local ammoPerSlot
		if special or stat.ammo == 'minigun' then
			if type(stat.magazine) == 'table' then
				ammoPerSlot = stat.magazine[4] + stat.magazine_reserve
			elseif stat.magazine == math.huge then
				ammoPerSlot = stat.magazine_reserve
			else
				ammoPerSlot = stat.magazine + stat.magazine_reserve
			end
		else
			ammoPerSlot = ammoStats[stat.ammo].slot
		end
		
		local ammoPerShot = stat.ammo_per_shot or 1
		local baseDamage = stat.damage.base
		local baseData = {
			ammo      = stat.ammo,
			ammoicon  = stat.ammo,
			damage    = baseDamage,
			head      = stat.damage_head_scale,
			legs      = stat.damage_legs_scale,
			name      = name,
			pellets   = stat.pellet or 1,
			shortname = stat.localization['Japanese_Short'],
			slotammo  = math.floor(ammoPerSlot / ammoPerShot),
		}
		
		-- チャージビーム (チャージライフル)
		if stat.damage.beam then
			addData(dataset, baseData, function(val, part, passive)
				return val + apex.calcDamageFromPartAndPassive(stat.damage.beam.base, part, passive) * stat.damage.beam.ticks
			end)
		
		-- Other
		else
			-- Chargefire
			if aw.isNumberAndGreaterThanX(stat.damage.charged, baseDamage) then
				if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
					baseData.option = res.mincharge
				else
					baseData.option = res.nocharge
				end
				addData(dataset, baseData)
				
				local maxChargeData    = aw.shallowCopy(baseData)
				maxChargeData.damage   = stat.damage.charged
				if stat.damage.headshot_charged then
					maxChargeData.head = stat.damage.headshot_charged
				end
				if stat.damage.legshot_charged then
					maxChargeData.legs = stat.damage.legshot_charged
				end
				maxChargeData.option   = res.maxcharge
				addData(dataset, maxChargeData)
			
			-- チャージが無効の場合の通常出力
			else
				addData(dataset, baseData)
			end
			
			-- Amped mode
			if aw.isNumberAndGreaterThanX(stat.damage.amped, baseDamage) then
				local ampedData    = aw.shallowCopy(baseData)
				ampedData.ammoicon = ampedData.ammo .. '_amped'
				ampedData.damage   = stat.damage.amped
				ampedData.option   = res.amped
				addData(dataset, ampedData)
			end
			
			-- Selectfire Receiver (HAVOC Rifle)
			if (__debug or Hopup.selectfire_receiver.enabled) and type(stat.selectfire_receiver) == 'table' and stat.selectfire_receiver.damage and aw.isNumberAndGreaterThanX(stat.selectfire_receiver.damage.base, baseDamage) then
				local selectfireReceiverData = aw.shallowCopy(baseData)
				selectfireReceiverData.damage = stat.selectfire_receiver.damage.base
				if stat.selectfire_receiver.damage_head_scale then
					selectfireReceiverData.head = stat.selectfire_receiver.damage_head_scale
				end
				selectfireReceiverData.hopup = { 'selectfire_receiver' }
				if stat.selectfire_receiver.damage_legs_scale then
					selectfireReceiverData.legs = stat.selectfire_receiver.damage_legs_scale
				end
				if stat.selectfire_receiver.ammo_per_shot then
					selectfireReceiverData.slotammo = math.floor(ammoPerSlot / stat.selectfire_receiver.ammo_per_shot)
				end
				addData(dataset, selectfireReceiverData)
			end
			
			-- Skullpiercer Rifling 
			if (__debug or Hopup.skullpiercer_rifling.enabled) and type(stat.skullpiercer_rifling) == 'table' and aw.isNumberAndGreaterThanX(stat.skullpiercer_rifling.damage_head_scale, 1) then
				local skullpiercerRiflingData = aw.shallowCopy(baseData)
				skullpiercerRiflingData.head = stat.skullpiercer_rifling.damage_head_scale
				skullpiercerRiflingData.hopup = { 'skullpiercer_rifling' }
				addData(dataset, skullpiercerRiflingData)
			end
				
			-- Hammerpoint Rounds
			if (__debug or Hopup.hammerpoint_rounds.enabled) and type(stat.hammerpoint_rounds) == 'table' and aw.isNumberAndGreaterThanX(stat.hammerpoint_rounds.damage_unshielded_scale, 1) then
				local hammerpointRoundsData  = aw.shallowCopy(baseData)
				hammerpointRoundsData.damage = math.floor(stat.hammerpoint_rounds.damage_unshielded_scale * baseDamage)
				hammerpointRoundsData.hopup  = { 'hammerpoint_rounds' }
				addData(dataset, hammerpointRoundsData)
			end
			
			-- Disruptor Rounds
			if (__debug or Hopup.disruptor_rounds.enabled or special) and type(stat.disruptor_rounds) == 'table' and aw.isNumberAndGreaterThanX(stat.disruptor_rounds.damage_shield_scale, 1) then
				local disruptorRoundsData = aw.shallowCopy(baseData)
				disruptorRoundsData.hopup = { 'disruptor_rounds' }
				addData(dataset, disruptorRoundsData, function(val)
					return apex.calcDisruptorDamage(val, stat.disruptor_rounds.damage_shield_scale)
				end)
			end
			
			-- Anvil Receiver
			if (__debug or Hopup.anvil_receiver.enabled) and type(stat.anvil_receiver) == 'table' and aw.isNumberAndGreaterThanX(stat.anvil_receiver.damage.base, baseDamage) then
				local anvilAmmoPerShot = stat.anvil_receiver.ammo_per_shot or 2
				local anvilReceiverData    = aw.shallowCopy(baseData)
				anvilReceiverData.damage   = stat.anvil_receiver.damage.base
				if stat.anvil_receiver.damage_head_scale then
					anvilReceiverData.head = stat.anvil_receiver.damage_head_scale
				end
				anvilReceiverData.hopup    = { 'anvil_receiver' }
				if stat.anvil_receiver.damage_legs_scale then
					anvilReceiverData.legs = stat.anvil_receiver.damage_legs_scale
				end
				anvilReceiverData.slotammo = math.floor(ammoPerSlot / anvilAmmoPerShot)
				addData(dataset, anvilReceiverData)
			end
				
			-- Shatter Caps
			if (__debug or Hopup.shatter_caps.enabled) and type(stat.shatter_caps) == 'table' and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.base, 1) and aw.isNumberAndGreaterThanX(stat.shatter_caps.pellet, 1) then
				local shatterCapsData    = aw.shallowCopy(baseData)
				shatterCapsData.damage   = stat.shatter_caps.damage.base
				if stat.shatter_caps.damage_head_scale then
					shatterCapsData.head = stat.shatter_caps.damage_head_scale
				end
				shatterCapsData.hopup    = { 'shatter_caps' }
				if stat.shatter_caps.damage_legs_scale then
					shatterCapsData.legs = stat.shatter_caps.damage_legs_scale
				end
				shatterCapsData.pellets  = stat.shatter_caps.pellet
				
				if aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
					if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
						shatterCapsData.option = res.mincharge
					else
						shatterCapsData.option = res.nocharge
					end
					addData(dataset, shatterCapsData)
						
					local shatterCapsMaxChargeData    = aw.shallowCopy(shatterCapsData)
					shatterCapsMaxChargeData.damage   = stat.shatter_caps.damage.charged
					if stat.shatter_caps.damage.headshot_charged then
						shatterCapsMaxChargeData.head = stat.shatter_caps.damage.headshot_charged
					end
					if stat.shatter_caps.damage.legshot_charged then
						shatterCapsMaxChargeData.legs = stat.shatter_caps.damage.legshot_charged
					end
					shatterCapsMaxChargeData.option   = res.maxcharge
					addData(dataset, shatterCapsMaxChargeData)
				else
					addData(dataset, shatterCapsData)
				end
			end
		end
	end
	
	local formatFunction = function(dmgslot)
		if dmgslot == math.huge then
			return res.infinity
		else
			return aw.comma(dmgslot)
		end
	end
	local metadata = {
		tableutil.RankCell.new('', 'bodyDmgslot', 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  = 2,
			optionIndex    = 'option',
			shortnameIndex = 'shortname',
		}),
		tableutil.HopupCell.new(res.hopup, 'hopup', {
			attributes     = { align = 'left' },
			cellClass      = 'st-mobile-padding0-both',
			headerColspan  = 0,
		}),
		tableutil.ValueCell.new(res.legsshot, 'legsDmgslot', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.LineValueCell.new(res.bodyshot, 'bodyDmgslot', {
			startIndex    = 'legsDmgslot',
			endIndex      = 'lvl1Dmgslot',
			subStartIndex = 'flLgDmgslot',
			subEndIndex   = 'lvl1Dmgslot',
			cellClass     = 'st-mobile-graph st-mobile-medium st-mobile-textshadow',
			footerClass   = 'st-mobile-axis',
			format        = formatFunction,
			headerStyle   = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
			itemName      = res.normal,
			subItemName   = res.fortified,
			preferredGridCount = 3,
			scale         = scale.LogScale.new():setClamp(true),
			ticksFormat   = function(val)
				return string.format('%sk', 0.001 * val)
			end
		}),
		tableutil.ValueCell.new(res.headlvl3, 'lvl3Dmgslot', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.ValueCell.new(res.headlvl2, 'lvl2Dmgslot', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.ValueCell.new(res.headlvl1, 'lvl1Dmgslot', {
			cellClass   = 'st-mobile-last',
			footerClass = 'st-mobile-last',
			format      = formatFunction,
			headerClass = 'st-mobile-last',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.LineCell.new(res.graph, 'bodyDmgslot', {
			startIndex    = 'legsDmgslot',
			endIndex      = 'lvl1Dmgslot',
			subStartIndex = 'flLgDmgslot',
			subEndIndex   = 'lvl1Dmgslot',
			cellClass     = 'st-desktop st-desktop-graph',
			footerClass   = 'st-desktop',
			headerClass   = 'st-desktop',
			headerStyle   = {
				['min-width'] = '200px',
			},
			hoverEnabled  = true,
			hoverFormat   = formatFunction,
			itemName      = res.normal,
			subItemName   = res.fortified,
			scale         = scale.LogScale.new():setClamp(true),
		}),
	}
	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