Module:CharacterAge

require "Module:Age" require "Module:Dates" require "Module:CurrentTime"

racial_lookup = { ["Human"] = "human", ["HUMAN"] = "human", ["Elf"] = "elf", ["ELF"] = "elf", ["ELVEN"] = "elf", ["Elven"] = "elf", ["Orc"] = "orc", ["ORC"] = "orc", ["ORCISH"] = "orc", ["Orcish"] = "orc", ["Half-Elf"] = "half_elf", ["HALF-ELF"] = "half_elf", ["HALF ELF"] = "half_elf", ["Half Elf"] = "half_elf", ["Half Elven"] = "half_elf", ["Half-Elven"] = "half_elf", ["HALF-ELVEN"] = "half_elf", ["Half-Orc"] = "half_orc", ["HALF-ORC"] = "half_orc", ["HALF ORC"] = "half_orc", ["Half Orc"] = "half_orc", ["Half Orcish"] = "half_orc", ["Half-Orcish"] = "half_orc", ["HALF-ORCISH"] = "half_orc", ["Lizardman"] = "lizardman", ["LIZARDMAN"] = "lizardman", ["Halfling"] = "halfling", ["HALFLING"] = "halfling", ["Dwarf"] = "gnome", ["DWARF"] = "gnome", ["Dwarven"] = "gnome", ["DWARVEN"] = "gnome", ["Gnome"] = "gnome", ["GNOME"] = "gnome", ["Gnomish"] = "gnome", ["GNOMISH"] = "gnome", ["Limjiang"] = "limjiang", ["LIMJIANG"] = "limjiang", ["Shár"] = "limjiang", ["SHÁR"] = "limjiang", ["Shar"] = "limjiang", ["SHAR"] = "limjiang", ["Sak"] = "limjiang", ["SAK"] = "limjiang", ["Azisiri"] = "azisiri", ["azisiri"] = "azisiri", ["AZISIRI"] = "azisiri" }

local p={} function p.main(frame) local base_string = "" local racetype = frame.args[1] if racial_lookup[racetype] ~= nil then racetype = racial_lookup[racetype] .. "_true*" end if frame.args[3] ~= nil then dead = true now = tonumber(frame.args[3]) else now = currtm dead = false end if frame.args[1] ~= "Human" then base_string = base_string .. "Actual Age:  " else base_string = base_string .. " " end base_string = base_string .. format_age("true*",tonumber(frame.args[2]),now) .. " in Artograchian years,  " .. format_age("*",tonumber(frame.args[2]),now) .. " in Terran years " if dead == true then base_string = base_string .." (at the time of death)" else base_string = base_string .. " (as of " .. GetDate(now) .. ")" end if frame.args[1] ~= "Human" or frame.args['app_age'] ~= "0" then if frame.args['app_age'] ~= nil and frame.args['app_age'] ~= "0" then base_string = base_string .. " Apparent Age: " .. frame.args['app_age'].. " years" else base_string = base_string .. " Apparent Age: " .. format_age(racetype,tonumber(frame.args[2]),now) .. " years" end end return base_string end function p.main_hun(frame) local base_string = "" local racetype = frame.args[1] if racial_lookup[racetype] ~= nil then racetype = racial_lookup[racetype] .. "_true*" end if frame.args[3] ~= nil then dead = true now = tonumber(frame.args[3]) else now = currtm dead = false end if frame.args[1] ~= "Human" then base_string = base_string .. "Valódi kor:  " else base_string = base_string .. " " end base_string = base_string .. format_age("true*",tonumber(frame.args[2]),now) .. " Artograchi években,  " .. format_age("*",tonumber(frame.args[2]),now) .. " földi években " if dead == true then base_string = base_string .." (halálakor)" else base_string = base_string .. " (" .. GetDate(now) .. "-án)" end if frame.args[1] ~= "Human" or frame.args['app_age'] ~= "0" then if frame.args['app_age'] ~= nil and frame.args['app_age'] ~= "0" then base_string = base_string .. " Látszólagos kor: " .. frame.args['app_age'] else base_string = base_string .. " Látszólagos kor: " .. format_age(racetype,tonumber(frame.args[2]),now) end end return base_string end return p