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

мНет описания правки
мНет описания правки
Строка 19: Строка 19:


     local description = frame.args.description or "Описание отсутствует"
     local description = frame.args.description or "Описание отсутствует"
     local location = frame.args.location or "Неизвестно"
     local location = frame.args.location or ""


     -- Расчет 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 + piercing + heat + radiation


     -- Формирование строки таблицы
     -- Формирование строки таблицы
Строка 32: Строка 32:
     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' ..
     if damage ~= "" then
                '' .. damage .. '\n' ..
        out = out .. '|data-sort-value=' .. dataSort .. '|\n' .. damage .. '\n'
                ': <span style="color:DodgerBlue"><b>' .. stamina .. '</b></span> Выносливость\n' ..
    end
                ': <span style="color:crimson"><b>' .. blunt .. '</b></span> Ушибы\n' ..
    if stamina > 0 then
                ': <span style="color:darksalmon"><b>' .. piercing .. '</b></span> Уколы\n' ..
        out = out .. ': <span style="color:DodgerBlue"><b>' .. stamina .. '</b></span> Выносливость\n'
                ': <span style="color:orange"><b>' .. heat .. '</b></span> Термические\n' ..
    end
                ': <span style="color:limegreen"><b>' .. radiation .. '</b></span> Радиация\n' ..
    if blunt > 0 then
                ': <span style="color:DarkGray"><b>' .. structural .. '</b></span> Структурные\n'
        out = out .. ': <span style="color:crimson"><b>' .. blunt .. '</b></span> Ушибы\n'
    end
    if piercing > 0 then
        out = out .. ': <span style="color:darksalmon"><b>' .. piercing .. '</b></span> Уколы\n'
    end
    if heat > 0 then
        out = out .. ': <span style="color:orange"><b>' .. heat .. '</b></span> Термические\n'
    end
    if radiation > 0 then
        out = out .. ': <span style="color:limegreen"><b>' .. radiation .. '</b></span> Радиация\n'
    end
    if structural > 0 then
        out = out .. ': <span style="color:DarkGray"><b>' .. structural .. '</b></span> Структурные\n'
    end


     -- Параметры  
     -- Параметры  
Строка 48: Строка 61:
     out = out .. '|style="color:#77c1d9"|<b>' .. caliber .. '</b>\n'
     out = out .. '|style="color:#77c1d9"|<b>' .. caliber .. '</b>\n'


     -- Описание и местоположение
     -- Описание
     out = out .. '|\n' .. description .. '\n'
     out = out .. '|\n' .. description .. '\n'
     out = out .. '|\n' .. frame:preprocess('{{SlideMenu|overlay|color=#e1f6ff|title=Список [[File:Examine.svg.192dpi.png|24x24px]]|content=<p></p>' .. location .. '}}\n')
 
     -- Местоположение
    if location ~= "" then
        out = out .. '|\n' .. frame:preprocess('{{SlideMenu|overlay|color=#e1f6ff|title=Список [[File:Examine.svg.192dpi.png|24x24px]]|content=<p></p>' .. location .. '}}\n')
    else
        out = out .. '|\n' .. frame:preprocess('{{FrameText|color=#82d1c4|content=Нет гарантированных мест спавна}}\n')
    end
 
     out = out .. '|-\n'
     out = out .. '|-\n'