4,599
edits
No edit summary |
No edit summary Tag: Manual revert |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 42: | Line 42: | ||
--This also allows us to add other calendars here | --This also allows us to add other calendars here | ||
if calendar == "Solandria" then | if calendar == "Solandria" then | ||
monthNames = {"Miry", "Ozdary", "Rydust", "Iptust", "Tosey", "Iverly", "Eohe", "Kasgust", "Andust", "Bepry", "Nindust", "Tymust", "Ekage", "Aphly", "Asust", "Syranust"} | |||
elseif calendar == "Eberron" then | elseif calendar == "Eberron" then | ||
monthNames = {"Zarantyr", "Olarune", "Therendor", "Eyre", "Dravago", "Nymm", "Lharvion", "Barrakas", "Rhann", "Sypheros", "Aryth", "Vult"} | |||
elseif calendar == "Forgotten Realms" then | elseif calendar == "Forgotten Realms" then | ||
monthNames = {"Hammer", "Alturiak", "Ches", "Tarsakh", "Mirtul", "Kythorn", "Flamerule", "Eleasis", "Eleint", "Marpenoth", "Uktar", "Nightal"} | |||
elseif calendar == "IRL" then | elseif calendar == "IRL" then | ||
monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} | |||
end | end | ||
| Line 56: | Line 56: | ||
if shortDate[2] == nil then | if shortDate[2] == nil then | ||
dateTable = {nil, nil, nil, tonumber(shortDate[1]), "year"} | |||
elseif shortDate[3] == nil then | elseif shortDate[3] == nil then | ||
dateTable = {monthNames[tonumber(shortDate[1])], tonumber(shortDate[1]), nil, tonumber(shortDate[2]), "month-year"} | |||
else | else | ||
dateTable = {monthNames[tonumber(shortDate[1])], tonumber(shortDate[1]), tonumber(shortDate[2]), tonumber(shortDate[3]), "month-day-year"} | |||
end | end | ||
return dateTable | return dateTable | ||
| Line 66: | Line 66: | ||
--Writes that date based on what is given. | --Writes that date based on what is given. | ||
function writeDate( | function writeDate(dateTable) | ||
if | if dateTable[5] == "year" then | ||
return | return dateTable[4] | ||
elseif | elseif dateTable[5] == "month-year" then | ||
return | return dateTable[1].." ("..dateTable[2]..") "..dateTable[4] | ||
elseif | elseif dateTable[5] == "month-day-year" then | ||
return | return dateTable[1].." ("..dateTable[2]..") "..dateTable[3]..", "..dateTable[4] | ||
end | end | ||
end | end | ||
| Line 101: | Line 101: | ||
age = math.floor(secondDate[4] - birthDate[4]) | age = math.floor(secondDate[4] - birthDate[4]) | ||
elseif birthDate[2] == secondDate[2] then | elseif birthDate[2] == secondDate[2] then | ||
if | if birthDate[3] <= secondDate[3] then | ||
age = math.floor(secondDate[4] - birthDate[4]) | age = math.floor(secondDate[4] - birthDate[4]) | ||
elseif | elseif birthDate[3] > secondDate[3] then | ||
age = math.floor(secondDate[4] - birthDate[4] - 1) | age = math.floor(secondDate[4] - birthDate[4] - 1) | ||
end | end | ||
| Line 113: | Line 113: | ||
--Determines if age or aged is required | --Determines if age or aged is required | ||
if status == "alive" then | if status == "alive" then | ||
local longDate = writeDate(birthDate) | |||
return | return longDate.." (age "..age..")" | ||
elseif status == "dead" then | elseif status == "dead" then | ||
return writeDate(secondDate).." (aged "..age..")" | return writeDate(secondDate).." (aged "..age..")" | ||