Module:BassaridianCalendar: Difference between revisions

From MicrasWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 15: Line 15:
     local yearStart = isLeapYear and 238 or 237 -- Adjusted for leap years
     local yearStart = isLeapYear and 238 or 237 -- Adjusted for leap years
     local calendarDays = 183 -- Total days in the Bassaridian year
     local calendarDays = 183 -- Total days in the Bassaridian year
    local monthLength = 61 -- Each Bassaridian month has 61 days


     -- Adjust for Bassaridian calendar
     -- Adjust for Bassaridian calendar
Line 25: Line 24:
     local bassaridianDay = (adjustedDay % calendarDays) + 1
     local bassaridianDay = (adjustedDay % calendarDays) + 1


     -- Determine month, day within the month, and zodiac sign
     -- Determine zodiac sign based on continuous day count
     local bassaridianMonth, bassaridianMonthDay, zodiacSign
     local zodiacSign
     if bassaridianDay <= 61 then -- Month 1: Atosiel
     if bassaridianDay <= 12 then
         bassaridianMonth = "Atosiel"
         zodiacSign = "Atosien"
        bassaridianMonthDay = bassaridianDay
    elseif bassaridianDay <= 24 then
        if bassaridianMonthDay <= 12 then
        zodiacSign = "Eosena"
            zodiacSign = "Atosien"
    elseif bassaridianDay <= 36 then
        elseif bassaridianMonthDay <= 24 then
        zodiacSign = "Micrasha"
            zodiacSign = "Eosena"
    elseif bassaridianDay <= 48 then
        elseif bassaridianMonthDay <= 36 then
        zodiacSign = "Pyreska"
            zodiacSign = "Micrasha"
     elseif bassaridianDay <= 61 then
        elseif bassaridianMonthDay <= 48 then
         zodiacSign = "Indomin"
            zodiacSign = "Pyreska"
    elseif bassaridianDay <= 73 then
        else
        zodiacSign = "Chrysen"
            zodiacSign = "Indomin"
    elseif bassaridianDay <= 85 then
        end
        zodiacSign = "Thalassian"
     elseif bassaridianDay <= 121 then -- Month 2: Thalassiel
    elseif bassaridianDay <= 97 then
         bassaridianMonth = "Thalassiel"
        zodiacSign = "Nephelia"
        bassaridianMonthDay = bassaridianDay - 61
    elseif bassaridianDay <= 109 then
        if bassaridianMonthDay <= 12 then
        zodiacSign = "Glinaeus"
            zodiacSign = "Chrysen"
    elseif bassaridianDay <= 121 then
        elseif bassaridianMonthDay <= 24 then
         zodiacSign = "Noctien"
            zodiacSign = "Thalassian"
     elseif bassaridianDay <= 133 then
        elseif bassaridianMonthDay <= 36 then
        zodiacSign = "Opsithia"
            zodiacSign = "Nephelia"
    elseif bassaridianDay <= 145 then
        elseif bassaridianMonthDay <= 48 then
        zodiacSign = "Stygian"
            zodiacSign = "Glinaeus"
    elseif bassaridianDay <= 157 then
         else
        zodiacSign = "Faunian"
            zodiacSign = "Noctien"
    elseif bassaridianDay <= 169 then
        end
        zodiacSign = "Silenian"
     else -- Month 3: Opsitheiel
    else
        bassaridianMonth = "Opsitheiel"
        zodiacSign = "Catosien"
        bassaridianMonthDay = bassaridianDay - 121
        if bassaridianMonthDay <= 12 then
            zodiacSign = "Opsithia"
        elseif bassaridianMonthDay <= 24 then
            zodiacSign = "Stygian"
        elseif bassaridianMonthDay <= 36 then
            zodiacSign = "Faunian"
        elseif bassaridianMonthDay <= 48 then
            zodiacSign = "Silenian"
        else
            zodiacSign = "Catosien"
        end
     end
     end


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


     -- Find the event for the current date
     -- Find the event for the current date
    local eventKey = bassaridianMonth .. "," .. bassaridianMonthDay
     local event = events[bassaridianDay] or "No significant events today."
     local event = events[eventKey] or "No significant events today."


     -- Return the formatted date
     -- Return the formatted date
     return bassaridianMonthDay .. ", " .. bassaridianMonth .. " (" .. zodiacSign .. "), 50 PSSC – " .. event
     return bassaridianDay .. " (" .. zodiacSign .. "), 50 PSSC – " .. event
end
end


return p
return p

Revision as of 00:40, 11 December 2024

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

local p = {}

function p.getCurrentDate()
    -- Get the current date in UTC and adjust to CDT
    local currentDate = os.date("!*t")
    local timeOffset = -6 * 60 * 60 -- CDT offset from UTC in seconds
    local adjustedTime = os.time(currentDate) + timeOffset
    local yearDay = tonumber(os.date("!%j", adjustedTime))

    -- Determine if the year is a leap year
    local isLeapYear = (currentDate.year % 4 == 0 and (currentDate.year % 100 ~= 0 or currentDate.year % 400 == 0))
    local totalDays = isLeapYear and 366 or 365 -- Total days in the Gregorian year

    -- Bassaridian calendar constants
    local yearStart = isLeapYear and 238 or 237 -- Adjusted for leap years
    local calendarDays = 183 -- Total days in the Bassaridian year

    -- Adjust for Bassaridian calendar
    local adjustedDay = yearDay - yearStart
    if adjustedDay < 0 then
        adjustedDay = adjustedDay + totalDays -- Adjust for wraparound to the previous year
    end
    adjustedDay = adjustedDay + 1 -- Fine-tune day alignment
    local bassaridianDay = (adjustedDay % calendarDays) + 1

    -- Determine zodiac sign based on continuous day count
    local zodiacSign
    if bassaridianDay <= 12 then
        zodiacSign = "Atosien"
    elseif bassaridianDay <= 24 then
        zodiacSign = "Eosena"
    elseif bassaridianDay <= 36 then
        zodiacSign = "Micrasha"
    elseif bassaridianDay <= 48 then
        zodiacSign = "Pyreska"
    elseif bassaridianDay <= 61 then
        zodiacSign = "Indomin"
    elseif bassaridianDay <= 73 then
        zodiacSign = "Chrysen"
    elseif bassaridianDay <= 85 then
        zodiacSign = "Thalassian"
    elseif bassaridianDay <= 97 then
        zodiacSign = "Nephelia"
    elseif bassaridianDay <= 109 then
        zodiacSign = "Glinaeus"
    elseif bassaridianDay <= 121 then
        zodiacSign = "Noctien"
    elseif bassaridianDay <= 133 then
        zodiacSign = "Opsithia"
    elseif bassaridianDay <= 145 then
        zodiacSign = "Stygian"
    elseif bassaridianDay <= 157 then
        zodiacSign = "Faunian"
    elseif bassaridianDay <= 169 then
        zodiacSign = "Silenian"
    else
        zodiacSign = "Catosien"
    end

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

    -- Find the event for the current date
    local event = events[bassaridianDay] or "No significant events today."

    -- Return the formatted date
    return bassaridianDay .. " (" .. zodiacSign .. "), 50 PSSC – " .. event
end

return p