Dead by Daylight Wiki
mNo edit summary
mNo edit summary
Line 67: Line 67:
 
end
 
end
 
end
 
end
end
 
 
function iconLink(icon)
 
frame:expandTemplate{title = "IconLink", args = {icon}}
 
 
end
 
end
   

Revision as of 16:40, 28 August 2020


local p = {}
--local data = require("Module:Datatable")
local dataPerks = require("Module:Datatable/Perks")

local bar = "|" -- code for |
local nl = "\n"
local ntl = "|-" -- new table line

local strings = {
}

function getUnusedPerksCount()
	local result = 0
	
	for _, perk in ipairs(perks) do
		if perk.unused == true then result = result + 1 end
	end

	return result
end

function getCommonPerksCount()
	local result = 0
	
	for _, perk in ipairs(perks) do
		if perk.character == nil and perk.unused ~= true then result = result + 1 end
	end
	
	return result
end

local _unusedPerksCount = getUnusedPerksCount()
local _commonPerksCount = getCommonPerksCount()
local _uniquePerksCount = table.getn(perks) - _unusedPerksCount - _commonPerksCount


function p.getPerksCount()
	return _uniquePerksCount + _commonPerksCount
end

function ResolveIntParam(param)
	if type(param) == "table" and param.args[1] ~= nil then
		return tonumber(param.args[1])
	else
		return param
	end
end

function p.getPerkDescription(id)
	id = ResolveIntParam(id)
	
	for _, perkDesc in ipairs(perkDescription) do
		if perkDesc.id == id then
			mw.log(perkDesc.desc[1])
			return perkDesc.desc[1]
		end
	end
end

function p.getPerkTeachableDescription(id)
	id = ResolveIntParam(id)
	
	for _, perkDesc in ipairs(perkDescription) do
		if perkDesc.id == id then
			mw.log(perkDesc.teachDesc[1])
			return perkDesc.teachDesc[1]
		end
	end
end

return p