Module:BassaridianCalendar: Difference between revisions
From MicrasWiki
Jump to navigationJump to search
NewZimiaGov (talk | contribs) No edit summary |
NewZimiaGov (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
function p.getCurrentDate() | 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 = 237 -- August 25th is Day 237 in Gregorian year | local yearStart = 237 -- August 25th is Day 237 in Gregorian year | ||
local calendarDays = 183 -- Total days in Bassaridian year | local calendarDays = 183 -- Total days in Bassaridian year | ||
local monthLength = 61 -- Each Bassaridian month has 61 days | local monthLength = 61 -- Each Bassaridian month has 61 days | ||
-- Adjust for Bassaridian calendar | -- Adjust for Bassaridian calendar | ||
local adjustedDay = yearDay - yearStart | local adjustedDay = yearDay - yearStart | ||
if adjustedDay < 0 then | if adjustedDay < 0 then | ||
adjustedDay = adjustedDay + totalDays -- | adjustedDay = adjustedDay + totalDays -- Adjust for wraparound to previous year | ||
end | end | ||
local bassaridianDay = (adjustedDay % calendarDays) + 1 | local bassaridianDay = (adjustedDay % calendarDays) + 1 | ||
-- Determine month, day, and zodiac sign | -- Determine month, day within the month, and zodiac sign | ||
local bassaridianMonth, bassaridianMonthDay, zodiacSign | local bassaridianMonth, bassaridianMonthDay, zodiacSign | ||
if bassaridianDay <= 61 then | if bassaridianDay <= 61 then | ||
bassaridianMonth = "Atosiel" | bassaridianMonth = "Atosiel" | ||
bassaridianMonthDay = bassaridianDay | bassaridianMonthDay = bassaridianDay | ||
if bassaridianMonthDay <= | if bassaridianMonthDay <= 12 then | ||
zodiacSign = "Atosien" | zodiacSign = "Atosien" | ||
elseif bassaridianMonthDay <= | elseif bassaridianMonthDay <= 24 then | ||
zodiacSign = "Eosena" | zodiacSign = "Eosena" | ||
elseif bassaridianMonthDay <= 36 then | |||
zodiacSign = "Micrasha" | |||
elseif bassaridianMonthDay <= 48 then | |||
zodiacSign = "Pyreska" | |||
else | else | ||
zodiacSign = " | zodiacSign = "Indomin" | ||
end | end | ||
elseif bassaridianDay <= 121 then -- Month 2: Thalassiel | elseif bassaridianDay <= 121 then -- Month 2: Thalassiel | ||
bassaridianMonth = "Thalassiel" | bassaridianMonth = "Thalassiel" | ||
bassaridianMonthDay = bassaridianDay - 61 | bassaridianMonthDay = bassaridianDay - 61 | ||
if bassaridianMonthDay <= | if bassaridianMonthDay <= 12 then | ||
zodiacSign = "Chrysen" | zodiacSign = "Chrysen" | ||
elseif bassaridianMonthDay <= | elseif bassaridianMonthDay <= 24 then | ||
zodiacSign = "Thalassian" | zodiacSign = "Thalassian" | ||
elseif bassaridianMonthDay <= 36 then | |||
zodiacSign = "Nephelia" | |||
elseif bassaridianMonthDay <= 48 then | |||
zodiacSign = "Glinaeus" | |||
else | else | ||
zodiacSign = " | zodiacSign = "Noctien" | ||
end | end | ||
else -- Month 3: Opsitheiel | else -- Month 3: Opsitheiel | ||
bassaridianMonth = "Opsitheiel" | bassaridianMonth = "Opsitheiel" | ||
bassaridianMonthDay = bassaridianDay - 121 | bassaridianMonthDay = bassaridianDay - 121 | ||
if bassaridianMonthDay <= | if bassaridianMonthDay <= 12 then | ||
zodiacSign = "Opsithia" | zodiacSign = "Opsithia" | ||
elseif bassaridianMonthDay <= | elseif bassaridianMonthDay <= 24 then | ||
zodiacSign = "Stygian" | zodiacSign = "Stygian" | ||
elseif bassaridianMonthDay <= 36 then | |||
zodiacSign = "Faunian" | |||
elseif bassaridianMonthDay <= 48 then | |||
zodiacSign = "Silenian" | |||
else | else | ||
zodiacSign = " | zodiacSign = "Catosien" | ||
end | end | ||
end | end | ||
Line 59: | Line 67: | ||
-- Event lookup table | -- Event lookup table | ||
local events = { | local events = { | ||
["Atosiel,6"] = "Bayram al-Nur (Festival of Light) in [ | ["Atosiel,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]]", | ||
["Atosiel,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]]", | |||
["Atosiel,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]]", | |||
["Thalassiel,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]]", | |||
["Thalassiel,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]]", | |||
["Opsitheiel,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]]", | |||
["Opsitheiel,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]]", | |||
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) in [[List of cities in Bassaridia Vaeringheim#Catonis Atrium|Catonis Atrium]]", | |||
} | } | ||
-- Find event for the current date | -- Find the event for the current date | ||
local eventKey = bassaridianMonth .. "," .. bassaridianMonthDay | local eventKey = bassaridianMonth .. "," .. bassaridianMonthDay | ||
local event = events[eventKey] or "No significant events today." | local event = events[eventKey] or "No significant events today." | ||
-- Return formatted date | -- Return the formatted date with a link to the Zodiac | ||
return bassaridianMonthDay .. ", " .. bassaridianMonth .. " (" .. zodiacSign .. "), 50 PSSC – " .. event | return bassaridianMonthDay .. ", " .. bassaridianMonth .. " (" .. "[[Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac|" .. zodiacSign .. "]]" .. "), 50 PSSC – " .. event | ||
end | end | ||
return p | return p |
Revision as of 00:15, 11 December 2024
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 = 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 end local bassaridianDay = (adjustedDay % calendarDays) + 1 -- Determine month, day within the month, and zodiac sign local bassaridianMonth, bassaridianMonthDay, zodiacSign if bassaridianDay <= 61 then bassaridianMonth = "Atosiel" bassaridianMonthDay = bassaridianDay if bassaridianMonthDay <= 12 then zodiacSign = "Atosien" elseif bassaridianMonthDay <= 24 then zodiacSign = "Eosena" elseif bassaridianMonthDay <= 36 then zodiacSign = "Micrasha" elseif bassaridianMonthDay <= 48 then zodiacSign = "Pyreska" else zodiacSign = "Indomin" end elseif bassaridianDay <= 121 then -- Month 2: Thalassiel bassaridianMonth = "Thalassiel" bassaridianMonthDay = bassaridianDay - 61 if bassaridianMonthDay <= 12 then zodiacSign = "Chrysen" elseif bassaridianMonthDay <= 24 then zodiacSign = "Thalassian" elseif bassaridianMonthDay <= 36 then zodiacSign = "Nephelia" elseif bassaridianMonthDay <= 48 then zodiacSign = "Glinaeus" else zodiacSign = "Noctien" end else -- Month 3: Opsitheiel bassaridianMonth = "Opsitheiel" 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 -- Event lookup table local events = { ["Atosiel,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]]", ["Atosiel,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]]", ["Atosiel,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]]", ["Thalassiel,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]]", ["Thalassiel,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]]", ["Opsitheiel,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]]", ["Opsitheiel,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]]", ["Opsitheiel,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 eventKey = bassaridianMonth .. "," .. bassaridianMonthDay local event = events[eventKey] or "No significant events today." -- Return the formatted date with a link to the Zodiac return bassaridianMonthDay .. ", " .. bassaridianMonth .. " (" .. "[[Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac|" .. zodiacSign .. "]]" .. "), 50 PSSC – " .. event end return p