Dead by Daylight Wiki
mNo edit summary
mNo edit summary
Line 44: Line 44:
 
end
 
end
   
local function getCosCharByName(name)
+
function getCosCharByName(name)
 
for _, outfit in ipairs(cosChars) do
 
for _, outfit in ipairs(cosChars) do
 
if cstr.the .. space .. outfit.name == name then
 
if cstr.the .. space .. outfit.name == name then

Revision as of 09:15, 15 November 2021


local p = {}
local data = require("Module:Datatable")
local utils = require("Module:Utils")
local str = require("Module:Strings")
local killersM = require("Module:Killers")
local frame = mw.getCurrentFrame()

local strings = {
	notFound = "Not Found!",
	cosmeticcs = "Cosmetics",
	killer = "Killer",
	gender = "Gender",
	name = "Name",
	nationality = "Nationality",
	actor = "Actor",
}

function p.resolveCosCharBox(args)
	name = utils.resolveParameter(args)
	cosChar = getCosCharByName(name)
	if not cosChar then return strings.cosmetics .. space .. strings.notFound end
	killer = killersM.getKillerById(cosChar.killer)
	if not killer then return strings.killer .. space .. strings.notFound end
	
	result = '{| class = "infoboxtable"' .. nl ..
	ntl ..' class = "infoboxTitle" | ' .. nl ..
	'! class = "center bold" colspan = 2 | ' .. cstr.the .. space .. cosChar.name .. nl .. ntl .. nl ..
	'! class = "center" colspan = 2 | ' .. link(cstr.file .. resolveKillerPortraitImageFileName(killer) .. '.png|150px') .. nl .. ntl .. nl
	if cosChar.wholeName ~= nil then
		result = result .. '| class = "titleColumn" | ' .. strings.name .. ' || class = "valueColumn" | ' .. cosChar.wholeName .. nl .. ntl .. nl
	end
	result = result ..
	'| class = "titleColumn" | ' .. strings.gender .. ' || class = "valueColumn" | ' .. utils.resolveGender(cosChar.gender) .. nl
	if cosChar.nationality ~= nil then
		result = ntl .. nl .. result .. '| class = "titleColumn" | ' .. strings.nationality .. ' || class = "valueColumn" | ' .. cosChar.nationality .. nl
	end
	if cosChar.actor ~= nil then
		result = ntl .. nl .. result .. '| class = "titleColumn" | ' .. strings.actor .. ' || class = "valueColumn" | ' .. cosChar.actor .. nl
	end
	result = result .. '|}'
	
	--mw.log(result)
	return result
end

function getCosCharByName(name)
	for _, outfit in ipairs(cosChars) do
		if cstr.the .. space .. outfit.name == name then
			return outfit
		end
	end
end

return p