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

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

提供:Apex Data
ナビゲーションに移動 検索に移動
(ページの作成:「local p = {} local cfg = mw.loadData('Module:WeaponInfobox/configuration') local function isAllKickOnFireZero(k) return k.stand_hip == 0 and k.stand_ads == 0 and k.…」)
 
(増加量がオール0のケースの実装の不具合を修正)
100行目: 100行目:
-- Hipfire
-- Hipfire
tbl:tag('tr')
local hipfire = tbl:tag('tr')
:tag('th')
:tag('th')
:addClass(spread.state.hip_class)
:addClass(spread.state.hip_class)
123行目: 123行目:
:wikitext(getFormatString(stat.stand_hip))
:wikitext(getFormatString(stat.stand_hip))
:done()
:done()
:tag('td')
if not hideKickOnFire then
:addClass('cell-type-number')
hipfire
:attr('align', 'right')
:tag('td')
:attr('rowspan', 3)
:addClass('cell-type-number')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_hip))
:attr('align', 'right')
:done()
:attr('rowspan', 3)
:tag('td')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_hip))
:addClass('cell-type-number')
:done()
:attr('align', 'right')
:tag('td')
:wikitext(getFormatString(stat.stand_hip + stat.max_kick.stand_hip))
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.stand_hip + stat.max_kick.stand_hip))
end
tbl:tag('tr')
local run = tbl:tag('tr')
:tag('th')
:tag('th')
:wikitext(spread.state.run)
:wikitext(spread.state.run)
143行目: 146行目:
:wikitext(getFormatString(stat.stand_hip_run))
:wikitext(getFormatString(stat.stand_hip_run))
:done()
:done()
:tag('td')
if not hideKickOnFire then
run:tag('td')
:addClass('cell-type-number')
:addClass('cell-type-number')
:attr('align', 'right')
:attr('align', 'right')
:wikitext(getFormatString(stat.stand_hip_run + stat.max_kick.stand_hip))
:wikitext(getFormatString(stat.stand_hip_run + stat.max_kick.stand_hip))
end
tbl:tag('tr')
local sprint = tbl:tag('tr')
:tag('th')
:tag('th')
:wikitext(spread.state.sprint)
:wikitext(spread.state.sprint)
157行目: 162行目:
:wikitext(getFormatString(stat.stand_hip_sprint))
:wikitext(getFormatString(stat.stand_hip_sprint))
:done()
:done()
:tag('td')
if not hideKickOnFire then
sprint:tag('td')
:addClass('cell-type-number')
:addClass('cell-type-number')
:attr('align', 'right')
:attr('align', 'right')
:wikitext(getFormatString(stat.stand_hip_sprint + stat.max_kick.stand_hip))
:wikitext(getFormatString(stat.stand_hip_sprint + stat.max_kick.stand_hip))
end
-- Hipfire while crouching
-- Hipfire while crouching
tbl:tag('tr')
local crouch = tbl:tag('tr')
:tag('th')
:tag('th')
:attr('colspan', 2)
:attr('colspan', 2)
173行目: 180行目:
:wikitext(getFormatString(stat.crouch_hip))
:wikitext(getFormatString(stat.crouch_hip))
:done()
:done()
:tag('td')
:addClass('cell-type-number')
if not hideKickOnFire then
:attr('align', 'right')
crouch
:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_hip))
:tag('td')
:tag('td')
:addClass('cell-type-number')
:addClass('cell-type-number')
:attr('align', 'right')
:attr('align', 'right')
:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_hip))
:wikitext(getFormatString(stat.crouch_hip + stat.max_kick.crouch_hip))
:tag('td')
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.crouch_hip + stat.max_kick.crouch_hip))
end
-- Hipfire in the air
-- Hipfire in the air
tbl:tag('tr')
local air = tbl:tag('tr')
:tag('th')
:tag('th')
:attr('colspan', 2)
:attr('colspan', 2)
193行目: 204行目:
:wikitext(getFormatString(stat.air_hip))
:wikitext(getFormatString(stat.air_hip))
:done()
:done()
:tag('td')
if not hideKickOnFire then
air:tag('td')
:addClass('cell-type-number')
:addClass('cell-type-number')
:attr('align', 'right')
:attr('align', 'right')
201行目: 213行目:
:attr('align', 'right')
:attr('align', 'right')
:wikitext(getFormatString(stat.air_hip + stat.max_kick.air_hip))
:wikitext(getFormatString(stat.air_hip + stat.max_kick.air_hip))
end
-- ADS
-- ADS
206行目: 219行目:
and stat.kick_on_fire.stand_ads == stat.kick_on_fire.crouch_ads
and stat.kick_on_fire.stand_ads == stat.kick_on_fire.crouch_ads
and stat.max_kick.stand_ads == stat.max_kick.crouch_ads then
and stat.max_kick.stand_ads == stat.max_kick.crouch_ads then
tbl:tag('tr')
local ads = tbl:tag('tr')
:tag('th')
:tag('th')
:addClass(spread.state.ads_class)
:addClass(spread.state.ads_class)
223行目: 236行目:
:wikitext(getFormatString(stat.stand_ads))
:wikitext(getFormatString(stat.stand_ads))
:done()
:done()
:tag('td')
if not hideKickOnFire then
:addClass('cell-type-number')
ads
:attr('align', 'right')
:tag('td')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
:addClass('cell-type-number')
:tag('td')
:attr('align', 'right')
:addClass('cell-type-number')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
:attr('align', 'right')
:tag('td')
:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
end
else
else
tbl:tag('tr')
local hipads = tbl:tag('tr')
:tag('th')
:tag('th')
:addClass(spread.state.ads_class)
:addClass(spread.state.ads_class)
249行目: 265行目:
:wikitext(getFormatString(stat.stand_ads))
:wikitext(getFormatString(stat.stand_ads))
:done()
:done()
:tag('td')
if not hideKickOnFire then
:addClass('cell-type-number')
hipads
:attr('align', 'right')
:tag('td')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
:addClass('cell-type-number')
:tag('td')
:attr('align', 'right')
:addClass('cell-type-number')
:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
:attr('align', 'right')
:tag('td')
:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
end
-- ADS while crouching
-- ADS while crouching
tbl:tag('tr')
local crouchads = tbl:tag('tr')
:tag('th')
:tag('th')
:attr('colspan', 2)
:attr('colspan', 2)
269行目: 288行目:
:wikitext(getFormatString(stat.crouch_ads))
:wikitext(getFormatString(stat.crouch_ads))
:done()
:done()
:tag('td')
if not hideKickOnFire then
:addClass('cell-type-number')
crouchads
:attr('align', 'right')
:tag('td')
:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_ads))
:addClass('cell-type-number')
:tag('td')
:attr('align', 'right')
:addClass('cell-type-number')
:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_ads))
:attr('align', 'right')
:tag('td')
:wikitext(getFormatString(stat.crouch_ads + stat.max_kick.crouch_ads))
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.crouch_ads + stat.max_kick.crouch_ads))
end
end
end
-- ADS in the air
-- ADS in the air
tbl:tag('tr')
local airads = tbl:tag('tr')
:tag('th')
:tag('th')
:attr('colspan', 2)
:attr('colspan', 2)
290行目: 312行目:
:wikitext(getFormatString(stat.air_ads))
:wikitext(getFormatString(stat.air_ads))
:done()
:done()
:tag('td')
if not hideKickOnFire then
:addClass('cell-type-number')
airads
:attr('align', 'right')
:tag('td')
:wikitext(getDiffFormatString(stat.kick_on_fire.air_ads))
:addClass('cell-type-number')
:tag('td')
:attr('align', 'right')
:addClass('cell-type-number')
:wikitext(getDiffFormatString(stat.kick_on_fire.air_ads))
:attr('align', 'right')
:tag('td')
:wikitext(getFormatString(stat.air_ads + stat.max_kick.air_ads))
:addClass('cell-type-number')
:attr('align', 'right')
:wikitext(getFormatString(stat.air_ads + stat.max_kick.air_ads))
end
return tbl
return tbl

2021年5月11日 (火) 00:04時点における版

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

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

local function isAllKickOnFireZero(k)
	return k.stand_hip == 0
		and k.stand_ads == 0
		and k.crouch_hip == 0
		and k.crouch_ads == 0
		and k.air_hip == 0
		and k.air_ads == 0
end

local function hasSecondDecimalPlace(num)
	return math.floor(10 * num) ~= 10 * num
end

local function getFormatString1(num)
	return string.format('%.1f°', num)
end

local function getFormatString2(num)
	return string.format('%.2f°', num)
end

local function getDiffFormatString1(num)
	if num <= 0 then
		return '-'
	else
		return string.format('%+.1f°', num)
	end
end

local function getDiffFormatString2(num)
	if num == 0 then
		return '-'
	else
		return string.format('%+.2f°', num)
	end
end

local function getFormatStringFunction(stat)
	if hasSecondDecimalPlace(stat.stand_hip)
	or hasSecondDecimalPlace(stat.stand_hip_run)
	or hasSecondDecimalPlace(stat.stand_hip_sprint)
	or hasSecondDecimalPlace(stat.stand_ads)
	or hasSecondDecimalPlace(stat.crouch_hip)
	or hasSecondDecimalPlace(stat.crouch_ads)
	or hasSecondDecimalPlace(stat.air_hip)
	or hasSecondDecimalPlace(stat.air_ads)
	or hasSecondDecimalPlace(stat.max_kick.stand_hip)
	or hasSecondDecimalPlace(stat.max_kick.stand_ads)
	or hasSecondDecimalPlace(stat.max_kick.crouch_hip)
	or hasSecondDecimalPlace(stat.max_kick.crouch_ads)
	or hasSecondDecimalPlace(stat.max_kick.air_hip)
	or hasSecondDecimalPlace(stat.max_kick.air_ads) then
		return getFormatString2
	else
		return getFormatString1
	end
end

local function getDiffFormatStringFunction(stat)
	if hasSecondDecimalPlace(stat.kick_on_fire.stand_hip)
	or hasSecondDecimalPlace(stat.kick_on_fire.stand_ads)
	or hasSecondDecimalPlace(stat.kick_on_fire.crouch_hip)
	or hasSecondDecimalPlace(stat.kick_on_fire.crouch_ads)
	or hasSecondDecimalPlace(stat.kick_on_fire.air_hip)
	or hasSecondDecimalPlace(stat.kick_on_fire.air_ads) then
		return getDiffFormatString2
	else
		return getDiffFormatString1
	end
end

function p.renderSpread(stat, lang)
	local spread = cfg[lang].spread
	local getFormatString = getFormatStringFunction(stat)
	local getDiffFormatString = getDiffFormatStringFunction(stat)
	local tbl = mw.html.create('table')
		:addClass('intable')
		:css('font-size', '92%')
	
	local header = tbl:tag('tr')
		:tag('th')
			:attr('colspan', 3)
			:wikitext(spread.state.name)
			:done()
		:tag('th')
			:wikitext(spread.first_shot)
			:done()
	
	local hideKickOnFire = isAllKickOnFireZero(stat.kick_on_fire)
	if not hideKickOnFire then
		header:tag('th')
				:wikitext(spread.increment)
				:done()
			:tag('th')
				:wikitext(spread.maximum)
	end
	
	-- Hipfire
	local hipfire = tbl:tag('tr')
		:tag('th')
			:addClass(spread.state.hip_class)
			:attr('rowspan', 5)
			:tag('span')
				:wikitext(spread.state.hip)
				:done()
			:done()
		:tag('th')
			:addClass(spread.state.stand_class)
			:attr('rowspan', 3)
			:tag('span')
				:wikitext(spread.state.stand)
				:done()
			:done()
		:tag('th')
			:wikitext(spread.state.still)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.stand_hip))
			:done()
	if not hideKickOnFire then
		hipfire
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:attr('rowspan', 3)
				:wikitext(getDiffFormatString(stat.kick_on_fire.stand_hip))
				:done()
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.stand_hip + stat.max_kick.stand_hip))
	end
	
	local run = tbl:tag('tr')
		:tag('th')
			:wikitext(spread.state.run)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.stand_hip_run))
			:done()
	if not hideKickOnFire then
		run:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.stand_hip_run + stat.max_kick.stand_hip))
	end
	
	local sprint = tbl:tag('tr')
		:tag('th')
			:wikitext(spread.state.sprint)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.stand_hip_sprint))
			:done()
	if not hideKickOnFire then
		sprint:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.stand_hip_sprint + stat.max_kick.stand_hip))
	end
	
	-- Hipfire while crouching
	local crouch = tbl:tag('tr')
		:tag('th')
			:attr('colspan', 2)
			:wikitext(spread.state.crouch)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.crouch_hip))
			:done()
		
	if not hideKickOnFire then
		crouch
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_hip))
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.crouch_hip + stat.max_kick.crouch_hip))
	end
	
	-- Hipfire in the air
	local air = tbl:tag('tr')
		:tag('th')
			:attr('colspan', 2)
			:wikitext(spread.state.air)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.air_hip))
			:done()
	if not hideKickOnFire then
		air:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getDiffFormatString(stat.kick_on_fire.air_hip))
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.air_hip + stat.max_kick.air_hip))
	end
	
	-- ADS
	if stat.stand_ads == stat.crouch_ads
		and stat.kick_on_fire.stand_ads == stat.kick_on_fire.crouch_ads
		and stat.max_kick.stand_ads == stat.max_kick.crouch_ads then
		local ads = tbl:tag('tr')
			:tag('th')
				:addClass(spread.state.ads_class)
				:attr('rowspan', 3)
				:tag('span')
					:wikitext(spread.state.ads)
					:done()
				:done()
			:tag('th')
				:attr('colspan', 2)
				:wikitext(spread.state.standcrouch)
				:done()
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.stand_ads))
				:done()
		if not hideKickOnFire then
			ads
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
		end
	else
		local hipads = tbl:tag('tr')
			:tag('th')
				:addClass(spread.state.ads_class)
				:attr('rowspan', 3)
				:tag('span')
					:wikitext(spread.state.ads)
					:done()
				:done()
			:tag('th')
				:attr('colspan', 2)
				:wikitext(spread.state.stand)
				:done()
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.stand_ads))
				:done()
		if not hideKickOnFire then
			hipads
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getDiffFormatString(stat.kick_on_fire.stand_ads))
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getFormatString(stat.stand_ads + stat.max_kick.stand_ads))
		end
		
		-- ADS while crouching
		local crouchads = tbl:tag('tr')
			:tag('th')
				:attr('colspan', 2)
				:wikitext(spread.state.crouch)
				:done()
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.crouch_ads))
				:done()
		if not hideKickOnFire then
			crouchads
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getDiffFormatString(stat.kick_on_fire.crouch_ads))
				:tag('td')
					:addClass('cell-type-number')
					:attr('align', 'right')
					:wikitext(getFormatString(stat.crouch_ads + stat.max_kick.crouch_ads))
		end
	end
	
	-- ADS in the air
	local airads = tbl:tag('tr')
		:tag('th')
			:attr('colspan', 2)
			:wikitext(spread.state.air)
			:done()
		:tag('td')
			:addClass('cell-type-number')
			:attr('align', 'right')
			:wikitext(getFormatString(stat.air_ads))
			:done()
	if not hideKickOnFire then
		airads
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getDiffFormatString(stat.kick_on_fire.air_ads))
			:tag('td')
				:addClass('cell-type-number')
				:attr('align', 'right')
				:wikitext(getFormatString(stat.air_ads + stat.max_kick.air_ads))
	end
	
	return tbl
end

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

return p