Module:BassaridianCalendar

From MicrasWiki
Revision as of 03:46, 12 December 2024 by NewZimiaGov (talk | contribs)
Jump to navigationJump to search

Documentation for this module may be created at Module:BassaridianCalendar/doc

local p = {}

function p.getCurrentDate()
    local startDate = os.time({year = 1999, month = 8, day = 6})
    local secondsInDay = 86400
    local daysPerYear = 183

    local currentDate = os.time()
    local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay)

    local yearFraction = totalDaysElapsed / daysPerYear
    local psscYear = math.floor(yearFraction)
    local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1

    local zodiacProverbs = {
        Atosien = {
            "In the first light, the cycle of renewal begins anew.",
            "Through wisdom, the sacred path is revealed.",
            "Light burns through the fog of ignorance."},
        Eosena = {
            "Each dawn is a step towards divine understanding.",
            "Hope rises with the breaking of the day.",
            "The morning light speaks of purpose."},
        Micrasha = {
            "Balance is the foundation of wisdom.",
            "To lead is to find harmony in discord.",
            "Justice is measured in equal parts."},
        Pyreska = {
            "Fire ignites the passion of creation.",
            "Through flame, the world is reshaped.",
            "Boldness is born in the furnace of challenge."},
        Indomin = {
            "Duality is the essence of existence.",
            "Strength grows in the embrace of change.",
            "Unity weaves the fabric of the cosmos."},
        Chrysen = {
            "Gold tests the purity of the soul.",
            "Wealth is a tool for those who wield it with wisdom.",
            "Abundance follows the diligent."},
        Thalassian = {
            "The tides teach patience and persistence.",
            "Wisdom flows with the currents of the sea.",
            "Depth reveals the mysteries of existence."},
        Nephelia = {
            "Dreams guide the soul to its true calling.",
            "Imagination bridges the mortal and divine.",
            "The night whispers secrets to the bold."},
        Glinaeus = {
            "Frost preserves what must endure.",
            "The cycles of time renew all things.",
            "Resilience grows in the cold."},
        Noctien = {
            "In shadows, clarity emerges.",
            "The night reveals what daylight obscures.",
            "Silence is the ally of discovery."},
        Opsithia = {
            "The harvest feeds both body and spirit.",
            "Fertility lies in the embrace of the earth.",
            "Abundance springs from gratitude."},
        Stygian = {
            "Transformation is the essence of the Styx.",
            "Through courage, rebirth is attained.",
            "The river flows with the promise of change."},
        Faunian = {
            "Nature sings of balance and harmony.",
            "Life thrives where nurture and care abound.",
            "The forest echoes with the pulse of life."},
        Silenian = {
            "Celebration renews the weary spirit.",
            "Revelry is a gift of the divine.",
            "Joy is the fruit of community."},
        Catosien = {
            "Discipline shapes greatness.",
            "Order is the path to enlightenment.",
            "The straight path leads to ascension."}
    }

    local month, dayInMonth, zodiac
    if dayOfYear <= 61 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 <= 122 then
        month = "Thalassiel"
        dayInMonth = dayOfYear - 61
        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 - 122
        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

    local events = {
        ["Atosiel,6"] = "Bayram al-Nur (Festival of Light) [Vaeringheim]",
        ["Atosiel,18"] = "Chag Or Hadash (Festival of New Light) [Luminaria]",
        ["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony) [Serena]",
        ["Atosiel,43"] = "Alev Günü (Day of Flame) [Pyralis]",
        ["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows) [Symphonara]",
        ["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering) [Aurelia]",
        ["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide) [Vaeringheim]",
        ["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination) [Somniumpolis]",
        ["Thalassiel,105"] = "Erev Galgal (Eve of Cycles) [Nexa]",
        ["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon) [Lunalis Sancta]",
        ["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest) [Sylvapolis]",
        ["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth) [Acheron]",
        ["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper) [Sylvapolis]",
        ["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration) [Erythros]",
        ["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) [Catonis Atrium]"
    }

    local eventKey = month .. "," .. dayInMonth
    local event = events[eventKey] or "No significant events today."

    local zodiacProverbsList = zodiacProverbs[zodiac]
    local daySeed = ((totalDaysElapsed - 1) % #zodiacProverbsList) + 1
    local dailyProverb = zodiacProverbsList[daySeed]

    return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event .. " – Proverb: " .. dailyProverb
end

return p