Module:Age

ElvenAge = {} ElvenAge.Age_Division = function(real_age,divisor) if real_age < 18 then return real_age else return ((real_age - 18) / divisor) + 18 end end ElvenAge.Age_Multiply = function(real_age) if real_age < 18 then return real_age else return (real_age - 18) * (8.5 * math.pow(1.0474757339,((real_age - 18) / 18))) + 18 end end local p={} function p.main(frame) local formatt,birth,now = frame.args[1],tonumber(frame.args[2]),tonumber(frame.args[3]) local years = now - birth if formatt == "*" then years = math.floor(years) elseif formatt == "true" then years = years * 376 / 365.25 elseif formatt == "true*" then years = math.floor(years * 376 / 365.25) elseif formatt == "elf_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,10) elseif formatt == "elf_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,10)) elseif formatt == "half_elf_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,5) elseif formatt == "half_elf_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,5)) elseif formatt == "orc_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,2.93548) elseif formatt == "orc_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,2.93548)) elseif formatt == "half_orc_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,1.46774) elseif formatt == "half_orc_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,1.46774)) elseif formatt == "lizardman_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,14.22581) elseif formatt == "lizardman_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,14.22581)) elseif formatt == "halfling_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,2.12903) elseif formatt == "halfling_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,2.12903)) elseif formatt == "gnome_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,5.65278) elseif formatt == "gnome_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,5.65278)) elseif formatt == "limjiang_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,1.83838) elseif formatt == "limjiang_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 365.25,1.83838)) elseif formatt == "azisiri_true" then years = ElvenAge.Age_Division(years * 376 / 365.25,2.7647058823529) elseif formatt == "azisiri_true*" then years = math.floor(ElvenAge.Age_Division(years * 376 / 2.7647058823529)) end return years end return p