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 | -- Get the current Gregorian date | ||
local | local yearDay = tonumber(os.date("%j")) -- Day of the Gregorian 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 | local totalDays = isLeapYear and 366 or 365 -- Days in the Gregorian year | ||
local totalDays = isLeapYear and 366 or 365 -- | |||
-- Bassaridian calendar constants | -- Bassaridian calendar constants | ||
local yearStart = | local yearStart = 237 -- August 25th is Day 237 in the Gregorian calendar | ||
local calendarDays = 183 -- Total days in the Bassaridian year | local calendarDays = 183 -- Total days in the Bassaridian year | ||
-- Adjust for Bassaridian calendar | -- Adjust for the Bassaridian calendar | ||
local adjustedDay = yearDay - yearStart | local adjustedDay = yearDay - yearStart | ||
if adjustedDay < 0 then | if adjustedDay < 0 then | ||
adjustedDay = adjustedDay + totalDays -- Adjust for wraparound to | adjustedDay = adjustedDay + totalDays -- Adjust for wraparound to previous year | ||
end | end | ||
local bassaridianDay = (adjustedDay % calendarDays) + 1 | local bassaridianDay = (adjustedDay % calendarDays) + 1 | ||
-- | -- Define months and zodiac ranges | ||
local | local months = { | ||
{name = "Atosiel", startDay = 1, endDay = 61}, | |||
{name = "Thalassiel", startDay = 62, endDay = 121}, | |||
{name = "Opsitheiel", startDay = 122, endDay = 183} | |||
} | |||
local zodiacs = { | |||
{name = "Atosien", startDay = 1, endDay = 12}, | |||
{name = "Eosena", startDay = 13, endDay = 24}, | |||
{name = "Micrasha", startDay = 25, endDay = 36}, | |||
{name = "Pyreska", startDay = 37, endDay = 48}, | |||
{name = "Indomin", startDay = 49, endDay = 61}, | |||
{name = "Chrysen", startDay = 62, endDay = 73}, | |||
{name = "Thalassian", startDay = 74, endDay = 85}, | |||
{name = "Nephelia", startDay = 86, endDay = 97}, | |||
{name = "Glinaeus", startDay = 98, endDay = 109}, | |||
{name = "Noctien", startDay = 110, endDay = 121}, | |||
{name = "Opsithia", startDay = 122, endDay = 133}, | |||
{name = "Stygian", startDay = 134, endDay = 145}, | |||
{name = "Faunian", startDay = 146, endDay = 157}, | |||
{name = "Silenian", startDay = 158, endDay = 169}, | |||
{name = "Catosien", startDay = 170, endDay = 183} | |||
} | |||
-- Determine the month | |||
local bassaridianMonth = "" | |||
for _, month in ipairs(months) do | |||
if bassaridianDay >= month.startDay and bassaridianDay <= month.endDay then | |||
zodiacSign = " | bassaridianMonth = month.name | ||
break | |||
zodiacSign = | end | ||
end | |||
-- Determine the zodiac sign | |||
local zodiacSign = "" | |||
for _, zodiac in ipairs(zodiacs) do | |||
if bassaridianDay >= zodiac.startDay and bassaridianDay <= zodiac.endDay then | |||
zodiacSign = zodiac.name | |||
break | |||
end | |||
end | end | ||
-- Event lookup table | -- Event lookup table | ||
local events = { | local events = { | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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]]", | ||
[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 event = events[bassaridianDay] or "No significant events today." | local event = events[tostring(bassaridianDay)] or "No significant events today." | ||
-- Return the formatted date | -- Return the formatted date | ||
return bassaridianDay .. " (" .. zodiacSign .. "), 50 PSSC – " .. event | return bassaridianDay .. ", " .. bassaridianMonth .. " (" .. zodiacSign .. "), 50 PSSC – " .. event | ||
end | end | ||
return p | return p | ||
Revision as of 00:44, 11 December 2024
Documentation for this module may be created at Module:BassaridianCalendar/doc
local p = {}
function p.getCurrentDate()
-- Get the current Gregorian date
local yearDay = tonumber(os.date("%j")) -- Day of the Gregorian 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 -- Days in the Gregorian year
-- Bassaridian calendar constants
local yearStart = 237 -- August 25th is Day 237 in the Gregorian calendar
local calendarDays = 183 -- Total days in the Bassaridian year
-- Adjust for the 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
-- Define months and zodiac ranges
local months = {
{name = "Atosiel", startDay = 1, endDay = 61},
{name = "Thalassiel", startDay = 62, endDay = 121},
{name = "Opsitheiel", startDay = 122, endDay = 183}
}
local zodiacs = {
{name = "Atosien", startDay = 1, endDay = 12},
{name = "Eosena", startDay = 13, endDay = 24},
{name = "Micrasha", startDay = 25, endDay = 36},
{name = "Pyreska", startDay = 37, endDay = 48},
{name = "Indomin", startDay = 49, endDay = 61},
{name = "Chrysen", startDay = 62, endDay = 73},
{name = "Thalassian", startDay = 74, endDay = 85},
{name = "Nephelia", startDay = 86, endDay = 97},
{name = "Glinaeus", startDay = 98, endDay = 109},
{name = "Noctien", startDay = 110, endDay = 121},
{name = "Opsithia", startDay = 122, endDay = 133},
{name = "Stygian", startDay = 134, endDay = 145},
{name = "Faunian", startDay = 146, endDay = 157},
{name = "Silenian", startDay = 158, endDay = 169},
{name = "Catosien", startDay = 170, endDay = 183}
}
-- Determine the month
local bassaridianMonth = ""
for _, month in ipairs(months) do
if bassaridianDay >= month.startDay and bassaridianDay <= month.endDay then
bassaridianMonth = month.name
break
end
end
-- Determine the zodiac sign
local zodiacSign = ""
for _, zodiac in ipairs(zodiacs) do
if bassaridianDay >= zodiac.startDay and bassaridianDay <= zodiac.endDay then
zodiacSign = zodiac.name
break
end
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[tostring(bassaridianDay)] or "No significant events today."
-- Return the formatted date
return bassaridianDay .. ", " .. bassaridianMonth .. " (" .. zodiacSign .. "), 50 PSSC – " .. event
end
return p