Модуль:FirearmsStats: различия между версиями

мНет описания правки
мНет описания правки
Строка 9: Строка 9:
local stamina = tonumber(frame.args.stamina) or 0
local stamina = tonumber(frame.args.stamina) or 0
local blunt = tonumber(frame.args.blunt) or 0
local blunt = tonumber(frame.args.blunt) or 0
local slash = tonumber(frame.args.slash) or 0
local piercing = tonumber(frame.args.piercing) or 0
local piercing = tonumber(frame.args.piercing) or 0
local heat = tonumber(frame.args.heat) or 0
local heat = tonumber(frame.args.heat) or 0
local radiation = tonumber(frame.args.radiation) or 0
local radiation = tonumber(frame.args.radiation) or 0
local caustic = tonumber(frame.args.caustic) or 0
local structural = tonumber(frame.args.structural) or 0
local structural = tonumber(frame.args.structural) or 0


Строка 23: Строка 25:
-- Расчет DPS и data-sort-value (без учета structural и stamina)
-- Расчет DPS и data-sort-value (без учета structural и stamina)
local dps = fireRate * (blunt + piercing + heat + radiation)
local dps = fireRate * (blunt + piercing + heat + radiation)
local dataSort = blunt + piercing + heat + radiation
local dataSort = blunt + slash + piercing + heat + radiation + caustic


-- Формирование строки таблицы
-- Формирование строки таблицы
Строка 32: Строка 34:
out = out .. '<br>' .. frame:preprocess('{{#invoke:Entity Lookup|getname|' .. itemId .. '}}') .. '\n'
out = out .. '<br>' .. frame:preprocess('{{#invoke:Entity Lookup|getname|' .. itemId .. '}}') .. '\n'
-- Урон (выводим только непустые значения)
-- Урон (выводятся только непустые значения)
out = out .. '|data-sort-value=' .. dataSort .. '|\n'
out = out .. '|data-sort-value=' .. dataSort .. '|\n'
Строка 43: Строка 45:
if blunt > 0 then
if blunt > 0 then
out = out .. ': <span style="color:crimson"><b>' .. blunt .. '</b></span> Ушибы\n'
out = out .. ': <span style="color:crimson"><b>' .. blunt .. '</b></span> Ушибы\n'
end
if slash > 0 then
out = out .. ': <span style="color:indianred"><b>' .. slash .. '</b></span> Режущие\n'
end
end
if piercing > 0 then
if piercing > 0 then
Строка 52: Строка 57:
if radiation > 0 then
if radiation > 0 then
out = out .. ': <span style="color:limegreen"><b>' .. radiation .. '</b></span> Радиация\n'
out = out .. ': <span style="color:limegreen"><b>' .. radiation .. '</b></span> Радиация\n'
end
if caustic > 0 then
out = out .. ': <span style="color:plum"><b>' .. caustic .. '</b></span> Кислотные\n'
end
end
if structural > 0 then
if structural > 0 then
Строка 59: Строка 67:
-- Параметры  
-- Параметры  
out = out .. '|style="color:DodgerBlue"|<b>' .. fireRate .. '</b>\n'
out = out .. '|style="color:DodgerBlue"|<b>' .. fireRate .. '</b>\n'
out = out .. '|style="color:Yellow"|<b>' .. dps .. '</b>\n' -- Расчетное значение DPS
out = out .. '|style="color:Yellow"|<b>' .. dps .. '</b>\n'
out = out .. '|style="color:Aquamarine"|<b>' .. ammunition .. '</b>\n'
out = out .. '|style="color:Aquamarine"|<b>' .. ammunition .. '</b>\n'
out = out .. '|style="color:#77c1d9"|<b>' .. caliber .. '</b>\n'
out = out .. '|style="color:#77c1d9"|<b>' .. caliber .. '</b>\n'