Module:BassaridianCalendar
From MicrasWiki
Documentation for this module may be created at Module:BassaridianCalendar/doc
local p = {}
function p.getCurrentDate()
-- Get the current date
local yearDay = tonumber(os.date("%j")) -- Day of the year (1-365/366)
local currentYear = 50 -- Current PSSC year
local isLeapYear = (tonumber(os.date("%Y")) % 4 == 0 and (tonumber(os.date("%Y")) % 100 ~= 0 or tonumber(os.date("%Y")) % 400 == 0))
local totalDays = isLeapYear and 366 or 365 -- Total days in the Gregorian year
-- Bassaridian calendar constants
local yearStart = 237 -- August 25th is Day 237 in Gregorian year
local calendarDays = 183 -- Total days in Bassaridian year
local monthLength = 61 -- Each Bassaridian month has 61 days
-- Adjust for Bassaridian calendar
local adjustedDay = yearDay - yearStart
if adjustedDay < 0 then
adjustedDay = adjustedDay + totalDays -- Adjust for wraparound to previous year
currentYear = currentYear - 1
end
local bassaridianDay = (adjustedDay % calendarDays) + 1
-- Determine month and day within the month
local bassaridianMonth, bassaridianMonthDay
if bassaridianDay <= 61 then
bassaridianMonth = "Atosiel"
bassaridianMonthDay = bassaridianDay
elseif bassaridianDay <= 121 then
bassaridianMonth = "Thalassiel"
bassaridianMonthDay = bassaridianDay - 61
else
bassaridianMonth = "Opsitheiel"
bassaridianMonthDay = bassaridianDay - 121
end
-- Determine Zodiac sign
local zodiacSign
if bassaridianMonth == "Atosiel" then
if bassaridianMonthDay <= 12 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Atosien]"
elseif bassaridianMonthDay <= 24 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Eosena]"
elseif bassaridianMonthDay <= 36 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Micrasha]"
elseif bassaridianMonthDay <= 48 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Pyreska]"
else
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Indomin]"
end
elseif bassaridianMonth == "Thalassiel" then
if bassaridianMonthDay <= 12 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Chrysen]"
elseif bassaridianMonthDay <= 24 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Thalassian]"
elseif bassaridianMonthDay <= 48 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Nephelia]"
else
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Glinaeus]"
end
elseif bassaridianMonth == "Opsitheiel" then
if bassaridianMonthDay <= 12 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Opsithia]"
elseif bassaridianMonthDay <= 24 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Stygian]"
elseif bassaridianMonthDay <= 36 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Faunian]"
elseif bassaridianMonthDay <= 48 then
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Silenian]"
else
zodiacSign = "[https://micras.org/mwiki/Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac Catosien]"
end
end
-- Event lookup table with links
local events = {
["Atosiel,6"] = "Bayram al-Nur (Festival of Light) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Vaeringheim Vaeringheim]",
["Atosiel,18"] = "Chag Or Hadash (Festival of New Light) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Luminaria Luminaria]",
["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Serena Serena]",
["Atosiel,43"] = "Alev Günü (Day of Flame) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Pyralis Pyralis]",
["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Symphonara Symphonara]",
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Aurelia Aurelia]",
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Vaeringheim Vaeringheim]",
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Somniumpolis Somniumpolis]",
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Nexa Nexa]",
["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Lunalis_Sancta Lunalis Sancta]",
["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Sylvapolis Sylvapolis]",
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Acheron Acheron]",
["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Sylvapolis Sylvapolis]",
["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Erythros Erythros]",
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) in [https://micras.org/mwiki/List_of_cities_in_Bassaridia_Vaeringheim#Catonis_Atrium Catonis Atrium]",
}
-- Find the event for the current date
local eventKey = bassaridianMonth .. "," .. bassaridianMonthDay
local event = events[eventKey] or "No significant events today."
-- Return the full date, zodiac sign, and event
return bassaridianMonthDay .. ", " .. bassaridianMonth .. " " .. zodiacSign .. ", " .. currentYear .. " PSSC – " .. event
end
return p