--DO NOT CHANGE
require("Module:Extensions")
bar = "|" -- code for |
br = "<br>" --break
brnl = "<br>\n" --break new line
dbr = "<br><br>" -- double break
space = " "
nbsp = " " -- Non Breakable SPace
nbspC = " " -- Non Breakable SPace Code
hiddenChar = "" --hidden char that won't get rendered but behaves like the one
dot = "."
comma = ", "
colon = ":"
semi = ";"
dash = "-"
bullet = "\n* " --deprecated, do not use!
nbullet = "*" --newBullet -> please use this version, the old will be removed eventually
dbullet = "\n** " --deprecated
ndbullet = "**"
nl = "\n" --new line
dnl = "\n\n" -- double new line
tnl = "\n\n\n" --tripple new line
nlp = "\n<p>" --new line paragraph
pg = "<p>" --paragraph
ntl = "|-" -- new table line
hl = "!" -- header line
dhl = "!!" -- double header line
tl = "|" --table line
dtl = "||" -- double table line
strVars = {
bar = bar, br = br, brnl = brnl, dbr = dbr, space = space, nbsp = nbsp, nbspC = nbspC, hiddenChar = hiddenChar, dot = dot, comma = comma, colon = colon, semi = semi, dash = dash, bullet = bullet, nbullet = nbullet, dbullet = dbullet, ndbullet = ndbullet, nl = nl, dnl = dnl, tnl = tnl, nlp = nlp, pg = pg, ntl = ntl, hl = hl, dhl = dhl, tl = tl, dtl = dtl, tag = tag, effects = effects
}
--TRANSLATE PART--
descStrings = {
statusEffect = "Status Effect",
statusEffects = "Status Effects",
--statesOrder = "#1# #2#",
andString = "and",
}
--TRANSLATE PART END--
--common strings
cstr = {
category = "Category:", --[[Category: ...]]
file = "File:", --[[File: ...]]
media = "Media:",
empty = "",
the = "The",
contact = space .. "Please contact [[User:Jouki|Jouki]]",
gameName = "Dead by Daylight",
frameless = "frameless",
left = "left",
center = "center",
right = "right",
--File Formats
ogg = 'ogg',
mp3 = 'mp3',
mp4 = 'mp4',
jpg = 'jpg',
jpeg= 'jpeg',
png = 'png',
gif = 'gif',
}
types = {
number = "number",
string = "string",
table = "table"
}
multinames = { --values in brackets in case of multiname
achievement = "achievement",
dlc = "DLC",
killer = "killer",
map = "map",
realm = "realm",
perk = "perk",
power = "power",
survivor = "survivor"
}
--iconLinkStrings
ils = {
-- Interaction
basementHooks = "Basement Hooks",
blastMine = "Blast Mine",
blastMines = "Blast Mines",
breakableWall = "Breakable Wall",
breakableWalls = "Breakable Walls",
boonTotem = "Boon Totem",
boonTotems = "Boon Totems",
cageOfCorruption = "Cage of Corruption",
cagesOfCorruption = "Cages of Corruption",
cageOfAtonement = "Cage of Atonement",
cagesOfAtonement = "Cages of Atonement",
chest = "Chest",
chests = "Chests",
dullTotem = "Dull Totem",
dullTotems = "Dull Totems",
exitGate = "Exit Gate",
exitGates = "Exit Gates",
exitGateSwitch = "Exit Gate Switch",
exitGateSwitches = "Exit Gate Switches",
failedSkillCheck = "Failed Skill Check",
failedSkillChecks = "Failed Skill Checks",
firecracker = "Firecracker",
firecrackers = "Firecrackers",
flashlight = "Flashlight",
flashlights = "Flashlights",
flashbang = "Flashbang",
flashbangs = "Flashbangs",
flashGrenade = "Flash Grenade",
flashGrenades = "Flash Grenades",
generator = "Generator",
generators = "Generators",
goodSkillCheck = "Good Skill Check",
goodSkillChecks = "Good Skill Checks",
hatch = "Hatch",
hexTotem = "Hex Totem",
hexTotems = "Hex Totems",
hook = "Hook",
hooks = "Hooks",
item = "Item",
items = "Items",
locker = "Locker",
lockers = "Lockers",
map = "Map",
maps = "Maps",
medKit = "Med-Kit",
medKits = "Med-Kits",
pallet = "Pallet",
pallets = "Pallets",
survivor = "Survivor",
survivors = "Survivors",
skillCheck = "Skill Check",
skillChecks = "Skill Checks",
toolbox = "Toolbox",
toolboxes = "Toolboxes",
totem = "Totem",
totems = "Totems",
greatSkillCheck = "Great Skill Check",
greatSkillChecks = "Great Skill Checks",
window = "Window",
windows = "Windows",
-- UI (Status Effects, Auras)
adrenaline = "Adrenaline",
aura = "Aura",
auras = "Auras",
bleeding = "Bleeding",
blessed = "Blessed",
blindness = "Blindness",
bloodlust = "Bloodlust",
broken = "Broken",
chance = "Chance",
cursed = "Cursed",
deafened = "Deafened",
deepWound = "Deep Wound",
efficiency = "Efficiency",
endurance = "Endurance",
enduranceKiller = "Endurance (Killer)",
enduranceSurvivor = "Endurance (Survivor)",
exhausted = "Exhausted",
exhaustion = "Exhaustion",
exposed = "Exposed",
haemorrhage = "Haemorrhage",
haste = "Haste",
hearing = "Hearing",
hindered = "Hindered",
incapacitated = "Incapacitated",
luck = "Luck",
madness = "Madness",
mangled = "Mangled",
obsession = "Obsession",
oblivious = "Oblivious",
revealed = "Revealed",
sleepPenalty = "Sleep Penalty",
undetectable = "Undetectable",
vision = "Vision",
-- Killers
killer = "Killer",
nightmare = "Nightmare",
-- Misc.
addon = "Add-on",
addons = "Add-ons",
altruism = "Altruism",
basement = "Basement",
bloodpoints = "Bloodpoints",
bpWhite = "Bloodpoints white",
boldness = "Boldness",
brutality = "Brutality",
crow = "Crow",
crows = "Crows",
deviousness = "Deviousness",
dyingState = "Dying State",
entity = "Entity",
healthState = "Health State",
healthy = "Healthy",
hunter = "Hunter",
injuredState = "Injured State",
objectives = "Objectives",
offering = "Offering",
offerings = "Offerings",
poolsOfBlood = "Pools of Blood",
sacrifice = "Sacrifice",
scratchMarks = "Scratch Marks",
idleCrows = "Idle Crows",
survival = "Survival",
terrorRadius = "Terror Radius",
}
specialWords = {
dot = "dot"
}
function word(wrd)
return " {<" .. specialWords[wrd] .. ">}" --" {<dot>}"
end
function iconLink(icon, link, text)
local utils = require("Module:Utils")
return utils.IconLink(icon, link, text)
end
function icon(icon)
local utils = require("Module:Utils")
return utils.getIcon(icon)
end
function img(iconName, ...)
return file(icon(iconName), ...)
end
function aImg(iconType, iconName, iconSize, params)
local utils = require("Module:Utils")
return utils.assembleImage(iconType, iconName, iconSize, params)
end
function clr(color, text)
local utils = require("Module:Utils")
return utils.clr(color, text)
end
function clro(text, reset)
local utils = require("Module:Utils")
return utils.clro(text, reset)
end
function clror(text)
return clro(text, true)
end
function bclr(color, text)
--local utils = require("Module:Utils")
return b(clr(color, text))
end
function iclr(color, text)
--local utils = require("Module:Utils")
return i(clr(color, text))
end
function biclr(color, text) return ibclr(color, text) end
function ibclr(color, text)
return i(b(clr(color, text)))
end
function tooltip(text, tooltip, iconless, bordeless)
local utils = require("Module:Utils")
return utils.tooltip(text, tooltip, iconless, bordeless)
end
function quote(text, author)
local utils = require("Module:Utils")
author = author or utils.resolveParameter(text, 2, true)
text = utils.resolveParameter(text, 1) or cstr.empty
return i(clr(9, '"' .. text .. ((author and '" — ' .. author) or '"')))
end
function states(...)
local utils = require("Module:Utils")
local states = {...}
local suffix = (#states > 1 and descStrings.statusEffects) or descStrings.statusEffect
local result = utils.getDynamicString(
{
skip(table.join(states, {comma, ((#states > 2 and comma) or cstr.empty) .. space .. descStrings.andString .. space}, {"ibil"})),
skip(b(suffix))
}
, descStrings.statesOrder)
return result
end
--function p.effects(_loType, loName, ...) effects(_loType, loName, ...) end
function effects(_loType, loName, ...) --this function should be called only if the loadout module is loaded
local utils = require("Module:Utils")
local effectsList = {...}
local suffix = (#effectsList > 1 and descStrings.statusEffects) or descStrings.statusEffect
local postprocessedStates = {}
local loM = require("Module:Loadout" .. utils.lang())
local varM = mw.loadData("Module:Datatable/Various" .. utils.lang())
local lo = loM["get" .. utils.firstLetterUpper(_loType or cstr.empty) .. "ByName"] and loM["get" .. utils.firstLetterUpper(_loType) .. "ByName"](loName, false)
local loCharType = lo and ((lo.charType == 'S' or lo.survivor) and ils.survivor) or ((lo.charType == 'K' or lo.killer) and ils.killer)
for _, effect in pairs(effectsList) do
local effObj = varM.effects[effect] or varM.effects[effect .. space .. brackets(loCharType)] or false
local effectObjName = (varM.effects[effect] and effect) or (varM.effects[effect .. space .. brackets(loCharType)] and effect .. space .. brackets(loCharType))
local displayName = effObj and effObj.displayName or effect
local effectVarName = string.lower(utils.firstLetterLower(utils.capitalizeName(displayName)))
local effectVarTechName = effObj and effObj.techName and string.lower(utils.firstLetterLower(utils.capitalizeName(effObj.techName))) or cstr.empty
local durationVariableName = "duration" .. effect --this is for hindered and similar effects that has its strnegth in "hindered" variable and its duration is stored in "durationHindered" variable
local durationValue = lo and (lo[durationVariableName] or lo[effectVarName] or (effObj and lo[effectVarTechName])) or -1
local durationSplit
if type(durationValue) == types.string then
durationSplit = string.split(durationValue, space)
end
durationValue = tonumber(durationSplit and (durationSplit[2] ~= '%') and durationSplit[1] or durationValue) or -1
--[[
lg("LO Name: " .. (lo and lo.name or "NaN"))
lg("raw effect:" .. effect)
lg("effectVarName: " .. effectVarName)
lg("effectVarTechName: " .. effectVarTechName)
lg("durationValue: " .. durationValue)
]]
local debugInfoObj = (effectObjName == nil and {loCharType = (loCharType or "NULL"), loName = (loName or "NULL"), effect = (effect or "NULL"), effectWithCharType = (effect or "NULL") .. space .. brackets((loCharType or "NULL"))})
table.add(postprocessedStates, i(b(link(displayName))) .. aImg("effect", effectObjName, 48, {il = true, duration = durationValue, debugInfo = debugInfoObj}))
end
local result = utils.getDynamicString(
{
skip(table.join(postprocessedStates, {comma, ((#postprocessedStates > 2 and comma) or cstr.empty) .. space .. descStrings.andString .. space})),
skip(b(suffix))
}
, descStrings.statesOrder)
return result
end
function ibil(ilsString) --i + b + iconLink
local utils = require("Module:Utils")
return i(b(utils.IconLink(ilsString)))
end
function link(text, ...)
local parameters = (#{...} > 0 and tl .. table.concat({...}, tl)) or cstr.empty --join table with | so we get |param1|param2|param3|...
return '[[' .. text .. parameters ..']]'
end
function templateLink(text)
return '{{' .. (text or "Error") .. '}}'
end
function quotes(text)
return '"' .. (text or "Error") .. '"'
end
function center(text)
return '<center>' .. (text or "Error") .. '</center>'
end
function includeonly(text)
return '<includeonly>' .. (text or "Error") .. '</includeonly>'
end
function noinclude(text)
return '<noinclude>' .. (text or "Error") .. '</noinclude>'
end
function list(...)
local result = cstr.empty
local items = {...}
for _, row in ipairs(items) do
result = result .. nbullet .. row .. nl
end
return nl .. result .. nl
end
function file(filename, ...)
local parameters = (#{...} > 0 and tl .. table.concat({...}, tl)) or cstr.empty --join table with | so we get |param1|param2|param3|...
return link(cstr.file .. filename .. parameters)
end
function media(filename, ...)
local parameters = (#{...} > 0 and tl .. table.concat({...}, tl)) or cstr.empty --join table with | so we get |param1|param2|param3|...
return link(cstr.media .. filename .. parameters)
end
function category(...)
local result = {}
for _, cat in ipairs({...}) do
table.insert(result, link(cstr.category .. cat))
end
if #result > 0 then
return table.concat(result, nl) --nl maybe needs to be replaced with cstr.empty if nl creates new rows
else
return link(cstr.category .. "Category-Module-Error")
end
end
function brackets(text)
return '(' .. (text or "Error") .. ')'
end
function tag(tagName, tagContent, closeTag)
closeTag = closeTag or tagContent == true
tagContent = (tagContent == true or tagContent == false or tagContent == nil) and cstr.empty or tagContent
return '<' .. (closeTag and '/' or cstr.empty) .. tagName .. space .. tagContent .. '>'
end
--bold function
function b(text)
text = stringsObjs.resolveParam(text, 1, true)
return "<b>" .. (text or "Error") .. "</b>"
end
--italic function
function i(text)
return "<i>" .. (text or "Error") .. "</i>"
end
function skip(text)
return "#s#" .. (text or "Error") .. "#/s#"
end
function big(text)
return '<big>' .. (text or "Error") .. '</big>'
end
function small(text)
return '<small>' .. (text or "Error") .. '</small>'
end
function note(text)
return '<span class = "noticeText">' .. (text or "Error") .. '</span>'
end
function join(...)
require("Module:Extensions")
return table.join(...)
end
function the(alter, spaceless)
local langs = require("Module:Languages")
return langs.evaluateArticle(alter, false)
--return (langs.nonEn() and (langs.evaluateArticle(alter))) or cstr.the .. ((not langs.nonEn() and not spaceless and space) or cstr.empty)
end
function article(obj, indefinite)
local langs = require("Module:Languages")
return langs.evaluateArticle(obj, indefinite)
end
function ptb(content, title, patch)
local utils = require("Module:Utils")
return utils.ptb(content, title, patch)
end
function deletedBox(content, title, patch)
local utils = require("Module:Utils")
return utils.deletedBox(content, title, patch)
end
--Syntax Highlight
function sh(value, lang, inline)
local frame = mw.getCurrentFrame()
local shArgs = {}
shArgs.lang = ((lang ~= cstr.empty and lang) or "lua")
shArgs.inline = (inline == true or inline == nil) or nil --true value is just a mockup for argument being present, regardless of actual value. false => will still show inline
return b(frame:extensionTag{ name = 'syntaxhighlight', content = value, args = shArgs })
end
--table line => creates a basic table line so it can be easily stacked
function tLine(attrs, ...)
local values = (type(...) == "string" and {...}) or ...
local result = cstr.empty
local separator = (values[#values] == hl and table.remove(values)) or tl --if the last item is header separator then set it to var
local multiLine = false --if the cell value has multiple lines then we can't use double separator such as ||
--if separator == hl then table.remove(values) end --if the last item was a separator, then remove it from the list. It's not needed anymore
result = result .. ntl .. nl .. separator .. ((attrs and space .. attrs .. space .. tl) or cstr.empty) .. space .. table.remove(values, 1)
for _, value in ipairs(values) do
if string.find(value, nl) then
multiLine = true
break
end
end
for _, value in ipairs(values) do
result = result .. (multiLine and (nl .. separator) or (space .. separator .. separator)) .. space .. value
end
return result .. nl
end
--table header line => same as table line, just for header version
function thLine(attrs, ...)
local values = {...}
table.insert(values, hl)
return tLine(attrs, values)
end
function class(...)
local values = {...}
return (#values and 'class = ' .. quotes(join(values, space))) or cstr.empty
end
function style(...)
local values = {...}
return (#values and 'style = ' .. quotes(join(values, semi))) or cstr.empty
end
function colspan(value) return ' colspan = ' .. tonumber(value) .. space end
function rowspan(value) return ' rowspan = ' .. tonumber(value) .. space end
function span(content, ...)
local classes = class(...)
return "<span " .. classes .. ">" .. content .. "</span>"
end
function div(content, ...)
local classes = class(...)
return "<div " .. classes .. ">" .. content .. "</div>"
end
-----------------------------
-- Debug Functions --
-----------------------------
--Debug Log
function lg(obj)
mw.log(obj)
end
--Dump object
function dmp(obj)
mw.log(mw.dumpObject(obj))
end
--raw Dump
function rdmp(obj)
return mw.dumpObject(obj)
end
--------------------------------
-- External functions --
--------------------------------
stringsObjs = {}
--temporary - may be moved to Utils
function stringsObjs.resolveParam(param, index, canBeNil)
local retArg = nil
if type(param) == types.table then
if param.args then
if index then
if index == 0 then
retArg = param.args
else
retArg = param.args[index]
if retArg == nil and not canBeNil then
return stringsObjs.getPageName()
else
return retArg
end
end
else
if not canBeNil then
return stringsObjs.getPageName()
else
return nil
end
end
else
return param
end
elseif param ~= nil then
return param
elseif not canBeNil then
return stringsObjs.getPageName()
else
return nil
end
end
function stringsObjs.getPageName()
local pageName = mw.title.getCurrentTitle().text
local pageParts = string.split(pageName, '/') -- remove page suffixes such as language codes
if #pageParts > 1 then
_unofficialLang = pageParts[#pageParts]
return pageParts[#pageParts - 1] --take second to last part of page name
end
return pageParts[1] --if there is no other part than the name itself
end
stringsObjs.bar = bar
stringsObjs.br = br
stringsObjs.brnl = brnl
stringsObjs.space = space
stringsObjs.nbsp = nbsp
stringsObjs.nbspC = nbspC
stringsObjs.hiddenChar = hiddenChar
stringsObjs.dot = dot
stringsObjs.comma = comma
stringsObjs.colon = colon
stringsObjs.semi = semi
stringsObjs.dash = dash
stringsObjs.bullet = bullet
stringsObjs.nbullet = nbullet
stringsObjs.dbullet = dbullet
stringsObjs.ndbullet = ndbullet
stringsObjs.nl = nl
stringsObjs.dnl = dnl
stringsObjs.tnl = tnl
stringsObjs.nlp = nlp
stringsObjs.pg = pg
stringsObjs.ntl = ntl
stringsObjs.hl = hl
stringsObjs.dhl = dhl
stringsObjs.tl = tl
stringsObjs.dtl = dtl
stringsObjs.cstr = cstr
stringsObjs.types = types
stringsObjs.ils = ils
function stringsObjs.iconLink(link, icon, text) return iconLink(link, icon, text) end
function stringsObjs.icon(icon) return icon(icon) end
function stringsObjs.img(iconName, ...) return img(iconName, ...) end
function stringsObjs.aImg(iconType, iconName, iconSize, params) return aImg(iconType, iconName, iconSize, params) end
function stringsObjs.clr(color, text) return clr(color, text) end
function stringsObjs.clro(text, reset) return clro(text, reset) end
function stringsObjs.clror(text) return clror(text) end
function stringsObjs.biclr(color, text) return ibclr(color, text) end
function stringsObjs.ibclr(color, text) return ibclr(color, text) end
function stringsObjs.bclr(color, text) return bclr(color, text) end
function stringsObjs.iclr(color, text) return iclr(color, text) end
function stringsObjs.tooltip(text, tooltip, iconless) return tooltip(text, tooltip, iconless) end
function stringsObjs.quote(text, author) return quote(text, author) end
function stringsObjs.states(...) return states(...) end
function stringsObjs.effects(_loType, loName, ...) return effects(_loType, loName, ...) end
function stringsObjs.ibil(ilsString) return ibil(ilsString) end
function stringsObjs.link(text, ...) return link(text, ...) end
function stringsObjs.templateLink(text) return templateLink(text) end
function stringsObjs.quotes(text) return quotes(text) end
function stringsObjs.center(text) return center(text) end
function stringsObjs.includeonly(text) return includeonly(text) end
function stringsObjs.noinclude(text) return noinclude(text) end
function stringsObjs.list(...) return list(...) end
function stringsObjs.file(text, ...) return file(text, ...) end
function stringsObjs.media(filename, ...) return media(filename, ...) end
function stringsObjs.category(...) return category(...) end
function stringsObjs.brackets(text) return brackets(text) end
function stringsObjs.tag(tagName, tagContent, closeTag) return tag(tagName, tagContent, closeTag) end
function stringsObjs.b(text) return b(text) end
function stringsObjs.i(text) return i(text) end
function stringsObjs.skip(text) return skip(text) end
function stringsObjs.big(text) return big(text) end
function stringsObjs.small(text) return small(text) end
function stringsObjs.note(text) return note(text) end
function stringsObjs.join(...) return join(...) end
function stringsObjs.the(alter, spaceless) return the(alter, spaceless) end
function stringsObjs.article(obj, indefinite) return article(obj, indefinite) end
function stringsObjs.ptb(content, title, patch) return ptb(content, title, patch) end
function stringsObjs.deletedBox(content, title, patch) return deletedBox(content, title, patch) end
function stringsObjs.sh(value, lang, inline) return sh(value, lang, inline) end
function stringsObjs.tLine(attrs, ...) return tLine(attrs, ...) end
function stringsObjs.thLine(attrs, ...) return thLine(attrs, ...) end
function stringsObjs.class(...) return class(...) end
function stringsObjs.style(...) return style(...) end
function stringsObjs.colspan(value) return colspan(value) end
function stringsObjs.rowspan(value) return rowspan(value) end
function stringsObjs.span(content, ...) return span(content, ...) end
function stringsObjs.div(content, ...) return div(content, ...) end
return stringsObjs