×
Einen neuen Artikel erstellen
Schreibe den Seitennamen hierhin:
Wir haben derzeit 9.055 Artikel auf Vaultpedia. Gib deinen Artikelnamen oberhalb von oder klicke auf einen der unten stehenden Titel und beginne zu schreiben! ein



    Vaultpedia
    9.055Artikel
    Tritt unserem Discord bei und informiere dich auf unserem Twitter-Kanal über die aktuellsten Themen rund um Fallout!

    Die Dokumentation für dieses Modul kann unter Modul:Special/Doku erstellt werden

     
    -- See [[Module:Special/doc]] for documentation
     
    p = {}
     
    local statistics = {
    	[1] = "Stärke",
    	[2] = "Wahrnehmung",
    	[3] = "Ausdauer",
    	[4] = "Charisma",
    	[5] = "Intelligenz",
    	[6] = "Beweglichkeit",
    	[7] = "Glück"
    }
     
    local links = {
    	[1] = "[[Stärke|S]]",
    	[2] = "[[Wahrnehmung|P]]",
    	[3] = "[[Ausdauer|E]]",
    	[4] = "[[Charisma|C]]",
    	[5] = "[[Intelligenz|I]]",
    	[6] = "[[Beweglichkeit|A]]",
    	[7] = "[[Glück|L]]"
    }
     
    function tooltip(value, text)
    	return '<span class="va-tooltip" style="cursor: help; border-bottom: 1px dotted;" title="' .. text .. ' modifiziert durch Rüstung und Kleidung">' .. value .. '</span>'
    end
     
    function p.table(frame)
    	local value = mw.text.split(frame.args[1], ",")      -- Splits the values into an array
    	local modifier = mw.text.split(frame.args[2], ",")   -- Splits the modifiers into an array
    	local title = frame.args[3]                          -- If a game title is declared, this will be transfered to a variable
    	local perk = 1                                       -- Used for readings the arrays
    	local result = "<span class='special-shell'>"        -- Wrapper shell for SPECIAL stats to allow additional CSS handling
     
    -- Adds the game title if one has been denoted, otherwise nothing is added.
    	if string.len(title) > 0 then
    		result = result .. "<div class='special-title'>" .. title .. "</div>"
    	end
     
    -- Circular script that sets each stat to table cell	
    	while perk <= 7 do
    	    if tonumber(value[perk]) ~= nil then
           	    thisPerk = tonumber(value[perk])
           	else
           	    thisPerk = 0
           	end
     
    		if perk == 1 then
    			result = result .. '<table><tr>'
    		elseif perk == 5 then
    			result = result .. '</tr></table><table><tr>'
    		end 
    		result = result .. '<td class="'
    		-- Classes are required for CSS alignment of stats
            if perk > 4 then
    			result = result .. 'special-bottom">' -- Bottom row
    		else
    			result = result .. 'special-top">' -- Top row
    		end
     
    		-- Checks for if the stat is modified by armor/clothing and calls the tooltip function
    		if modifier[perk] ~= nil and modifier[perk] ~= "" then
    			result = result .. tooltip( thisPerk + tonumber(modifier[perk]), statistics[perk] ) .. " "
    		else
    			result = result .. thisPerk .. " "
    		end
    		result = result .. links[perk] .. "</td> "
    		perk = perk + 1
    	end
     
    	result = result .. "</tr></table></div>"
    	return result
    end
     
    function p.string(frame)
        local value = mw.text.split(frame.args[1], ",")      -- Splits the values into an array
    	local modifier = mw.text.split(frame.args[2], ",")   -- Splits the modifiers into an array
    	local title = frame.args[3]                          -- If a game title is declared, this will be transfered to a variable
    	local maximum = mw.text.split(frame.args[4], ",")    -- 
    	local perk = 1                                       -- Used for readings the arrays
    	local result = "<span class='special-shell'>"        -- Wrapper shell for SPECIAL stats to allow additional CSS handling
     
    -- Adds the game title if one has been denoted, otherwise nothing is added.
    	if title ~= nil or title ~= "" then
    		result = result .. "<div class='special-title'>" .. title .. "</div>"
    	end
     
        while perk <= 7 do
            if tonumber(value[perk]) ~= nil then
           	    thisPerk = tonumber(value[perk])
           	else
           	    thisPerk = 0
           	end
     
           	if tonumber(value[perk]) ~= nil then
           	    perkMax = tonumber(maximum[perk])
           	else
           	    perkMax = 0
           	end
        
            if perkMax > thisPerk then
                perkArr = " &rarr; "
            else
                perkArr = " &larr; "
            end
     
           	if modifier[perk] ~= nil and modifier[perk] ~= "" then
           	    if perkMax ~= 0 then
           	        perkString = thisPerk + tonumber(modifier[perk]) .. perkArr .. perkMax + tonumber(modifier[perk])
           	    else
           	        perkString = thisPerk + tonumber(modifier[perk])
           	    end
    			result = result .. tooltip( perkString, statistics[perk] ) .. " "
    		else
    		    if perkMax ~= 0 then
           	        perkString = thisPerk .. perkArr .. perkMax
           	    else
           	        perkString = thisPerk
           	    end
    			result = result .. perkString .. " "
    		end
     
    		result = result .. links[perk]
     
    		if perk <7 then
    		    result = result .. ", "
    		end
     
    		perk = perk + 1
    	end
        result = result .. "</span>"    
        return result
     
    end
     
    function p.test(frame)
        return string.len(tostring(frame.args[3]))
    end
     
    return p