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] .. "*"   end if frame.args[3] ~= nil then local dead = false local now = currtm else local dead = true local now = tonumber(frame.args[3]) end local formatted_age = format_age(racetype,tonumber(frame.args[2]),now) 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" then base_string = base_string .. "Apparent Age: " .. format_age(racetype,tonumber(frame.args[2]),now) .. " years" end end return p