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

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

提供:Apex Data
ナビゲーションに移動 検索に移動
(試験的に鉄壁のDPSをグラフに表示)
(スカルピアサーライフリングに対応)
 
(同じ利用者による、間の26版が非表示)
1行目: 1行目:
local aw       = require('Module:Utility/Library')
local aw           = require('Module:Utility/Library')
local apex     = require('Module:Utility/ApexLibrary')
local apex         = require('Module:Utility/ApexLibrary')
local iu       = require('Module:Utility/Image')
local iu           = require('Module:Utility/Image')
local tableutil = require('Module:Utility/TableUtil/Apex')
local inu          = require('Module:Utility/ImageWithName')
local Hopup     = mw.loadData('Module:Stat/Hopup')
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 _getAddData(fn)
en = {
fn = fn or function(val) return val end
auto      = 'Auto',
return function(dataset, data, firerate)
bodyshot  = 'Body',
local head = data.head
burst      = 'Burst',
local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1)
duration  = 'Duration [sec]',
local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2)
graph      = 'Graph',
local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3)
headshot  = 'Head',
local legs = data.legs
headlvl1  = iu.gear('ヘルメット', 1),
local mul = firerate * data.pellets
headlvl2  = iu.gear('ヘルメット', 2),
data.bodyDPS = fn(data.damage, 1, 1)                              * mul
headlvl3  = iu.gear('ヘルメット', 3),
data.headDPS = fn(apex.calcPartDamage(data.damage, head), head, 1) * mul
legsshot  = 'Legs',
data.lvl1DPS = fn(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
maxcharge = 'Max charge',
data.lvl2DPS = fn(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
mincharge  = 'Min charge',
data.lvl3DPS = fn(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
nocharge  = 'No charge',
data.legsDPS = fn(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
single    = 'Single',
data.flLgDPS = fn(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
weaponname = 'Weapon name',
table.insert(dataset, data)
},
end
ja = {
end
auto      = 'オート',
bodyshot  = '胴',
burst      = 'バースト',
duration  = '射撃継続時間 [秒]',
graph      = 'グラフ',
headshot  = '頭',
headlvl1  = iu.gear('ヘルメット', 1),
headlvl2  = iu.gear('ヘルメット', 2),
headlvl3  = iu.gear('ヘルメット', 3),
legsshot  = '脚',
maxcharge  = '最大溜め',
mincharge  = '最小溜め',
nocharge  = '溜めなし',
single    = '単発',
weaponname = '武器名',
},
}


local function _addData(dataset, data, firerate, fn)
local fnRatio
local head = data.head
local function _getAddDataComplex(fns)
local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1)
local bf = fns.unsd or function(val) return val end
local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2)
local at = fns.shld or function(val) return val end
local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3)
local legs = data.legs
return function(dataset, data, firerate)
local mul  = firerate * data.pellets
local head = data.head
data.bodyDPS = fn(data.damage, 1)                              * mul
local lvl1 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV1)
data.headDPS = fn(apex.calcPartDamage(data.damage, head), head) * mul
local lvl2 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV2)
data.lvl1DPS = fn(apex.calcPartDamage(data.damage, lvl1), lvl1) * mul
local lvl3 = apex.calcHeadshotMultiplier(head, apex.HEAD_HLMLV3)
data.lvl2DPS = fn(apex.calcPartDamage(data.damage, lvl2), lvl2) * mul
local legs = data.legs
data.lvl3DPS = fn(apex.calcPartDamage(data.damage, lvl3), lvl3) * mul
local mul  = firerate * data.pellets
data.legsDPS = fn(apex.calcPartDamage(data.damage, legs), legs) * mul
data.flL1DPS = fn(apex.calcDamageFromPartAndPassive(data.damage, lvl1, 0.85), lvl1) * mul
local unsdDamage = bf(data.damage)
data.flLgDPS = fn(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs) * mul
data.unsdBodyDPS = unsdDamage                            * mul
table.insert(dataset, data)
data.unsdHeadDPS = apex.calcPartDamage(unsdDamage, head) * mul
data.unsdLvl1DPS = apex.calcPartDamage(unsdDamage, lvl1) * mul
data.unsdLvl2DPS = apex.calcPartDamage(unsdDamage, lvl2) * mul
data.unsdLvl3DPS = apex.calcPartDamage(unsdDamage, lvl3) * mul
data.unsdLegsDPS = apex.calcPartDamage(unsdDamage, legs) * mul
data.unsdFlLgDPS = apex.calcDamageFromPartAndPassive(unsdDamage, legs, 0.85) * mul
data.shldBodyDPS = at(data.damage, 1, 1)                              * mul
data.shldHeadDPS = at(apex.calcPartDamage(data.damage, head), head, 1) * mul
data.shldLvl1DPS = at(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
data.shldLvl2DPS = at(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
data.shldLvl3DPS = at(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
data.shldLegsDPS = at(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
data.shldFlLgDPS = at(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
for _, target in ipairs(fnRatio) do
local data2 = aw.shallowCopy(data)
data2.option  = target.name
data2.bodyDPS = target.fn(data.unsdBodyDPS, data.shldBodyDPS)
data2.headDPS = target.fn(data.unsdHeadDPS, data.shldHeadDPS)
data2.lvl1DPS = target.fn(data.unsdLvl1DPS, data.shldLvl1DPS)
data2.lvl2DPS = target.fn(data.unsdLvl2DPS, data.shldLvl2DPS)
data2.lvl3DPS = target.fn(data.unsdLvl3DPS, data.shldLvl3DPS)
data2.legsDPS = target.fn(data.unsdLegsDPS, data.shldLegsDPS)
data2.flLgDPS = target.fn(data.unsdFlLgDPS, data.shldFlLgDPS)
table.insert(dataset, data2)
end
end
end
end


local function addData(dataset, data, special, fn)
local function addData(dataset, data, special, fn, bf, at)
fn = fn or function(val) return val end
local __addData
if type(fn) == 'table' then
__addData = _getAddDataComplex(fn)
else
__addData = _getAddData(fn)
end
local fireratesType  = type(data.firerates)
local fireratesType  = type(data.firerates)
69行目: 86行目:
if fireratesType == 'table' then
if fireratesType == 'table' then
if special then
if special then
_addData(dataset, data, data.firerates[4], fn)
__addData(dataset, data, data.firerates[4])
else
else
for level, firerate in ipairs(data.firerates) do
for level, firerate in ipairs(data.firerates) do
local data2 = aw.shallowCopy(data)
local data2 = aw.shallowCopy(data)
data2.level = level - 1
data2.level = level - 1
_addData(dataset, data2, firerate, fn)
__addData(dataset, data2, firerate)
end
end
end
end
80行目: 97行目:
-- ファイアレートが固定
-- ファイアレートが固定
elseif fireratesType == 'number' then
elseif fireratesType == 'number' then
_addData(dataset, data, data.firerates, fn)
__addData(dataset, data, data.firerates)
end
end
 
local function getDataAsCharge(baseData, stat, root, additional, level)
local charge  = (stat.charge  or root.charge) * (level - 1) / (root.charge_levels - 1)
local firerate = stat.firerate or root.firerate
local fullcharge = level == root.charge_levels
local chargeData = aw.shallowCopy(baseData)
if fullcharge and stat.damage.charged then
chargeData.damage = stat.damage.charged
end
if type(additional) == 'table' then
chargeData.firerates = {
apex.calcRechamberFirerate(firerate, charge + additional[1]),
apex.calcRechamberFirerate(firerate, charge + additional[2]),
apex.calcRechamberFirerate(firerate, charge + additional[3]),
apex.calcRechamberFirerate(firerate, charge + additional[4]),
}
else
chargeData.firerates = apex.calcRechamberFirerate(firerate, charge + additional)
end
if fullcharge and stat.damage.headshot_charged then
chargeData.head = stat.damage.headshot_charged
end
if fullcharge and stat.damage.legshot_charged then
chargeData.legs = stat.damage.legshot_charged
end
end
return chargeData
end
end


91行目: 135行目:
damage    = stat.damage.base,
damage    = stat.damage.base,
firerates = stat.firerate,
firerates = stat.firerate,
head      = stat.damage.headshot,
head      = stat.damage_head_scale,
legs      = stat.damage.legshot,
legs      = stat.damage_legs_scale,
level    = -1,
level    = -1,
name      = name,
name      = name,
127行目: 171行目:
apex.calcRechamberFirerate(stat.firerate, stat.rechamber[4]),
apex.calcRechamberFirerate(stat.firerate, stat.rechamber[4]),
}
}
addData(dataset, baseData, special)
-- Chargefire
if aw.isNumberAndGreaterThanZero(stat.charge) then
baseData.option = res.nocharge
addData(dataset, baseData, special)
if stat.charge_levels == 2 then
local maxData = getDataAsCharge(baseData, stat, stat, stat.rechamber, 2)
maxData.option = res.maxcharge
addData(dataset, maxData, special)
else
for lvl = 2, stat.charge_levels do
local chargeData = getDataAsCharge(baseData, stat, stat, stat.rechamber, lvl)
chargeData.option = aw.getQuantityString(res.charges, lvl - 1)
addData(dataset, chargeData, special)
end
end
else
addData(dataset, baseData, special)
end
elseif aw.isNumberAndGreaterThanZero(stat.rechamber) then
elseif aw.isNumberAndGreaterThanZero(stat.rechamber) then
local isCharge = aw.isNumberAndGreaterThanZero(stat.charge)
-- Chargefire
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
if aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) then
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge_minimum)
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
baseData.option    = res.mincharge
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge_minimum)
baseData.option    = res.mincharge
else
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
baseData.option    = res.nocharge
end
addData(dataset, baseData, special)
local maxData = getDataAsCharge(baseData, stat, stat, stat.rechamber, stat.charge_levels)
maxData.option = res.maxcharge
addData(dataset, maxData, special)
-- Amped mode
elseif aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
addData(dataset, baseData, special)
local ampedData   = aw.shallowCopy(baseData)
ampedData.ammoicon = stat.ammo .. '_amped'
ampedData.damage  = stat.damage.amped
ampedData.option  = res.amped
addData(dataset, ampedData)
else
else
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
if isCharge then
addData(dataset, baseData, special)
baseData.option = res.nocharge
end
end
addData(dataset, baseData, special)
-- Chargefire
if isCharge then
local maxData    = aw.shallowCopy(baseData)
maxData.damage    = stat.damage.charged
maxData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge)
maxData.head      = stat.damage.headshot_charged or stat.damage.headshot
maxData.legs      = stat.damage.legshot_charged or stat.damage.legshot
maxData.option    = res.maxcharge
addData(dataset, maxData, special)
end
end
-- Chargefire
-- Chargefire
elseif aw.isNumberAndGreaterThanZero(stat.charge) then
elseif aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) then
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum)
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum)
163行目: 233行目:
addData(dataset, baseData, special)
addData(dataset, baseData, special)
local maxData     = aw.shallowCopy(baseData)
if stat.charge_levels == 2 or stat.charge_levels > 4 then
maxData.damage    = stat.damage.charged
local maxData = getDataAsCharge(baseData, stat, stat, 0, stat.charge_levels)
maxData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge)
maxData.option = res.maxcharge
maxData.head      = stat.damage.headshot_charged or stat.damage.headshot
addData(dataset, maxData, special)
maxData.legs      = stat.damage.legshot_charged or stat.damage.legshot
else
maxData.option   = res.maxcharge
for lvl = 2, stat.charge_levels do
addData(dataset, maxData, special)
local chargeData = getDataAsCharge(baseData, stat, stat, 0, lvl)
chargeData.option = aw.getQuantityString(res.charges, lvl - 1)
addData(dataset, chargeData, special)
end
end
-- Charge Rifle
-- Charge Rifle
elseif aw.isNumberAndGreaterThanZero(stat.sustained_discharge_duration) then
elseif aw.isNumberAndGreaterThanZero(stat.sustained_discharge_duration) then
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.sustained_discharge_duration)
baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.sustained_discharge_duration)
addData(dataset, baseData, special, function(val, mul)
addData(dataset, baseData, special, function(val, part, passive)
return val + apex.calcPartDamage(stat.damage.beam.base, mul) * stat.damage.beam.ticks
return val + apex.calcDamageFromPartAndPassive(stat.damage.beam.base, part, passive) * stat.damage.beam.ticks
end)
end)
181行目: 255行目:
else
else
addData(dataset, baseData, special)
addData(dataset, baseData, special)
end
-- Amped mode
if aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then
local ampedData    = aw.shallowCopy(baseData)
ampedData.ammoicon = stat.ammo .. '_amped'
ampedData.damage  = stat.damage.amped
ampedData.option  = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>'
addData(dataset, ampedData)
end
end
197行目: 262行目:
revvedUpData.ammoicon  = stat.ammo .. '_revved_up'
revvedUpData.ammoicon  = stat.ammo .. '_revved_up'
revvedUpData.firerates = stat.firerate_revvedup
revvedUpData.firerates = stat.firerate_revvedup
revvedUpData.option    = iu.grenade('テルミットグレネード') .. ' <span class="text-desktoponly">連射速度上昇モード</span>'
revvedUpData.option    = res.revvedup
addData(dataset, revvedUpData, special)
addData(dataset, revvedUpData, special)
end
end
231行目: 296行目:
local selectfireReceiverData    = aw.shallowCopy(baseData)
local selectfireReceiverData    = aw.shallowCopy(baseData)
selectfireReceiverData.damage    = stat.selectfire_receiver.damage and stat.selectfire_receiver.damage.base or stat.damage.base
selectfireReceiverData.firerates = firerate
selectfireReceiverData.firerates = firerate
if stat.selectfire_receiver.damage_head_scale then
selectfireReceiverData.head  = stat.selectfire_receiver.damage_head_scale
end
selectfireReceiverData.hopup    = { 'selectfire_receiver' }
selectfireReceiverData.hopup    = { 'selectfire_receiver' }
if stat.selectfire_receiver.damage then
if stat.selectfire_receiver.damage_legs_scale then
selectfireReceiverData.damage = stat.selectfire_receiver.damage.base    or stat.damage.base
selectfireReceiverData.legs = stat.selectfire_receiver.damage_legs_scale
selectfireReceiverData.head  = stat.selectfire_receiver.damage.headshot or stat.damage.headshot
selectfireReceiverData.legs   = stat.selectfire_receiver.damage.legshot  or stat.damage.legshot
end
end
addData(dataset, selectfireReceiverData, special)
addData(dataset, selectfireReceiverData, special)
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, special)
end
end
-- Hammerpoint Rounds
-- Hammerpoint Rounds
if (__debug 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.damage = math.floor(stat.damage.hammerpoint_rounds * stat.damage.base)
hammerpointRoundsData.hopup  = { 'hammerpoint_rounds' }
hammerpointRoundsData.hopup  = { 'hammerpoint_rounds' }
addData(dataset, hammerpointRoundsData, special)
addData(dataset, hammerpointRoundsData, special, { unsd = function(val)
return math.floor(stat.hammerpoint_rounds.damage_unshielded_scale * val)
end })
end
end
-- Disruptor Rounds
-- Disruptor Rounds
if (__debug 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.hopup = { 'disruptor_rounds' }
disruptorRoundsData.hopup = { 'disruptor_rounds' }
addData(dataset, disruptorRoundsData, special, function(val)
addData(dataset, disruptorRoundsData, special, { shld = function(val)
return apex.calcDisruptorDamage(val, stat.damage.disruptor_rounds)
return apex.calcDisruptorDamage(val, stat.disruptor_rounds.damage_shield_scale)
end)
end })
end
end
263行目: 339行目:
anvilReceiverData.damage    = stat.anvil_receiver.damage.base
anvilReceiverData.damage    = stat.anvil_receiver.damage.base
anvilReceiverData.firerates = stat.anvil_receiver.firerate
anvilReceiverData.firerates = stat.anvil_receiver.firerate
if stat.anvil_receiver.damage.headshot then
if stat.anvil_receiver.damage_head_scale then
anvilReceiverData.head  = stat.anvil_receiver.damage.headshot
anvilReceiverData.head  = stat.anvil_receiver.damage_head_scale
end
end
anvilReceiverData.hopup    = { 'anvil_receiver' }
anvilReceiverData.hopup    = { 'anvil_receiver' }
if stat.anvil_receiver.damage.legshot then
if stat.anvil_receiver.damage_legs_scale then
anvilReceiverData.legs  = stat.anvil_receiver.damage.legshot
anvilReceiverData.legs  = stat.anvil_receiver.damage_legs_scale
end
end
addData(dataset, anvilReceiverData, special)
addData(dataset, anvilReceiverData, special)
274行目: 350行目:
-- Double Tap Trigger
-- Double Tap Trigger
if (__debug or Hopup.double_tap_trigger.enabled) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
if (__debug or Hopup.double_tap_trigger.enabled or special) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
local doubleTapTriggerData    = aw.shallowCopy(baseData)
local doubleTapTriggerData    = aw.shallowCopy(baseData)
local delay = stat.double_tap_trigger.burst_delay
local delay = stat.double_tap_trigger.burst_delay
294行目: 370行目:
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
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)
local shatterCapsData    = aw.shallowCopy(baseData)
if stat.shatter_caps.charge then
shatterCapsData.charge = stat.shatter_caps.charge
end
if stat.shatter_caps.charge_levels then
shatterCapsData.charge_levels = stat.shatter_caps.charge_levels
end
shatterCapsData.damage  = stat.shatter_caps.damage.base
shatterCapsData.damage  = stat.shatter_caps.damage.base
if stat.shatter_caps.damage.headshot then
if stat.shatter_caps.damage_head_scale then
shatterCapsData.head = stat.shatter_caps.damage.headshot
shatterCapsData.head = stat.shatter_caps.damage_head_scale
end
end
shatterCapsData.hopup    = { 'shatter_caps' }
shatterCapsData.hopup    = { 'shatter_caps' }
if stat.shatter_caps.damage.legshot then
if stat.shatter_caps.damage_legs_scale then
shatterCapsData.legs = stat.shatter_caps.damage.legshot
shatterCapsData.legs = stat.shatter_caps.damage_legs_scale
end
end
shatterCapsData.option  = nil
shatterCapsData.pellets  = stat.shatter_caps.pellet
shatterCapsData.pellets  = stat.shatter_caps.pellet
-- Chargefire
-- Chargefire
if aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
if aw.isNumberAndGreaterThanOrEqualToX(shatterCapsData.charge_levels, 2) and aw.isNumberAndGreaterThanZero(shatterCapsData.charge) then
shatterCapsData.option = res.mincharge
if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
shatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum)
shatterCapsData.option    = res.mincharge
else
shatterCapsData.option   = res.nocharge
end
addData(dataset, shatterCapsData)
addData(dataset, shatterCapsData)
local chargedShatterCapsData    = aw.shallowCopy(shatterCapsData)
local maxShatterCapsData = getDataAsCharge(shatterCapsData, stat.shatter_caps, stat, stat.rechamber or 0, shatterCapsData.charge_levels)
chargedShatterCapsData.damage  = stat.shatter_caps.damage.charged
maxShatterCapsData.option = res.maxcharge
if aw.isNumberAndGreaterThanZero(stat.rechamber) then
addData(dataset, maxShatterCapsData)
chargedShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge)
else
chargedShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge)
end
if stat.shatter_caps.damage.headshot_charged then
chargedShatterCapsData.head = stat.shatter_caps.damage.headshot_charged
end
if stat.shatter_caps.damage.legshot_charged then
chargedShatterCapsData.legs = stat.shatter_caps.damage.legshot_charged
end
chargedShatterCapsData.option   = res.maxcharge
addData(dataset, chargedShatterCapsData)
else
else
addData(dataset, shatterCapsData)
addData(dataset, shatterCapsData)
339行目: 415行目:
-- Chargefire
-- Chargefire
if aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
if aw.isNumberAndGreaterThanOrEqualToX(shatterCapsData.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
deadeyesTempoShatterCapsData.option = res.mincharge
deadeyesTempoShatterCapsData.option = res.mincharge
addData(dataset, deadeyesTempoShatterCapsData)
addData(dataset, deadeyesTempoShatterCapsData)
local chargedDeadeyesTempoShatterCapsData    = aw.shallowCopy(deadeyesTempoShatterCapsData)
local maxDeadeyesTempoShatterCapsData = getDataAsCharge(deadeyesTempoShatterCapsData, stat.shatter_caps, stat, stat.deadeyes_tempo.charge, shatterCapsData.charge_levels)
chargedDeadeyesTempoShatterCapsData.damage  = stat.shatter_caps.damage.charged
maxDeadeyesTempoShatterCapsData.option = res.maxcharge
chargedDeadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge)
addData(dataset, maxDeadeyesTempoShatterCapsData)
if stat.shatter_caps.damage.headshot_charged then
chargedDeadeyesTempoShatterCapsData.head = stat.shatter_caps.damage.headshot_charged
end
if stat.shatter_caps.damage.legshot_charged then
chargedDeadeyesTempoShatterCapsData.legs = stat.shatter_caps.damage.legshot_charged
end
chargedDeadeyesTempoShatterCapsData.option   = res.maxcharge
addData(dataset, chargedDeadeyesTempoShatterCapsData)
else
else
addData(dataset, deadeyesTempoShatterCapsData)
addData(dataset, deadeyesTempoShatterCapsData)
371行目: 439行目:
-- Chargefire
-- Chargefire
if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
if aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge) and aw.isNumberAndGreaterThanX(stat.damage.charged, stat.damage.base) then
deadeyesTempoData.option = res.mincharge
deadeyesTempoData.option = res.mincharge
addData(dataset, deadeyesTempoData)
addData(dataset, deadeyesTempoData)
local chargedDeadeyesTempoData    = aw.shallowCopy(deadeyesTempoData)
local maxDeadeyesTempoData = getDataAsCharge(deadeyesTempoData, stat, stat, stat.deadeyes_tempo.charge, stat.charge_levels)
chargedDeadeyesTempoData.damage    = stat.damage.charged
maxDeadeyesTempoData.option = res.maxcharge
chargedDeadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge)
addData(dataset, maxDeadeyesTempoData)
chargedDeadeyesTempoData.option   = res.maxcharge
addData(dataset, chargedDeadeyesTempoData)
else
else
addData(dataset, deadeyesTempoData, special)
addData(dataset, deadeyesTempoData, special)
406行目: 472行目:
local res  = configuration[lang]
local res  = configuration[lang]
local stats = mw.loadData('Module:Stat/Weapon')
local stats = mw.loadData('Module:Stat/Weapon')
local desktopOnlyAndNoLinkObj = { desktopOnly = true, lang = lang, link = '' }
fnRatio = {
{ name = inu.gear('backpack', 4, desktopOnlyAndNoLinkObj),  fn = function(a, b) return (7 * a + 5 * b) / 12 end },
{ name = inu.gear('evo_shield', 1, desktopOnlyAndNoLinkObj), fn = function(a, b) return (2 * a +    b) / 3 end },
{ name = inu.gear('evo_shield', 2, desktopOnlyAndNoLinkObj), fn = function(a, b) return (4 * a + 3 * b) / 7 end },
{ name = inu.gear('evo_shield', 3, desktopOnlyAndNoLinkObj), fn = function(a, b) return (    a +    b) / 2 end },
{ name = inu.gear('evo_shield', 5, desktopOnlyAndNoLinkObj), fn = function(a, b) return (4 * a + 5 * b) / 9 end },
{ name = res.maxvalue,                                      fn = function(a, b) return math.max(a, b)      end },
}
local dataset = {}
local dataset = {}
433行目: 509行目:
ammoIndex      = 'ammo',
ammoIndex      = 'ammo',
attributes    = { align = 'left' },
attributes    = { align = 'left' },
cellClass      = 'st-dashed-both st-mobile-none-both st-mobile-padding0-both',
cellClass      = 'st-dashed-right st-mobile-none-right st-mobile-padding0-both',
headerColspan  = 0,
headerColspan  = 0,
}),
}),
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-both',
cellClass      = 'st-mobile-padding0-both',
headerColspan  = 0,
headerColspan  = 0,
}),
}),
447行目: 523行目:
headerClass = 'st-desktop',
headerClass = 'st-desktop',
headerStyle = {
headerStyle = {
['min-width'] = '40px',
['min-width'] = '50px',
['max-width'] = '4em',
['max-width'] = '4em',
},
},
455行目: 531行目:
endIndex      = 'lvl1DPS',
endIndex      = 'lvl1DPS',
subStartIndex = 'flLgDPS',
subStartIndex = 'flLgDPS',
subEndIndex  = 'flL1DPS',
subEndIndex  = 'lvl1DPS',
cellClass    = 'st-mobile-graph st-mobile-textshadow',
cellClass    = 'st-mobile-graph st-mobile-medium st-mobile-textshadow',
footerClass  = 'st-mobile-axis',
footerClass  = 'st-mobile-axis',
format        = formatFunction,
format        = formatFunction,
headerStyle  = {
headerStyle  = {
['min-width'] = '80px',
['min-width'] = '50px',
['max-width'] = '8em',
['max-width'] = '4em',
},
},
itemName      = res.normal,
subItemName  = res.fortified,
maximumValue  = 400,
preferredGridCount = 3,
preferredGridCount = 3,
ticksFormat = function(val)
return string.format('%sk', 0.001 * val)
end
}),
}),
tableutil.ValueCell.new(res.headlvl3, 'lvl3DPS', {
tableutil.ValueCell.new(res.headlvl3, 'lvl3DPS', {
474行目: 550行目:
headerClass = 'st-desktop',
headerClass = 'st-desktop',
headerStyle = {
headerStyle = {
['min-width'] = '40px',
['min-width'] = '50px',
['max-width'] = '4em',
['max-width'] = '4em',
},
},
484行目: 560行目:
headerClass = 'st-desktop',
headerClass = 'st-desktop',
headerStyle = {
headerStyle = {
['min-width'] = '40px',
['min-width'] = '50px',
['max-width'] = '4em',
['max-width'] = '4em',
},
},
494行目: 570行目:
headerClass = 'st-mobile-last',
headerClass = 'st-mobile-last',
headerStyle = {
headerStyle = {
['min-width'] = '40px',
['min-width'] = '50px',
['max-width'] = '4em',
['max-width'] = '4em',
},
},
502行目: 578行目:
endIndex      = 'lvl1DPS',
endIndex      = 'lvl1DPS',
subStartIndex = 'flLgDPS',
subStartIndex = 'flLgDPS',
subEndIndex  = 'flL1DPS',
subEndIndex  = 'lvl1DPS',
cellClass    = 'st-desktop st-desktop-graph',
cellClass    = 'st-desktop st-desktop-graph',
footerClass  = 'st-desktop',
footerClass  = 'st-desktop',
509行目: 585行目:
['min-width'] = '200px',
['min-width'] = '200px',
},
},
maximumValue   = 500,
hoverEnabled  = true,
hoverFormat  = formatFunction,
itemName      = res.normal,
subItemName  = res.fortified,
maximumValue = 500,
}),
}),
}
}

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

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

local aw            = require('Module:Utility/Library')
local apex          = require('Module:Utility/ApexLibrary')
local iu            = require('Module:Utility/Image')
local inu           = require('Module:Utility/ImageWithName')
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 _getAddData(fn)
	fn = fn or function(val) return val end
	return function(dataset, data, firerate)
		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  = firerate * data.pellets
		data.bodyDPS = fn(data.damage, 1, 1)                               * mul
		data.headDPS = fn(apex.calcPartDamage(data.damage, head), head, 1) * mul
		data.lvl1DPS = fn(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
		data.lvl2DPS = fn(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
		data.lvl3DPS = fn(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
		data.legsDPS = fn(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
		data.flLgDPS = fn(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
		table.insert(dataset, data)
	end
end

local fnRatio
local function _getAddDataComplex(fns)
	local bf = fns.unsd or function(val) return val end
	local at = fns.shld or function(val) return val end
	
	return function(dataset, data, firerate)
		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  = firerate * data.pellets
		
		local unsdDamage = bf(data.damage)
		data.unsdBodyDPS = unsdDamage                            * mul
		data.unsdHeadDPS = apex.calcPartDamage(unsdDamage, head) * mul
		data.unsdLvl1DPS = apex.calcPartDamage(unsdDamage, lvl1) * mul
		data.unsdLvl2DPS = apex.calcPartDamage(unsdDamage, lvl2) * mul
		data.unsdLvl3DPS = apex.calcPartDamage(unsdDamage, lvl3) * mul
		data.unsdLegsDPS = apex.calcPartDamage(unsdDamage, legs) * mul
		data.unsdFlLgDPS = apex.calcDamageFromPartAndPassive(unsdDamage, legs, 0.85) * mul
		
		data.shldBodyDPS = at(data.damage, 1, 1)                               * mul
		data.shldHeadDPS = at(apex.calcPartDamage(data.damage, head), head, 1) * mul
		data.shldLvl1DPS = at(apex.calcPartDamage(data.damage, lvl1), lvl1, 1) * mul
		data.shldLvl2DPS = at(apex.calcPartDamage(data.damage, lvl2), lvl2, 1) * mul
		data.shldLvl3DPS = at(apex.calcPartDamage(data.damage, lvl3), lvl3, 1) * mul
		data.shldLegsDPS = at(apex.calcPartDamage(data.damage, legs), legs, 1) * mul
		data.shldFlLgDPS = at(apex.calcDamageFromPartAndPassive(data.damage, legs, 0.85), legs, 0.85) * mul
		
		for _, target in ipairs(fnRatio) do
			local data2 = aw.shallowCopy(data)
			data2.option  = target.name
			data2.bodyDPS = target.fn(data.unsdBodyDPS, data.shldBodyDPS)
			data2.headDPS = target.fn(data.unsdHeadDPS, data.shldHeadDPS)
			data2.lvl1DPS = target.fn(data.unsdLvl1DPS, data.shldLvl1DPS)
			data2.lvl2DPS = target.fn(data.unsdLvl2DPS, data.shldLvl2DPS)
			data2.lvl3DPS = target.fn(data.unsdLvl3DPS, data.shldLvl3DPS)
			data2.legsDPS = target.fn(data.unsdLegsDPS, data.shldLegsDPS)
			data2.flLgDPS = target.fn(data.unsdFlLgDPS, data.shldFlLgDPS)
			table.insert(dataset, data2)
		end
	end
end

local function addData(dataset, data, special, fn, bf, at)
	local __addData
	if type(fn) == 'table' then
		__addData = _getAddDataComplex(fn)
	else
		__addData = _getAddData(fn)
	end
	
	local fireratesType  = type(data.firerates)
	
	-- ファイアレートが可変
	if fireratesType == 'table' then
		if special then
			__addData(dataset, data, data.firerates[4])
		else
			for level, firerate in ipairs(data.firerates) do
				local data2 = aw.shallowCopy(data)
				data2.level = level - 1
				__addData(dataset, data2, firerate)
			end
		end
	
	-- ファイアレートが固定
	elseif fireratesType == 'number' then
		__addData(dataset, data, data.firerates)
	end
end

local function getDataAsCharge(baseData, stat, root, additional, level)
	local charge   = (stat.charge  or root.charge) * (level - 1) / (root.charge_levels - 1)
	local firerate = stat.firerate or root.firerate
	local fullcharge = level == root.charge_levels
	local chargeData = aw.shallowCopy(baseData)
	if fullcharge and stat.damage.charged then
		chargeData.damage = stat.damage.charged
	end
	if type(additional) == 'table' then
		chargeData.firerates = {
			apex.calcRechamberFirerate(firerate, charge + additional[1]),
			apex.calcRechamberFirerate(firerate, charge + additional[2]),
			apex.calcRechamberFirerate(firerate, charge + additional[3]),
			apex.calcRechamberFirerate(firerate, charge + additional[4]),
		}
	else
		chargeData.firerates = apex.calcRechamberFirerate(firerate, charge + additional)
	end
	if fullcharge and stat.damage.headshot_charged then
		chargeData.head = stat.damage.headshot_charged
	end
	if fullcharge and stat.damage.legshot_charged then
		chargeData.legs = stat.damage.legshot_charged
	end
	return chargeData
end

local function createDataset(dataset, stats, res, addData, __debug)
	for name, stat in pairs(stats) do
		local baseData = {
			ammo      = stat.ammo,
			ammoicon  = stat.ammo,
			damage    = stat.damage.base,
			firerates = stat.firerate,
			head      = stat.damage_head_scale,
			legs      = stat.damage_legs_scale,
			level     = -1,
			name      = name,
			pellets   = stat.pellet or 1,
			shortname = stat.localization['Japanese_Short'],
		}
		local special  = aw.stringstarts(stat.ammo, 'special_')
		
		-- Altfire mode
		if type(stat.altfire) == 'table' and aw.isNumberAndGreaterThanZero(stat.altfire.firerate) then
			local burstfireData     = aw.shallowCopy(baseData)
			burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate)
			burstfireData.option    = res.burst
			addData(dataset, burstfireData, special)
			
			local altfireData     = aw.shallowCopy(baseData)
			altfireData.firerates = stat.altfire.firerate
			altfireData.semiauto  = stat.altfire.is_semi_auto == nil and stat.is_semi_auto or stat.altfire.is_semi_auto
			altfireData.option    = altfireData.semiauto and res.single or res.auto
			addData(dataset, altfireData, special)
		
		-- Burst mode
		elseif aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then
			local burstfireData     = aw.shallowCopy(baseData)
			burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate)
			addData(dataset, burstfireData, special)
		
		-- Rechamber fire
		elseif type(stat.rechamber) == 'table' then
			baseData.firerates = {
				apex.calcRechamberFirerate(stat.firerate, stat.rechamber[1]),
				apex.calcRechamberFirerate(stat.firerate, stat.rechamber[2]),
				apex.calcRechamberFirerate(stat.firerate, stat.rechamber[3]),
				apex.calcRechamberFirerate(stat.firerate, stat.rechamber[4]),
			}
			
			-- Chargefire
			if aw.isNumberAndGreaterThanZero(stat.charge) then
				baseData.option = res.nocharge
				addData(dataset, baseData, special)
				
				if stat.charge_levels == 2 then
					local maxData = getDataAsCharge(baseData, stat, stat, stat.rechamber, 2)
					maxData.option = res.maxcharge
					addData(dataset, maxData, special)
				else
					for lvl = 2, stat.charge_levels do
						local chargeData = getDataAsCharge(baseData, stat, stat, stat.rechamber, lvl)
						chargeData.option = aw.getQuantityString(res.charges, lvl - 1)
						addData(dataset, chargeData, special)
					end
				end
			else
				addData(dataset, baseData, special)
			end
		
		elseif aw.isNumberAndGreaterThanZero(stat.rechamber) then
			-- Chargefire
			if aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) then
				if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
					baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber + stat.charge_minimum)
					baseData.option    = res.mincharge
				else
					baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
					baseData.option    = res.nocharge
				end
				addData(dataset, baseData, special)
				
				local maxData = getDataAsCharge(baseData, stat, stat, stat.rechamber, stat.charge_levels)
				maxData.option = res.maxcharge
				addData(dataset, maxData, special)
			
			-- Amped mode
			elseif aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then
				baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
				addData(dataset, baseData, special)
				
				local ampedData    = aw.shallowCopy(baseData)
				ampedData.ammoicon = stat.ammo .. '_amped'
				ampedData.damage   = stat.damage.amped
				ampedData.option   = res.amped
				addData(dataset, ampedData)
			else
				baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.rechamber)
				addData(dataset, baseData, special)
			end
		
		-- Chargefire
		elseif aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) then
			if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
				baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum)
				baseData.option    = res.mincharge
			else
				baseData.option    = res.nocharge
			end
			addData(dataset, baseData, special)
			
			if stat.charge_levels == 2 or stat.charge_levels > 4 then
				local maxData = getDataAsCharge(baseData, stat, stat, 0, stat.charge_levels)
				maxData.option = res.maxcharge
				addData(dataset, maxData, special)
			else
				for lvl = 2, stat.charge_levels do
					local chargeData = getDataAsCharge(baseData, stat, stat, 0, lvl)
					chargeData.option = aw.getQuantityString(res.charges, lvl - 1)
					addData(dataset, chargeData, special)
				end
			end
		
		-- Charge Rifle
		elseif aw.isNumberAndGreaterThanZero(stat.sustained_discharge_duration) then
			baseData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.sustained_discharge_duration)
			addData(dataset, baseData, special, function(val, part, passive)
				return val + apex.calcDamageFromPartAndPassive(stat.damage.beam.base, part, passive) * stat.damage.beam.ticks
			end)
		
		-- Other
		else
			addData(dataset, baseData, special)
		end
		
		-- Revved Up mode
		if aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_revvedup, stat.firerate) then
			local revvedUpData     = aw.shallowCopy(baseData)
			revvedUpData.ammoicon  = stat.ammo .. '_revved_up'
			revvedUpData.firerates = stat.firerate_revvedup
			revvedUpData.option    = res.revvedup
			addData(dataset, revvedUpData, special)
		end
		
		-- Turbocharger
		--[[if (__debug or Hopup.turbocharger.enabled) and type(stat.turbocharger) == 'table' and aw.isNumberAndGreaterThanZero(stat.turbocharger.raise) then
			local turbochargerData = aw.shallowCopy(baseData)
			turbochargerData.hopup = { 'turbocharger' }
			turbochargerData.raise = stat.turbocharger.raise or stat.raise or 0
			addData(dataset, turbochargerData, special)
		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 semiauto
			if stat.selectfire_receiver.is_semi_auto then
				semiauto = stat.selectfire_receiver.is_semi_auto
			else
				semiauto = stat.is_semi_auto
			end
			
			local firerate
			if semiauto then
				local raiseTime = stat.selectfire_receiver.raise or stat.raise or 0
				if raiseTime > 0 then
					firerate = apex.calcRechamberFirerate(stat.selectfire_receiver.firerate, raiseTime)
				else
					firerate = stat.selectfire_receiver.firerate
				end
			else
				firerate = stat.selectfire_receiver.firerate
			end
			
			local selectfireReceiverData     = aw.shallowCopy(baseData)
			selectfireReceiverData.damage    = stat.selectfire_receiver.damage and stat.selectfire_receiver.damage.base or stat.damage.base
			selectfireReceiverData.firerates = firerate
			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
			addData(dataset, selectfireReceiverData, special)
		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, special)
		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.hopup  = { 'hammerpoint_rounds' }
			addData(dataset, hammerpointRoundsData, special, { unsd = function(val)
				return math.floor(stat.hammerpoint_rounds.damage_unshielded_scale * val)
			end })
		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, special, { shld = 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.isNumberAndGreaterThanZero(stat.anvil_receiver.firerate) then
			local anvilReceiverData     = aw.shallowCopy(baseData)
			anvilReceiverData.damage    = stat.anvil_receiver.damage.base
			anvilReceiverData.firerates = stat.anvil_receiver.firerate
			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
			addData(dataset, anvilReceiverData, special)
		end
			
		-- Double Tap Trigger
		if (__debug or Hopup.double_tap_trigger.enabled or special) and type(stat.double_tap_trigger) == 'table' and aw.isNumberAndGreaterThanOrEqualToX(stat.double_tap_trigger.burst_count, 2) then
			local doubleTapTriggerData     = aw.shallowCopy(baseData)
			local delay = stat.double_tap_trigger.burst_delay
			if type(delay) == 'table' then
				doubleTapTriggerData.firerates = {
					apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[1], stat.double_tap_trigger.firerate),
					apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[2], stat.double_tap_trigger.firerate),
					apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[3], stat.double_tap_trigger.firerate),
					apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay[4], stat.double_tap_trigger.firerate),
				}
			else
				doubleTapTriggerData.firerates = apex.calcBurstAverageFirerate(stat.double_tap_trigger.burst_count, delay, stat.double_tap_trigger.firerate)
			end
			doubleTapTriggerData.hopup     = { 'double_tap_trigger' }
			addData(dataset, doubleTapTriggerData, special)
		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)
			if stat.shatter_caps.charge then
				shatterCapsData.charge = stat.shatter_caps.charge
			end
			if stat.shatter_caps.charge_levels then
				shatterCapsData.charge_levels = stat.shatter_caps.charge_levels
			end
			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.option   = nil
			shatterCapsData.pellets  = stat.shatter_caps.pellet
			
			-- Chargefire
			if aw.isNumberAndGreaterThanOrEqualToX(shatterCapsData.charge_levels, 2) and aw.isNumberAndGreaterThanZero(shatterCapsData.charge) then
				if aw.isNumberAndGreaterThanZero(stat.charge_minimum) then
					shatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.charge_minimum)
					shatterCapsData.option    = res.mincharge
				else
					shatterCapsData.option    = res.nocharge
				end
				addData(dataset, shatterCapsData)
				
				local maxShatterCapsData = getDataAsCharge(shatterCapsData, stat.shatter_caps, stat, stat.rechamber or 0, shatterCapsData.charge_levels)
				maxShatterCapsData.option = res.maxcharge
				addData(dataset, maxShatterCapsData)
			else
				addData(dataset, shatterCapsData)
			end
			
			-- Deadeye's Tempo
			if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then
				local deadeyesTempoShatterCapsData = aw.shallowCopy(shatterCapsData)
				if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge_minimum) then
					deadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge_minimum)
				elseif aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.rechamber) then
					deadeyesTempoShatterCapsData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.rechamber)
				end
				deadeyesTempoShatterCapsData.hopup = { 'shatter_caps', 'deadeyes_tempo' }
				
				-- Chargefire
				if aw.isNumberAndGreaterThanOrEqualToX(shatterCapsData.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.charge) and aw.isNumberAndGreaterThanX(stat.shatter_caps.damage.charged, stat.shatter_caps.damage.base) then
					deadeyesTempoShatterCapsData.option = res.mincharge
					addData(dataset, deadeyesTempoShatterCapsData)
					
					local maxDeadeyesTempoShatterCapsData = getDataAsCharge(deadeyesTempoShatterCapsData, stat.shatter_caps, stat, stat.deadeyes_tempo.charge, shatterCapsData.charge_levels)
					maxDeadeyesTempoShatterCapsData.option = res.maxcharge
					addData(dataset, maxDeadeyesTempoShatterCapsData)
				else
					addData(dataset, deadeyesTempoShatterCapsData)
				end
			end
		end
			
		-- Deadeye's Tempo
		if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then
			local deadeyesTempoData = aw.shallowCopy(baseData)
			if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge_minimum) then
				deadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.charge_minimum)
			elseif aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.rechamber) then
				deadeyesTempoData.firerates = apex.calcRechamberFirerate(stat.firerate, stat.deadeyes_tempo.rechamber)
			end
			deadeyesTempoData.hopup = { 'deadeyes_tempo' }
			
			-- Chargefire
			if aw.isNumberAndGreaterThanOrEqualToX(stat.charge_levels, 2) and aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo.charge) and aw.isNumberAndGreaterThanX(stat.damage.charged, stat.damage.base) then
				deadeyesTempoData.option = res.mincharge
				addData(dataset, deadeyesTempoData)
				
				local maxDeadeyesTempoData = getDataAsCharge(deadeyesTempoData, stat, stat, stat.deadeyes_tempo.charge, stat.charge_levels)
				maxDeadeyesTempoData.option = res.maxcharge
				addData(dataset, maxDeadeyesTempoData)
			else
				addData(dataset, deadeyesTempoData, special)
			end
			
			-- Amped mode
			if aw.isNumberAndGreaterThanX(stat.damage.amped, stat.damage.base) then
				local ampedDeadeyesTempoData    = aw.shallowCopy(deadeyesTempoData)
				ampedDeadeyesTempoData.ammoicon = stat.ammo .. '_amped'
				ampedDeadeyesTempoData.damage   = stat.damage.amped
				ampedDeadeyesTempoData.option   = iu.item('シールドセル') .. ' <span class="text-desktoponly">増幅モード</span>'
				addData(dataset, ampedDeadeyesTempoData)
			end
		end
	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 desktopOnlyAndNoLinkObj = { desktopOnly = true, lang = lang, link = '' }
	fnRatio = {
		{ name = inu.gear('backpack', 4, desktopOnlyAndNoLinkObj),   fn = function(a, b) return (7 * a + 5 * b) / 12 end },
		{ name = inu.gear('evo_shield', 1, desktopOnlyAndNoLinkObj), fn = function(a, b) return (2 * a +     b) / 3 end },
		{ name = inu.gear('evo_shield', 2, desktopOnlyAndNoLinkObj), fn = function(a, b) return (4 * a + 3 * b) / 7 end },
		{ name = inu.gear('evo_shield', 3, desktopOnlyAndNoLinkObj), fn = function(a, b) return (    a +     b) / 2 end },
		{ name = inu.gear('evo_shield', 5, desktopOnlyAndNoLinkObj), fn = function(a, b) return (4 * a + 5 * b) / 9 end },
		{ name = res.maxvalue,                                       fn = function(a, b) return math.max(a, b)      end },
	}
	
	local dataset = {}
	createDataset(dataset, stats, res, addData, __debug)
	
	local formatFunction = function(dps)
		return string.format('%.1f', dps)
	end
	local metadata = {
		tableutil.RankCell.new('', 'bodyDPS', 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-right st-mobile-none-right st-mobile-padding0-both',
			headerColspan  = 0,
		}),
		tableutil.HopupCell.new(res.hopup, 'hopup', {
			attributes     = { align = 'left' },
			cellClass      = 'st-mobile-padding0-both',
			headerColspan  = 0,
		}),
		tableutil.ValueCell.new(res.legsshot, 'legsDPS', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.LineValueCell.new(res.bodyshot, 'bodyDPS', {
			startIndex    = 'legsDPS',
			endIndex      = 'lvl1DPS',
			subStartIndex = 'flLgDPS',
			subEndIndex   = 'lvl1DPS',
			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,
			maximumValue  = 400,
			preferredGridCount = 3,
		}),
		tableutil.ValueCell.new(res.headlvl3, 'lvl3DPS', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.ValueCell.new(res.headlvl2, 'lvl2DPS', {
			cellClass   = 'st-desktop',
			footerClass = 'st-desktop',
			format      = formatFunction,
			headerClass = 'st-desktop',
			headerStyle = {
				['min-width'] = '50px',
				['max-width'] = '4em',
			},
		}),
		tableutil.ValueCell.new(res.headlvl1, 'lvl1DPS', {
			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, 'bodyDPS', {
			startIndex    = 'legsDPS',
			endIndex      = 'lvl1DPS',
			subStartIndex = 'flLgDPS',
			subEndIndex   = 'lvl1DPS',
			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,
			maximumValue  = 500,
		}),
	}
	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