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 4: | Line 4: | ||
-- Constants | -- Constants | ||
local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999 | local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999 | ||
local secondsInDay = 24 * 60 * 60 | local secondsInDay = 24 * 60 * 60 | ||
local daysPerYear = 183 | local daysPerYear = 183 | ||
| Line 10: | Line 10: | ||
local currentDate = os.time() | local currentDate = os.time() | ||
local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay) | local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay) | ||
local yearFraction = totalDaysElapsed / daysPerYear | local yearFraction = totalDaysElapsed / daysPerYear | ||
local psscYear = math.floor(yearFraction) | local psscYear = math.floor(yearFraction) | ||
local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1 | local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1 | ||
-- Determine month, day | -- Determine month, day, zodiac | ||
local month, dayInMonth, zodiac | local month, dayInMonth, zodiac | ||
local zodiacs = { | |||
Atosiel = {"Atosien", "Eosena", "Micrasha", "Pyreska", "Indomin"}, | |||
Thalassiel = {"Chrysen", "Thalassian", "Nephelia", "Glinaeus", "Noctien"}, | |||
Opsitheiel = {"Opsithia", "Stygian", "Faunian", "Silenian", "Catosien"} | |||
} | |||
if dayOfYear <= 61 then | if dayOfYear <= 61 then | ||
month = "Atosiel" | month = "Atosiel" | ||
dayInMonth = dayOfYear | dayInMonth = dayOfYear | ||
elseif dayOfYear <= 122 then | elseif dayOfYear <= 122 then | ||
month = "Thalassiel" | month = "Thalassiel" | ||
dayInMonth = dayOfYear - 61 | dayInMonth = dayOfYear - 61 | ||
else | else | ||
month = "Opsitheiel" | month = "Opsitheiel" | ||
dayInMonth = dayOfYear - 122 | dayInMonth = dayOfYear - 122 | ||
end | end | ||
local zodiacIndex = math.ceil(dayInMonth / 12.2) | |||
local | zodiac = zodiacs[month][zodiacIndex] | ||
-- Event | -- Event table with links | ||
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 [ | ["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 [ | ["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 [ | ["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 [ | ["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows) in [[List of cities in Bassaridia Vaeringheim#Symphonara|Symphonara]]", | ||
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering) in [ | ["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering) in [[List of cities in Bassaridia Vaeringheim#Aurelia|Aurelia]]", | ||
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide) in [ | ["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide) in [[List of cities in Bassaridia Vaeringheim#Vaeringheim|Vaeringheim]]", | ||
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination) in [ | ["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination) in [[List of cities in Bassaridia Vaeringheim#Somniumpolis|Somniumpolis]]", | ||
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles) in [ | ["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 [ | ["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 [ | ["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest) in [[List of cities in Bassaridia Vaeringheim#Sylvapolis|Sylvapolis]]", | ||
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth) in [ | ["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 [ | ["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 [ | ["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration) in [[List of cities in Bassaridia Vaeringheim#Erythros|Erythros]]", | ||
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) in [ | ["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration) in [[List of cities in Bassaridia Vaeringheim#Catonis Atrium|Catonis Atrium]]" | ||
} | } | ||
-- | -- Generate proverb and event | ||
local eventKey = month .. "," .. dayInMonth | local eventKey = month .. "," .. dayInMonth | ||
local event = events[eventKey] or "No significant events today." | local event = events[eventKey] or "No significant events today." | ||
local proverb = "Proverb of " .. zodiac .. ": Seek balance and purpose." | |||
-- Return | -- Return formatted date | ||
return dayOfYear .. ", " .. month .. " ( | return dayOfYear .. ", " .. month .. " ([[Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac|" .. zodiac .. "]]), " .. psscYear .. " PSSC – " .. event .. " – " .. proverb | ||
end | end | ||
return p | return p | ||
Revision as of 03:26, 11 December 2024
Documentation for this module may be created at Module:BassaridianCalendar/doc
local p = {}
function p.getCurrentDate()
-- Constants
local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999
local secondsInDay = 24 * 60 * 60
local daysPerYear = 183
-- Current date
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
-- Determine month, day, zodiac
local month, dayInMonth, zodiac
local zodiacs = {
Atosiel = {"Atosien", "Eosena", "Micrasha", "Pyreska", "Indomin"},
Thalassiel = {"Chrysen", "Thalassian", "Nephelia", "Glinaeus", "Noctien"},
Opsitheiel = {"Opsithia", "Stygian", "Faunian", "Silenian", "Catosien"}
}
if dayOfYear <= 61 then
month = "Atosiel"
dayInMonth = dayOfYear
elseif dayOfYear <= 122 then
month = "Thalassiel"
dayInMonth = dayOfYear - 61
else
month = "Opsitheiel"
dayInMonth = dayOfYear - 122
end
local zodiacIndex = math.ceil(dayInMonth / 12.2)
zodiac = zodiacs[month][zodiacIndex]
-- Event table with links
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]]"
}
-- Generate proverb and event
local eventKey = month .. "," .. dayInMonth
local event = events[eventKey] or "No significant events today."
local proverb = "Proverb of " .. zodiac .. ": Seek balance and purpose."
-- Return formatted date
return dayOfYear .. ", " .. month .. " ([[Reformed_Stripping_Path#Overview_of_the_Bassaridian_Zodiac|" .. zodiac .. "]]), " .. psscYear .. " PSSC – " .. event .. " – " .. proverb
end
return p