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 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 = 240 -- August 28th is Day 240 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
end
local bassaridianDay = (adjustedDay % calendarDays) + 1
-- Determine month, day within the month, and zodiac sign
local bassaridianMonth, bassaridianMonthDay, zodiacSign
if bassaridianDay <= monthLength then
bassaridianMonth = "Atosiel"
bassaridianMonthDay = bassaridianDay
if bassaridianMonthDay <= 20 then
zodiacSign = "Atosien"
elseif bassaridianMonthDay <= 40 then
zodiacSign = "Eosena"
else
zodiacSign = "Micrasha"
end
elseif bassaridianDay <= 2 * monthLength then
bassaridianMonth = "Thalassiel"
bassaridianMonthDay = bassaridianDay - monthLength
if bassaridianMonthDay <= 20 then
zodiacSign = "Chrysen"
elseif bassaridianMonthDay <= 40 then
zodiacSign = "Thalassian"
else
zodiacSign = "Nephelia"
end
else
bassaridianMonth = "Opsitheiel"
bassaridianMonthDay = bassaridianDay - (2 * monthLength)
if bassaridianMonthDay <= 20 then
zodiacSign = "Opsithia"
elseif bassaridianMonthDay <= 40 then
zodiacSign = "Stygian"
else
zodiacSign = "Faunian"
end
end
-- Event lookup table
local events = {
["Atosiel,6"] = "Bayram al-Nur (Festival of Light) in Vaeringheim",
["Atosiel,18"] = "Chag Or Hadash (Festival of New Light) in Luminaria",
["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony) in Serena",
["Atosiel,43"] = "Alev Günü (Day of Flame) in Pyralis",
["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows) in Symphonara",
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering) in Aurelia",
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide) in Vaeringheim",
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination) in Somniumpolis",
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles) in Nexa",
["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon) in Lunalis Sancta",
["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest) in Sylvapolis",
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth) in Acheron",
["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper) in Sylvapolis",
["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration) in Erythros",
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) in 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 bassaridianMonth .. ", Day " .. bassaridianMonthDay .. " (" .. zodiacSign .. ") – " .. event
end
return p