Module:BassaridianCalendar: Difference between revisions
From MicrasWiki
Jump to navigationJump to search
NewZimiaGov (talk | contribs) No edit summary Tag: Manual revert |
NewZimiaGov (talk | contribs) No edit summary |
||
| Line 2: | Line 2: | ||
function p.getCurrentDate() | function p.getCurrentDate() | ||
-- | -- Constants | ||
local | local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999 | ||
local secondsInDay = 24 * 60 * 60 -- Number of seconds in a day | |||
local | local daysPerYear = 183 | ||
local | local yearStartDay = 1 | ||
local | local monthLength = 61 | ||
local psscStartYear = 50 | |||
-- | -- Current date | ||
local | local currentDate = os.time() | ||
local | local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay) | ||
-- | -- Calculate PSSC year and day | ||
local | local psscYear = math.floor(totalDaysElapsed / daysPerYear) + psscStartYear | ||
local dayOfYear = (totalDaysElapsed % daysPerYear) + 1 | |||
local | |||
-- Determine month | -- Determine month and day within the month | ||
local | local month, dayInMonth, zodiac | ||
if | if dayOfYear <= monthLength then | ||
month = "Atosiel" | |||
if | dayInMonth = dayOfYear | ||
if dayInMonth <= 12 then | |||
elseif | zodiac = "Atosien" | ||
elseif dayInMonth <= 24 then | |||
elseif | zodiac = "Eosena" | ||
elseif dayInMonth <= 36 then | |||
elseif | zodiac = "Micrasha" | ||
elseif dayInMonth <= 48 then | |||
zodiac = "Pyreska" | |||
else | else | ||
zodiac = "Indomin" | |||
end | end | ||
elseif | elseif dayOfYear <= 2 * monthLength then | ||
month = "Thalassiel" | |||
dayInMonth = dayOfYear - monthLength | |||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = "Chrysen" | |||
elseif dayInMonth <= 24 then | elseif dayInMonth <= 24 then | ||
zodiac = "Thalassian" | |||
elseif dayInMonth <= 36 then | elseif dayInMonth <= 36 then | ||
zodiac = "Nephelia" | |||
elseif dayInMonth <= 48 then | elseif dayInMonth <= 48 then | ||
zodiac = "Glinaeus" | |||
else | else | ||
zodiac = "Noctien" | |||
end | end | ||
else | else | ||
month = "Opsitheiel" | |||
dayInMonth = dayOfYear - 2 * monthLength | |||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = "Opsithia" | |||
elseif dayInMonth <= 24 then | elseif dayInMonth <= 24 then | ||
zodiac = "Stygian" | |||
elseif dayInMonth <= 36 then | elseif dayInMonth <= 36 then | ||
zodiac = "Faunian" | |||
elseif dayInMonth <= 48 then | elseif dayInMonth <= 48 then | ||
zodiac = "Silenian" | |||
else | else | ||
zodiac = "Catosien" | |||
end | end | ||
end | end | ||
| Line 68: | Line 66: | ||
-- Event lookup table | -- Event lookup table | ||
local events = { | local events = { | ||
["6 | ["Atosiel,6"] = "Bayram al-Nur (Festival of Light)", | ||
["18 | ["Atosiel,18"] = "Chag Or Hadash (Festival of New Light)", | ||
["30 | ["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony)", | ||
["43 | ["Atosiel,43"] = "Alev Günü (Day of Flame)", | ||
["55 | ["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows)", | ||
["67 | ["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering)", | ||
["80 | ["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide)", | ||
["92 | ["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination)", | ||
["105 | ["Thalassiel,105"] = "Erev Galgal (Eve of Cycles)", | ||
["115 | ["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon)", | ||
["128 | ["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest)", | ||
["140 | ["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth)", | ||
["150 | ["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper)", | ||
["165 | ["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration)", | ||
["175 | ["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration)" | ||
} | } | ||
-- | -- Determine the event for the current day | ||
local eventKey = | local eventKey = month .. "," .. dayInMonth | ||
local event = events[eventKey] or "No significant events today." | local event = events[eventKey] or "No significant events today." | ||
-- Return the formatted date | -- Return the formatted date | ||
return | return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event | ||
end | end | ||
return p | return p | ||
Revision as of 02:37, 11 December 2024
Documentation for this module may be created at Module:BassaridianCalendar/doc
local p = {}
function p.getCurrentDate()
-- Constants
local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999
local secondsInDay = 24 * 60 * 60 -- Number of seconds in a day
local daysPerYear = 183
local yearStartDay = 1
local monthLength = 61
local psscStartYear = 50
-- Current date
local currentDate = os.time()
local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay)
-- Calculate PSSC year and day
local psscYear = math.floor(totalDaysElapsed / daysPerYear) + psscStartYear
local dayOfYear = (totalDaysElapsed % daysPerYear) + 1
-- Determine month and day within the month
local month, dayInMonth, zodiac
if dayOfYear <= monthLength then
month = "Atosiel"
dayInMonth = dayOfYear
if dayInMonth <= 12 then
zodiac = "Atosien"
elseif dayInMonth <= 24 then
zodiac = "Eosena"
elseif dayInMonth <= 36 then
zodiac = "Micrasha"
elseif dayInMonth <= 48 then
zodiac = "Pyreska"
else
zodiac = "Indomin"
end
elseif dayOfYear <= 2 * monthLength then
month = "Thalassiel"
dayInMonth = dayOfYear - monthLength
if dayInMonth <= 12 then
zodiac = "Chrysen"
elseif dayInMonth <= 24 then
zodiac = "Thalassian"
elseif dayInMonth <= 36 then
zodiac = "Nephelia"
elseif dayInMonth <= 48 then
zodiac = "Glinaeus"
else
zodiac = "Noctien"
end
else
month = "Opsitheiel"
dayInMonth = dayOfYear - 2 * monthLength
if dayInMonth <= 12 then
zodiac = "Opsithia"
elseif dayInMonth <= 24 then
zodiac = "Stygian"
elseif dayInMonth <= 36 then
zodiac = "Faunian"
elseif dayInMonth <= 48 then
zodiac = "Silenian"
else
zodiac = "Catosien"
end
end
-- Event lookup table
local events = {
["Atosiel,6"] = "Bayram al-Nur (Festival of Light)",
["Atosiel,18"] = "Chag Or Hadash (Festival of New Light)",
["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony)",
["Atosiel,43"] = "Alev Günü (Day of Flame)",
["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows)",
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering)",
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide)",
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination)",
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles)",
["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon)",
["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest)",
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth)",
["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper)",
["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration)",
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration)"
}
-- Determine the event for the current day
local eventKey = month .. "," .. dayInMonth
local event = events[eventKey] or "No significant events today."
-- Return the formatted date
return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event
end
return p