🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:StatTable/Firerate」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local aw = require('Module:Utility/Library') local apex = require('Module:Utility/ApexLibrary') local iu = require('Module:Utility/Image') local tableu…」) |
(射撃モードのリソースを外部モジュールを参照するように変更) |
||
(同じ利用者による、間の11版が非表示) | |||
1行目: | 1行目: | ||
local aw | local aw = require('Module:Utility/Library') | ||
local apex | local apex = require('Module:Utility/ApexLibrary') | ||
local iu | local iu = require('Module:Utility/Image') | ||
local tableutil = require('Module:Utility/TableUtil/Apex') | local tableutil = require('Module:Utility/TableUtil/Apex') | ||
local Hopup | local Hopup = mw.loadData('Module:Stat/Hopup') | ||
local configuration = mw.loadData('Module:StatTable/configuration') | |||
local getArgs -- lazily initialized | local getArgs -- lazily initialized | ||
local function addData(dataset, data, res, variableRate) | |||
local fireratesType = type(data.firerates) | |||
local function addData(dataset, data | |||
local fireratesType = type(firerates) | |||
if fireratesType == 'table' then | if fireratesType == 'table' then | ||
-- ショットガンボルトがつく場合 | -- ショットガンボルトがつく場合 | ||
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 | else | ||
data.firerate = firerates | data.firerate = data.firerates | ||
table.insert(dataset, data) | table.insert(dataset, data) | ||
end | 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 chargeData = aw.shallowCopy(baseData) | |||
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 | |||
return chargeData | |||
end | end | ||
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行目: | 58行目: | ||
ammo = stat.ammo, | ammo = stat.ammo, | ||
ammoicon = stat.ammo, | ammoicon = stat.ammo, | ||
firerates = stat.firerate, | |||
level = -1, | level = -1, | ||
name = name, | name = name, | ||
shortname = stat.localization['Japanese_Short'], | shortname = stat.localization['Japanese_Short'], | ||
} | } | ||
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 | if aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then | ||
local burstfireData = aw.shallowCopy(baseData) | |||
burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) | |||
burstfireData.option = res.burstavg | |||
addData(dataset, burstfireData, res) | |||
local maxData = aw.shallowCopy(baseData) | |||
local maxData | maxData.firerates = stat.firerate | ||
maxData.option = res.burst | maxData.option = res.burst | ||
addData(dataset, maxData | addData(dataset, maxData, res) | ||
end | end | ||
local altfireData | 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 | 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 | local burstfireData = aw.shallowCopy(baseData) | ||
burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) | |||
addData(dataset, | burstfireData.option = res.burstavg | ||
addData(dataset, burstfireData, res) | |||
local maxData = aw.shallowCopy(baseData) | |||
maxData.firerates = stat.firerate | |||
maxData.option = res.burst | |||
addData(dataset, maxData, res) | |||
-- 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) | |||
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) | |||
local maxData | if stat.charge_levels == 2 or stat.charge_levels > 4 then | ||
maxData.option = res. | local maxData = getDataAsCharge(baseData, stat, stat, 0, stat.charge_levels) | ||
addData(dataset, maxData | 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 | |||
-- Variable firerate | |||
elseif aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_maximum, stat.firerate) then | |||
baseData.option = res.minfire | |||
addData(dataset, baseData, special) | |||
local maxData = aw.shallowCopy(baseData) | |||
maxData.firerates = stat.firerate_maximum | |||
maxData.option = res.maxfire | |||
addData(dataset, maxData, res) | |||
-- Other | -- Other | ||
else | else | ||
addData(dataset, baseData | addData(dataset, baseData, res) | ||
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 | local revvedUpData = aw.shallowCopy(baseData) | ||
revvedUpData.ammoicon = baseData.ammo .. '_revved_up' | revvedUpData.ammoicon = baseData.ammo .. '_revved_up' | ||
revvedUpData.option | revvedUpData.firerates = stat.firerate_revvedup | ||
revvedUpData.option = res.revvedup | |||
addData(dataset, revvedUpData, res) | |||
end | |||
-- Turbocharger | |||
if (__debug or Hopup.turbocharger.enabled) and type(stat.turbocharger) == 'table' then | |||
if aw.isNumberAndGreaterThanX(stat.turbocharger.firerate, stat.firerate) then | |||
local turbochargerMinData = aw.shallowCopy(baseData) | |||
turbochargerMinData.firerates = stat.turbocharger.firerate | |||
turbochargerMinData.hopup = { 'turbocharger' } | |||
turbochargerMinData.option = res.minfire | |||
addData(dataset, turbochargerMinData, res) | |||
end | |||
if aw.isNumberAndGreaterThanZero(stat.firerate_maximum) and aw.isNumberAndGreaterThanX(stat.turbocharger.firerate_maximum, stat.firerate_maximum) then | |||
local turbochargerMaxData = aw.shallowCopy(baseData) | |||
turbochargerMaxData.firerates = stat.turbocharger.firerate_maximum | |||
turbochargerMaxData.hopup = { 'turbocharger' } | |||
turbochargerMaxData.option = res.maxfire | |||
addData(dataset, turbochargerMaxData, res) | |||
end | |||
end | end | ||
-- Selectfire Receiver | -- Selectfire Receiver | ||
if ( | 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 | selectfireReceiverData.hopup = { 'selectfire_receiver' } | ||
addData(dataset, selectfireReceiverData, res) | |||
end | end | ||
-- Anvil Receiver | -- Anvil Receiver | ||
if ( | 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.hopup = { 'anvil_receiver' } | anvilReceiverData.firerates = stat.anvil_receiver.firerate | ||
addData(dataset, anvilReceiverData | anvilReceiverData.hopup = { 'anvil_receiver' } | ||
addData(dataset, anvilReceiverData, res) | |||
end | end | ||
-- Double Tap Trigger | -- Double Tap Trigger | ||
if ( | 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) | local doubleTapTriggerData = aw.shallowCopy(baseData) | ||
doubleTapTriggerData.hopup = { 'double_tap_trigger' } | local delay = stat.double_tap_trigger.burst_delay | ||
doubleTapTriggerData.option = res. | if type(delay) == 'table' then | ||
addData(dataset, doubleTapTriggerData | 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' } | |||
doubleTapTriggerData.option = res.burstavg | |||
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 | local maxDoubleTapTriggerData = aw.shallowCopy(doubleTapTriggerData) | ||
maxDoubleTapTriggerData.option = res.burst | maxDoubleTapTriggerData.firerates = stat.double_tap_trigger.firerate | ||
addData(dataset, maxDoubleTapTriggerData | maxDoubleTapTriggerData.option = res.burst | ||
addData(dataset, maxDoubleTapTriggerData, res) | |||
end | end | ||
end | end | ||
-- Deadeye's Tempo | -- Deadeye's Tempo | ||
if ( | if (__debug or Hopup.deadeyes_tempo.enabled) and type(stat.deadeyes_tempo) == 'table' then | ||
local deadeyesTempoData = aw.shallowCopy(baseData) | 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' } | deadeyesTempoData.hopup = { 'deadeyes_tempo' } | ||
if aw.isNumberAndGreaterThanZero(stat.deadeyes_tempo. | |||
deadeyesTempoData.option = res. | -- 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 | end | ||
end | end | ||
end | end | ||
181行目: | 279行目: | ||
tableutil.RankCell.new('', 'firerate', true), | tableutil.RankCell.new('', 'firerate', true), | ||
tableutil.AmmoCell.new('', 'ammoicon', { | tableutil.AmmoCell.new('', 'ammoicon', { | ||
attributes | attributes = { align = 'center' }, | ||
headerStyle | cellClass = 'st-desktop', | ||
footerClass = 'st-desktop', | |||
headerClass = 'st-desktop', | |||
headerStyle = { width = '36px' }, | |||
}), | }), | ||
tableutil.WeaponNameCell.new(res.weaponname, 'name', { | tableutil.WeaponNameCell.new(res.weaponname, 'name', { | ||
195行目: | 296行目: | ||
ammoIndex = 'ammo', | ammoIndex = 'ammo', | ||
attributes = { align = 'left' }, | attributes = { align = 'left' }, | ||
cellClass = 'st-dashed- | 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 = ' | cellClass = 'st-mobile-padding0-both', | ||
headerColspan = 0, | headerColspan = 0, | ||
}), | }), | ||
tableutil.LineValueCell.new(res.firerate, 'firerate', { | tableutil.LineValueCell.new(res.firerate, 'firerate', { | ||
cellClass = 'st-mobile-graph st-mobile-textshadow', | cellClass = 'st-mobile-graph st-mobile-medium st-mobile-textshadow st-mobile-last', | ||
footerClass = 'st-mobile-axis', | footerClass = 'st-mobile-axis st-mobile-last', | ||
format = function(val) | format = function(val) | ||
return string.format('%.2f', val) | if val >= 10 then | ||
return string.format('%.2f', val) | |||
else | |||
return string.format('%.3f', val) | |||
end | |||
end, | end, | ||
headerClass = 'st-mobile-last', | |||
headerStyle = { | headerStyle = { | ||
['min-width'] = ' | ['min-width'] = '50px', | ||
['max-width'] = ' | ['max-width'] = '6em', | ||
}, | }, | ||
preferredGridCount = 3, | preferredGridCount = 3, | ||
}), | }), | ||
221行目: | 326行目: | ||
headerClass = 'st-desktop', | headerClass = 'st-desktop', | ||
headerStyle = { | headerStyle = { | ||
['min-width'] = ' | ['min-width'] = '200px', | ||
}, | }, | ||
maximumValue = 25, | maximumValue = 25, | ||
}), | }), | ||
} | } | ||
local node = tableutil.createTable(dataset, metadata) | local node = tableutil.createTable(dataset, metadata) | ||
return tostring(node) | return tostring(node) | ||
238行目: | 341行目: | ||
args = getArgs(frame) | args = getArgs(frame) | ||
return p._main(args) | return p._main(args, false) | ||
end | end | ||
return p | return p |
2021年9月10日 (金) 18:33時点における最新版
このモジュールについての説明文ページを モジュール: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 configuration = mw.loadData('Module:StatTable/configuration') local getArgs -- lazily initialized local function addData(dataset, data, res, variableRate) local fireratesType = type(data.firerates) if fireratesType == 'table' then -- ショットガンボルトがつく場合 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 -- ショットガンボルトがつかない場合 else data.firerate = data.firerates table.insert(dataset, data) 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 chargeData = aw.shallowCopy(baseData) 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 return chargeData 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 = stat.firerate, 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 if aw.isNumberAndGreaterThanOrEqualToX(stat.burst_count, 2) then local burstfireData = aw.shallowCopy(baseData) burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) burstfireData.option = res.burstavg addData(dataset, burstfireData, res) 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 local burstfireData = aw.shallowCopy(baseData) burstfireData.firerates = apex.calcBurstAverageFirerate(stat.burst_count, stat.burst_delay, stat.firerate) burstfireData.option = res.burstavg addData(dataset, burstfireData, res) local maxData = aw.shallowCopy(baseData) maxData.firerates = stat.firerate maxData.option = res.burst addData(dataset, maxData, res) -- 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) 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 -- Variable firerate elseif aw.isNumberAndGreaterThanOrEqualToX(stat.firerate_maximum, stat.firerate) then baseData.option = res.minfire addData(dataset, baseData, special) local maxData = aw.shallowCopy(baseData) maxData.firerates = stat.firerate_maximum maxData.option = res.maxfire addData(dataset, maxData, res) -- Other else addData(dataset, baseData, res) 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 = res.revvedup addData(dataset, revvedUpData, res) end -- Turbocharger if (__debug or Hopup.turbocharger.enabled) and type(stat.turbocharger) == 'table' then if aw.isNumberAndGreaterThanX(stat.turbocharger.firerate, stat.firerate) then local turbochargerMinData = aw.shallowCopy(baseData) turbochargerMinData.firerates = stat.turbocharger.firerate turbochargerMinData.hopup = { 'turbocharger' } turbochargerMinData.option = res.minfire addData(dataset, turbochargerMinData, res) end if aw.isNumberAndGreaterThanZero(stat.firerate_maximum) and aw.isNumberAndGreaterThanX(stat.turbocharger.firerate_maximum, stat.firerate_maximum) then local turbochargerMaxData = aw.shallowCopy(baseData) turbochargerMaxData.firerates = stat.turbocharger.firerate_maximum turbochargerMaxData.hopup = { 'turbocharger' } turbochargerMaxData.option = res.maxfire addData(dataset, turbochargerMaxData, res) end 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) 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' } doubleTapTriggerData.option = res.burstavg 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 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 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-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.LineValueCell.new(res.firerate, 'firerate', { cellClass = 'st-mobile-graph st-mobile-medium st-mobile-textshadow st-mobile-last', footerClass = 'st-mobile-axis st-mobile-last', format = function(val) if val >= 10 then return string.format('%.2f', val) else return string.format('%.3f', val) end end, headerClass = 'st-mobile-last', headerStyle = { ['min-width'] = '50px', ['max-width'] = '6em', }, 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