(Utworzono nową stronę "local p = {} local data = require("Module:Datatable") local mathOps = require("Module:MathOps") local utils = require("Module:Utils") local frame = mw.getCurrentFrame()...") |
Nie podano opisu zmian |
||
(Nie pokazano 7 pośrednich wersji utworzonych przez tego samego użytkownika) | |||
Linia 4: | Linia 4: | ||
local utils = require("Module:Utils") |
local utils = require("Module:Utils") |
||
local frame = mw.getCurrentFrame() |
local frame = mw.getCurrentFrame() |
||
+ | local defaultSpeed = 4 --m/s | 100% |
||
local bar = "|" -- code for | |
local bar = "|" -- code for | |
||
local nl = "\n" |
local nl = "\n" |
||
+ | local pg = "<p>" --paragraph |
||
+ | local ntl = "|-" |
||
+ | |||
+ | local strings = { |
||
+ | file = "Plik", |
||
+ | killers = "Zabójcy", |
||
+ | the = "", |
||
+ | unknownKiller = "UnknownKiller", |
||
+ | realName = "Nazwa", |
||
+ | noName = "Brak", --When the killer doesn't have the real name (ex. Demogorgon) |
||
+ | altName = "Alias", |
||
+ | gender = "Płeć", |
||
+ | nationality = "Narodowość", |
||
+ | realm = "Lokacja", --link |
||
+ | power = "Moc", --link |
||
+ | powerType = "Typ Mocy [[Atak|Ataku]]", |
||
+ | spAttackTrue = "Specjalny Atak", |
||
+ | spAttackFalse = "Podstawowy Atak", |
||
+ | weapon = "Broń", |
||
+ | speed = "Prędkość Ruchu", --iconlink |
||
+ | altSpeed = "Alternatywna Prędkość ruchu", |
||
+ | metres = "metrów", |
||
+ | m = "m", --abbreviation of metres |
||
+ | terror = "Zasięg Terroru", --iconlink |
||
+ | lullabyRadius = "Zasięg [[Kołysanka|Kołysanki]]", |
||
+ | height = "Wzrost", --image |
||
+ | tall = "Wysoki", |
||
+ | avg = "Średni", |
||
+ | dlc = "DLC", |
||
+ | actor = "Aktor Głosowy", |
||
+ | breathing = "Oddech", |
||
+ | altBreathing = "Alternatywny Oddech", |
||
+ | menuMusic = "Muzyka Menu", |
||
+ | terrorMusic = "Muzyka Zasięgu Terroru", |
||
+ | lullaby = "Kołysanka", |
||
+ | lullabies = "Kołysanki", |
||
+ | |||
+ | mps = "m/s", |
||
+ | err = "Error" |
||
+ | } |
||
function p.getCountOfKillers() |
function p.getCountOfKillers() |
||
return utils.getCount("killer") |
return utils.getCount("killer") |
||
+ | end |
||
+ | |||
+ | function getKillerIndexById(id) --not used |
||
+ | for i, s in ipairs(killers) do |
||
+ | if s.id == id then return i end |
||
+ | end |
||
+ | return 0 |
||
+ | end |
||
+ | |||
+ | function getKillerIdByName(name) |
||
+ | for _, killer in ipairs(killers) do |
||
+ | if killer.realName ~= nil then |
||
+ | if killer.realName == name then |
||
+ | return killer.id |
||
+ | end |
||
+ | else |
||
+ | if killer.name == name then -- ex.Demogorgon without a real name |
||
+ | return killer.id |
||
+ | end |
||
+ | end |
||
+ | end |
||
+ | |||
+ | return 0 |
||
+ | end |
||
+ | |||
+ | function p.resolveKillerCharTable(name) |
||
+ | name = utils.resolveParameter(name) |
||
+ | killerId = getKillerIdByName(name) |
||
+ | killer = utils.getCharacterById(killerId, killers) |
||
+ | reuslt = "" |
||
+ | |||
+ | if type(killer) ~= "table" then return killer end |
||
+ | |||
+ | result = |
||
+ | '{| class = "infoboxtable"' .. nl .. |
||
+ | ntl ..' class = "infoboxTitle" | ' .. nl .. |
||
+ | '! class = "center bold" colspan = 2 | ' .. strings.the .. killer.name .. nl .. --changed, because in polish we don't use determiners -Yupi |
||
+ | ntl .. nl .. |
||
+ | |||
+ | -- '<tabber>' .. |
||
+ | -- '|-|First=' .. |
||
+ | -- 'First tab sample text.' .. |
||
+ | -- '|-|Second=' .. |
||
+ | -- 'Second tab content goes here. ' .. |
||
+ | -- '|-|Third Tab Title=' .. |
||
+ | -- 'Third tab content goes here.' .. |
||
+ | -- '</tabber>' .. |
||
+ | |||
+ | '! class = "center" colspan = 2 | [[' .. strings.file .. ':' .. resolveKillerPortraitImageFileName(killer) .. '.png|150px]]' .. nl .. |
||
+ | ntl .. nl |
||
+ | if killer.realName ~= nil then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.realName .. ' || class = "valueColumn" | ' .. (killer.realName or strings.noName) .. nl .. ntl .. nl |
||
+ | end |
||
+ | if killer.altName ~= nil then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.altName .. ' || class = "valueColumn italic" | ' .. resolveAltName(killer) .. nl .. ntl .. nl |
||
+ | end |
||
+ | result = result .. |
||
+ | '| class = "titleColumn" | ' .. strings.gender .. ' || class = "valueColumn" | ' .. utils.resolveGender(killer.gender) .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn" | ' .. strings.nationality .. ' || class = "valueColumn" | ' .. killer.nationality .. nl .. |
||
+ | ntl .. nl |
||
+ | if killer.realm ~= nil or killer.dlc ~= nil then |
||
+ | local killerRealm = resolveKillerRealm(killer) |
||
+ | if killerRealm ~= 0 then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.realm .. ' || class = "valueColumn" | [[' .. killerRealm .. ']] ' .. nl .. ntl .. nl |
||
+ | end |
||
+ | end |
||
+ | result = result .. |
||
+ | '| class = "titleColumn" | ' .. strings.power .. ' || class = "valueColumn" | [[' .. killer.power .. ']]' .. nl .. |
||
+ | ntl .. nl |
||
+ | if killer.specialAttack ~= nil then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.powerType .. ' || class = "valueColumn" | ' .. resolvePowerAttack(killer) .. nl .. ntl .. nl |
||
+ | end |
||
+ | result = result .. |
||
+ | '| class = "titleColumn" | ' .. strings.weapon .. ' || class = "valueColumn" | [[' .. killer.weapon .. ']]' .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn" | ' .. strings.speed .. ' || class = "valueColumn" | ' .. resolveKillerSpeed(killer) .. nl .. |
||
+ | ntl .. nl |
||
+ | if killer.altSpeed ~= nil then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.altSpeed .. ' || class = "valueColumn" | ' .. resolveAltSpeed(killer) .. nl .. ntl .. nl |
||
+ | end |
||
+ | result = result .. |
||
+ | '| class = "titleColumn" | ' .. strings.terror .. ' || class = "valueColumn" | ' .. resolveTerrorRadius(killer) .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn" | ' .. strings.height .. ' || class = "valueColumn" | ' .. resolveHeight(killer) .. nl .. |
||
+ | ntl .. nl |
||
+ | if killer.dlc ~= nil then |
||
+ | result = result .. '| class = "titleColumn" | ' .. strings.dlc .. ' || class = "valueColumn" | [[' .. getDlcById(killer.dlc).name .. ']] ' .. nl .. ntl .. nl |
||
+ | end |
||
+ | result = result .. |
||
+ | '| class = "titleColumn" | ' .. strings.actor .. ' || class = "valueColumn" | ' .. (killer.actor or strings.uknownActor) .. nl .. |
||
+ | --TODO Check all music existence, this should be in separate table, Twinsuse Twins as a reference |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn center" colspan = 2 | ' .. strings.breathing .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "valueColumn" | ' .. "Breathing" .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn center" colspan = 2 | ' .. strings.menuMusic .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "valueColumn" | ' .. "Menu Music" .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn center" colspan = 2 | ' .. strings.terrorMusic .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "valueColumn" | ' .. "Terror Radius Music" .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "titleColumn center" colspan = 2 | ' .. strings.lullaby .. nl .. |
||
+ | ntl .. nl .. |
||
+ | '| class = "valueColumn" | ' .. "Lullaby" .. nl .. |
||
+ | '|}' |
||
+ | |||
+ | |||
+ | mw.log(result) |
||
+ | return result |
||
+ | |||
+ | |||
+ | end |
||
+ | |||
+ | function resolveKillerPortraitImageFileName(killer) |
||
+ | local fileConst = "_charSelect_portrait" |
||
+ | return "K" .. string.format("%02d", killer.id) .. fileConst |
||
+ | end |
||
+ | |||
+ | function resolveAltName(killer) |
||
+ | if type(killer.altName) == "string" then return '"' .. killer.altName .. '"' |
||
+ | elseif type(killer.altName) == "table" then |
||
+ | local result = "" |
||
+ | for i, name in ipairs(killer.altName) do |
||
+ | result = result .. '"' .. name .. '"' |
||
+ | if i < #killer.altName then |
||
+ | result = result .. nl |
||
+ | end |
||
+ | end |
||
+ | return result |
||
+ | end |
||
+ | |||
+ | return strings.err |
||
+ | end |
||
+ | |||
+ | function resolvePowerAttack(killer) |
||
+ | result = "" |
||
+ | |||
+ | if killer.specialAttack then |
||
+ | result = strings.spAttackTrue |
||
+ | else |
||
+ | result = strings.spAttackFalse |
||
+ | end |
||
+ | |||
+ | if killer.altAttackNote ~= nil then |
||
+ | result = result .. nl .. "(" .. killer.altAttackNote .. ")" |
||
+ | end |
||
+ | |||
+ | return result |
||
+ | end |
||
+ | |||
+ | function resolveKillerRealm(killer) |
||
+ | if killer.dlc == nil then |
||
+ | for _, realm in ipairs(realms) do |
||
+ | if realm.id == killer.realm then return realm.name end |
||
+ | end |
||
+ | else |
||
+ | for _, realm in ipairs(realms) do |
||
+ | if type(realm.dlc) == "number" and killer.dlc == realm.dlc then return realm.name |
||
+ | elseif type(realm.dlc) == "table" then |
||
+ | for i, dlc in ipairs(killer) do |
||
+ | if dlc.id == dlc[i] then return realm.name end |
||
+ | end |
||
+ | end |
||
+ | end |
||
+ | end |
||
+ | return 0 |
||
+ | end |
||
+ | |||
+ | function resolveKillerSpeed(killer) |
||
+ | local speedPercent = 0 |
||
+ | local speedMps = 0 |
||
+ | local note |
||
+ | local result |
||
+ | |||
+ | if type(killer.speed) == "number" then |
||
+ | speedPercent = killer.speed |
||
+ | speedMps = defaultSpeed * (killer.speed / 100) --speed is in percentage |
||
+ | else --so the killer speed is table |
||
+ | speedPercent = killer.speed[1] |
||
+ | speedMps = defaultSpeed * (killer.speed[1] / 100) |
||
+ | note = killer.speed[2] |
||
+ | end |
||
+ | |||
+ | result = speedPercent .. " % <b>" .. bar .. "</b> " .. speedMps .. " " .. strings.mps |
||
+ | if note ~= nil then |
||
+ | result = result .. nl .. "(" .. note .. ")" |
||
+ | end |
||
+ | |||
+ | return result |
||
+ | end |
||
+ | |||
+ | function resolveAltSpeed(killer) |
||
+ | local result = "" |
||
+ | local speedMps |
||
+ | |||
+ | for i, altSpeed in ipairs(killer.altSpeed) do |
||
+ | speedMps = defaultSpeed * (altSpeed[1] / 100) |
||
+ | |||
+ | result = result .. altSpeed[1] .. " % <b>" .. bar .. "</b> " .. speedMps .. " " .. strings.mps |
||
+ | if altSpeed[2] ~= nil then |
||
+ | result = result .. pg .. "(" .. altSpeed[2] .. ")" |
||
+ | end |
||
+ | |||
+ | if i < #killer.altSpeed then |
||
+ | result = result .. "<hr>" --.. nl .. nl |
||
+ | end |
||
+ | end |
||
+ | |||
+ | return result |
||
+ | end |
||
+ | |||
+ | function resolveTerrorRadius(killer) |
||
+ | result = "" |
||
+ | |||
+ | if type(killer.radius) == "number" then |
||
+ | return killer.radius .. " " .. strings.metres |
||
+ | elseif type(killer.radius) == "table" then |
||
+ | for i, radius in ipairs(killer.radius) do |
||
+ | if radius[3] ~= nil then --open span with title hover |
||
+ | result = result .. '<span class = "valueTooltip" title = "' .. radius[3] .. '">' |
||
+ | end |
||
+ | result = result .. radius[1] --metres value |
||
+ | if radius[2] ~= nil then --note for alt speed, if there is a note for the speed the abbreviation for metres is used instead of full name |
||
+ | result = result .. strings.m .. " (" .. radius[2] .. ")" |
||
+ | else |
||
+ | result = result .. " " .. strings.metres |
||
+ | end |
||
+ | if radius[3] ~= nil then --close span hover |
||
+ | result = result .. '</span>' |
||
+ | end |
||
+ | if i < #killer.radius then |
||
+ | result = result .. nl .. nl |
||
+ | end |
||
+ | end |
||
+ | end |
||
+ | return result |
||
+ | end |
||
+ | |||
+ | function resolveHeight(killer) |
||
+ | if killer.height == 'T' then return strings.tall |
||
+ | elseif killer.height == 'A' then return strings.avg |
||
+ | else return strings.err |
||
+ | end |
||
+ | end |
||
+ | |||
+ | function p.resolveKillersTable() |
||
+ | local result = "" |
||
+ | local name |
||
+ | local fileName |
||
+ | |||
+ | result = result .. "<div style=\"color: #fff;\">" |
||
+ | for i, killer in ipairs(killers) do |
||
+ | name = killer.shortName or killer.realName or killer.name |
||
+ | fileName = resolveKillersPortraitFileNameById(killer.id) |
||
+ | |||
+ | result = result .. "<div style=\"display: inline-block; text-align:center; margin: 10px\">[[" .. name .. "]] - " .. killer.name |
||
+ | result = result .. "[[File:" .. fileName .. ".png|center|frameless|link=" .. strings.the .. " " .. killer.name .. "]]</div>" |
||
+ | |||
+ | end |
||
+ | result = result .. "</div>" |
||
+ | |||
+ | return result |
||
+ | end |
||
+ | |||
+ | function p.resolveKillersTableMainPage() |
||
+ | local result = "" |
||
+ | local name |
||
+ | local fileName |
||
+ | |||
+ | result = result .. "<div class=\"fpbox\" id=\"fpkiller\" style=\"text-align: center;\">" |
||
+ | result = result .. "<div class=\"heading\">[[" .. strings.killers .. "]] [[File:IconHelpLoading killer.png|32px]]</div>" --changed to fit pl version -Yupi |
||
+ | result = result .. "<div class=\"fplinks\">" |
||
+ | for i, killer in ipairs(killers) do |
||
+ | |||
+ | fileName = resolveKillersPortraitFileNameById(killer.id) |
||
+ | |||
+ | result = result .. "<div class=\"fplink plainlinks image\"><div class=\"box\"><div class=\"row\"><div class=\"cell\">" |
||
+ | result = result .. "<div class=\"image\">[[File:" .. fileName .. ".png|link=" .. strings.the .. " " .. killer.name .. "]]</div>" |
||
+ | result = result .. "<div class=\"charLink killerLink link\">[[" .. strings.the .. " " .. killer.name .. "]]</div></div></div></div></div>" |
||
+ | end |
||
+ | result = result .. "</div>" |
||
+ | result = result .. "</div>" |
||
+ | |||
+ | return result |
||
+ | end |
||
+ | |||
+ | function resolveKillersPortraitFileNameById(id) |
||
+ | local fileConst = "_charPreview_portrait" |
||
+ | local fileName |
||
+ | |||
+ | fileName = getFileNameFromTableById(id) --get custom name from table |
||
+ | if not utils.isValidFileName(fileName) then --K{ID}_charPreview_portrait |
||
+ | fileName = "K" .. string.format("%02d", id) .. fileConst |
||
+ | end |
||
+ | if not utils.isValidFileName(fileName) then --File not Found |
||
+ | fileName = strings.unknownKiller .. fileConst |
||
+ | end |
||
+ | |||
+ | mw.log(fileName) |
||
+ | return fileName |
||
+ | end |
||
+ | |||
+ | function getFileNameFromTableById(id) |
||
+ | mw.log(id) |
||
+ | for j, sImage in ipairs(killerImages) do |
||
+ | if sImage.id == id then |
||
+ | return sImage.preview |
||
+ | end |
||
+ | end |
||
+ | return "" |
||
+ | end |
||
+ | |||
+ | function getDlcById(id) |
||
+ | for _, dlc in ipairs(dlcs) do |
||
+ | if dlc.id == id then return dlc end |
||
+ | end |
||
end |
end |
||
Wersja z 13:27, 12 wrz 2021
local p = {}
local data = require("Module:Datatable")
local mathOps = require("Module:MathOps")
local utils = require("Module:Utils")
local frame = mw.getCurrentFrame()
local defaultSpeed = 4 --m/s | 100%
local bar = "|" -- code for |
local nl = "\n"
local pg = "<p>" --paragraph
local ntl = "|-"
local strings = {
file = "Plik",
killers = "Zabójcy",
the = "",
unknownKiller = "UnknownKiller",
realName = "Nazwa",
noName = "Brak", --When the killer doesn't have the real name (ex. Demogorgon)
altName = "Alias",
gender = "Płeć",
nationality = "Narodowość",
realm = "Lokacja", --link
power = "Moc", --link
powerType = "Typ Mocy [[Atak|Ataku]]",
spAttackTrue = "Specjalny Atak",
spAttackFalse = "Podstawowy Atak",
weapon = "Broń",
speed = "Prędkość Ruchu", --iconlink
altSpeed = "Alternatywna Prędkość ruchu",
metres = "metrów",
m = "m", --abbreviation of metres
terror = "Zasięg Terroru", --iconlink
lullabyRadius = "Zasięg [[Kołysanka|Kołysanki]]",
height = "Wzrost", --image
tall = "Wysoki",
avg = "Średni",
dlc = "DLC",
actor = "Aktor Głosowy",
breathing = "Oddech",
altBreathing = "Alternatywny Oddech",
menuMusic = "Muzyka Menu",
terrorMusic = "Muzyka Zasięgu Terroru",
lullaby = "Kołysanka",
lullabies = "Kołysanki",
mps = "m/s",
err = "Error"
}
function p.getCountOfKillers()
return utils.getCount("killer")
end
function getKillerIndexById(id) --not used
for i, s in ipairs(killers) do
if s.id == id then return i end
end
return 0
end
function getKillerIdByName(name)
for _, killer in ipairs(killers) do
if killer.realName ~= nil then
if killer.realName == name then
return killer.id
end
else
if killer.name == name then -- ex.Demogorgon without a real name
return killer.id
end
end
end
return 0
end
function p.resolveKillerCharTable(name)
name = utils.resolveParameter(name)
killerId = getKillerIdByName(name)
killer = utils.getCharacterById(killerId, killers)
reuslt = ""
if type(killer) ~= "table" then return killer end
result =
'{| class = "infoboxtable"' .. nl ..
ntl ..' class = "infoboxTitle" | ' .. nl ..
'! class = "center bold" colspan = 2 | ' .. strings.the .. killer.name .. nl .. --changed, because in polish we don't use determiners -Yupi
ntl .. nl ..
-- '<tabber>' ..
-- '|-|First=' ..
-- 'First tab sample text.' ..
-- '|-|Second=' ..
-- 'Second tab content goes here. ' ..
-- '|-|Third Tab Title=' ..
-- 'Third tab content goes here.' ..
-- '</tabber>' ..
'! class = "center" colspan = 2 | [[' .. strings.file .. ':' .. resolveKillerPortraitImageFileName(killer) .. '.png|150px]]' .. nl ..
ntl .. nl
if killer.realName ~= nil then
result = result .. '| class = "titleColumn" | ' .. strings.realName .. ' || class = "valueColumn" | ' .. (killer.realName or strings.noName) .. nl .. ntl .. nl
end
if killer.altName ~= nil then
result = result .. '| class = "titleColumn" | ' .. strings.altName .. ' || class = "valueColumn italic" | ' .. resolveAltName(killer) .. nl .. ntl .. nl
end
result = result ..
'| class = "titleColumn" | ' .. strings.gender .. ' || class = "valueColumn" | ' .. utils.resolveGender(killer.gender) .. nl ..
ntl .. nl ..
'| class = "titleColumn" | ' .. strings.nationality .. ' || class = "valueColumn" | ' .. killer.nationality .. nl ..
ntl .. nl
if killer.realm ~= nil or killer.dlc ~= nil then
local killerRealm = resolveKillerRealm(killer)
if killerRealm ~= 0 then
result = result .. '| class = "titleColumn" | ' .. strings.realm .. ' || class = "valueColumn" | [[' .. killerRealm .. ']] ' .. nl .. ntl .. nl
end
end
result = result ..
'| class = "titleColumn" | ' .. strings.power .. ' || class = "valueColumn" | [[' .. killer.power .. ']]' .. nl ..
ntl .. nl
if killer.specialAttack ~= nil then
result = result .. '| class = "titleColumn" | ' .. strings.powerType .. ' || class = "valueColumn" | ' .. resolvePowerAttack(killer) .. nl .. ntl .. nl
end
result = result ..
'| class = "titleColumn" | ' .. strings.weapon .. ' || class = "valueColumn" | [[' .. killer.weapon .. ']]' .. nl ..
ntl .. nl ..
'| class = "titleColumn" | ' .. strings.speed .. ' || class = "valueColumn" | ' .. resolveKillerSpeed(killer) .. nl ..
ntl .. nl
if killer.altSpeed ~= nil then
result = result .. '| class = "titleColumn" | ' .. strings.altSpeed .. ' || class = "valueColumn" | ' .. resolveAltSpeed(killer) .. nl .. ntl .. nl
end
result = result ..
'| class = "titleColumn" | ' .. strings.terror .. ' || class = "valueColumn" | ' .. resolveTerrorRadius(killer) .. nl ..
ntl .. nl ..
'| class = "titleColumn" | ' .. strings.height .. ' || class = "valueColumn" | ' .. resolveHeight(killer) .. nl ..
ntl .. nl
if killer.dlc ~= nil then
result = result .. '| class = "titleColumn" | ' .. strings.dlc .. ' || class = "valueColumn" | [[' .. getDlcById(killer.dlc).name .. ']] ' .. nl .. ntl .. nl
end
result = result ..
'| class = "titleColumn" | ' .. strings.actor .. ' || class = "valueColumn" | ' .. (killer.actor or strings.uknownActor) .. nl ..
--TODO Check all music existence, this should be in separate table, Twinsuse Twins as a reference
ntl .. nl ..
'| class = "titleColumn center" colspan = 2 | ' .. strings.breathing .. nl ..
ntl .. nl ..
'| class = "valueColumn" | ' .. "Breathing" .. nl ..
ntl .. nl ..
'| class = "titleColumn center" colspan = 2 | ' .. strings.menuMusic .. nl ..
ntl .. nl ..
'| class = "valueColumn" | ' .. "Menu Music" .. nl ..
ntl .. nl ..
'| class = "titleColumn center" colspan = 2 | ' .. strings.terrorMusic .. nl ..
ntl .. nl ..
'| class = "valueColumn" | ' .. "Terror Radius Music" .. nl ..
ntl .. nl ..
'| class = "titleColumn center" colspan = 2 | ' .. strings.lullaby .. nl ..
ntl .. nl ..
'| class = "valueColumn" | ' .. "Lullaby" .. nl ..
'|}'
mw.log(result)
return result
end
function resolveKillerPortraitImageFileName(killer)
local fileConst = "_charSelect_portrait"
return "K" .. string.format("%02d", killer.id) .. fileConst
end
function resolveAltName(killer)
if type(killer.altName) == "string" then return '"' .. killer.altName .. '"'
elseif type(killer.altName) == "table" then
local result = ""
for i, name in ipairs(killer.altName) do
result = result .. '"' .. name .. '"'
if i < #killer.altName then
result = result .. nl
end
end
return result
end
return strings.err
end
function resolvePowerAttack(killer)
result = ""
if killer.specialAttack then
result = strings.spAttackTrue
else
result = strings.spAttackFalse
end
if killer.altAttackNote ~= nil then
result = result .. nl .. "(" .. killer.altAttackNote .. ")"
end
return result
end
function resolveKillerRealm(killer)
if killer.dlc == nil then
for _, realm in ipairs(realms) do
if realm.id == killer.realm then return realm.name end
end
else
for _, realm in ipairs(realms) do
if type(realm.dlc) == "number" and killer.dlc == realm.dlc then return realm.name
elseif type(realm.dlc) == "table" then
for i, dlc in ipairs(killer) do
if dlc.id == dlc[i] then return realm.name end
end
end
end
end
return 0
end
function resolveKillerSpeed(killer)
local speedPercent = 0
local speedMps = 0
local note
local result
if type(killer.speed) == "number" then
speedPercent = killer.speed
speedMps = defaultSpeed * (killer.speed / 100) --speed is in percentage
else --so the killer speed is table
speedPercent = killer.speed[1]
speedMps = defaultSpeed * (killer.speed[1] / 100)
note = killer.speed[2]
end
result = speedPercent .. " % <b>" .. bar .. "</b> " .. speedMps .. " " .. strings.mps
if note ~= nil then
result = result .. nl .. "(" .. note .. ")"
end
return result
end
function resolveAltSpeed(killer)
local result = ""
local speedMps
for i, altSpeed in ipairs(killer.altSpeed) do
speedMps = defaultSpeed * (altSpeed[1] / 100)
result = result .. altSpeed[1] .. " % <b>" .. bar .. "</b> " .. speedMps .. " " .. strings.mps
if altSpeed[2] ~= nil then
result = result .. pg .. "(" .. altSpeed[2] .. ")"
end
if i < #killer.altSpeed then
result = result .. "<hr>" --.. nl .. nl
end
end
return result
end
function resolveTerrorRadius(killer)
result = ""
if type(killer.radius) == "number" then
return killer.radius .. " " .. strings.metres
elseif type(killer.radius) == "table" then
for i, radius in ipairs(killer.radius) do
if radius[3] ~= nil then --open span with title hover
result = result .. '<span class = "valueTooltip" title = "' .. radius[3] .. '">'
end
result = result .. radius[1] --metres value
if radius[2] ~= nil then --note for alt speed, if there is a note for the speed the abbreviation for metres is used instead of full name
result = result .. strings.m .. " (" .. radius[2] .. ")"
else
result = result .. " " .. strings.metres
end
if radius[3] ~= nil then --close span hover
result = result .. '</span>'
end
if i < #killer.radius then
result = result .. nl .. nl
end
end
end
return result
end
function resolveHeight(killer)
if killer.height == 'T' then return strings.tall
elseif killer.height == 'A' then return strings.avg
else return strings.err
end
end
function p.resolveKillersTable()
local result = ""
local name
local fileName
result = result .. "<div style=\"color: #fff;\">"
for i, killer in ipairs(killers) do
name = killer.shortName or killer.realName or killer.name
fileName = resolveKillersPortraitFileNameById(killer.id)
result = result .. "<div style=\"display: inline-block; text-align:center; margin: 10px\">[[" .. name .. "]] - " .. killer.name
result = result .. "[[File:" .. fileName .. ".png|center|frameless|link=" .. strings.the .. " " .. killer.name .. "]]</div>"
end
result = result .. "</div>"
return result
end
function p.resolveKillersTableMainPage()
local result = ""
local name
local fileName
result = result .. "<div class=\"fpbox\" id=\"fpkiller\" style=\"text-align: center;\">"
result = result .. "<div class=\"heading\">[[" .. strings.killers .. "]] [[File:IconHelpLoading killer.png|32px]]</div>" --changed to fit pl version -Yupi
result = result .. "<div class=\"fplinks\">"
for i, killer in ipairs(killers) do
fileName = resolveKillersPortraitFileNameById(killer.id)
result = result .. "<div class=\"fplink plainlinks image\"><div class=\"box\"><div class=\"row\"><div class=\"cell\">"
result = result .. "<div class=\"image\">[[File:" .. fileName .. ".png|link=" .. strings.the .. " " .. killer.name .. "]]</div>"
result = result .. "<div class=\"charLink killerLink link\">[[" .. strings.the .. " " .. killer.name .. "]]</div></div></div></div></div>"
end
result = result .. "</div>"
result = result .. "</div>"
return result
end
function resolveKillersPortraitFileNameById(id)
local fileConst = "_charPreview_portrait"
local fileName
fileName = getFileNameFromTableById(id) --get custom name from table
if not utils.isValidFileName(fileName) then --K{ID}_charPreview_portrait
fileName = "K" .. string.format("%02d", id) .. fileConst
end
if not utils.isValidFileName(fileName) then --File not Found
fileName = strings.unknownKiller .. fileConst
end
mw.log(fileName)
return fileName
end
function getFileNameFromTableById(id)
mw.log(id)
for j, sImage in ipairs(killerImages) do
if sImage.id == id then
return sImage.preview
end
end
return ""
end
function getDlcById(id)
for _, dlc in ipairs(dlcs) do
if dlc.id == id then return dlc end
end
end
return p