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 1: | Line 1: | ||
local p = {} | local p = {} | ||
| Line 14: | Line 13: | ||
-- Calculate PSSC year and day | -- Calculate PSSC year and day | ||
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 within the month, and zodiac | |||
-- Determine month | |||
local month, dayInMonth, zodiac | local month, dayInMonth, zodiac | ||
if dayOfYear <= 61 then | if dayOfYear <= 61 then | ||
| Line 26: | Line 22: | ||
dayInMonth = dayOfYear | dayInMonth = dayOfYear | ||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = " | zodiac = "Atosien" | ||
elseif dayInMonth <= 24 then | elseif dayInMonth <= 24 then | ||
zodiac = " | zodiac = "Eosena" | ||
elseif dayInMonth <= 36 then | elseif dayInMonth <= 36 then | ||
zodiac = " | zodiac = "Micrasha" | ||
elseif dayInMonth <= 48 then | elseif dayInMonth <= 48 then | ||
zodiac = " | zodiac = "Pyreska" | ||
else | else | ||
zodiac = " | zodiac = "Indomin" | ||
end | end | ||
elseif dayOfYear <= 122 then | elseif dayOfYear <= 122 then | ||
| Line 40: | Line 36: | ||
dayInMonth = dayOfYear - 61 | dayInMonth = dayOfYear - 61 | ||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = " | zodiac = "Chrysen" | ||
elseif dayInMonth <= 24 then | elseif dayInMonth <= 24 then | ||
zodiac = " | zodiac = "Thalassian" | ||
elseif dayInMonth <= 36 then | elseif dayInMonth <= 36 then | ||
zodiac = " | zodiac = "Nephelia" | ||
elseif dayInMonth <= 48 then | elseif dayInMonth <= 48 then | ||
zodiac = " | zodiac = "Glinaeus" | ||
else | else | ||
zodiac = " | zodiac = "Noctien" | ||
end | end | ||
else | else | ||
| Line 54: | Line 50: | ||
dayInMonth = dayOfYear - 122 | dayInMonth = dayOfYear - 122 | ||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = " | zodiac = "Opsithia" | ||
elseif dayInMonth <= 24 then | elseif dayInMonth <= 24 then | ||
zodiac = " | zodiac = "Stygian" | ||
elseif dayInMonth <= 36 then | elseif dayInMonth <= 36 then | ||
zodiac = " | zodiac = "Faunian" | ||
elseif dayInMonth <= 48 then | elseif dayInMonth <= 48 then | ||
zodiac = " | zodiac = "Silenian" | ||
else | else | ||
zodiac = " | zodiac = "Catosien" | ||
end | end | ||
end | end | ||
-- Proverb lists for each zodiac | |||
local proverbs = { | |||
Atosien = {"The light of truth burns brightest in darkness.", "Seek clarity, and you will find purpose."}, | |||
Eosena = {"Every dawn brings new beginnings.", "Hope rises with the sun."}, | |||
Micrasha = {"Balance is the key to wisdom.", "The wise walk the middle path."}, | |||
Pyreska = {"Passion ignites the soul.", "Creativity is the fire of life."}, | |||
Indomin = {"Strength lies in adaptability.", "Resilience shapes destiny."}, | |||
Chrysen = {"Wealth is a tool, not a treasure.", "Prosperity grows from ambition."}, | |||
Thalassian = {"The sea whispers secrets to those who listen.", "Embrace the tides of change."}, | |||
Nephelia = {"Dreams are the seeds of reality.", "Imagination knows no bounds."}, | |||
Glinaeus = {"Cycles are the heartbeat of life.", "Renewal comes with time."}, | |||
Noctien = {"The night reveals what the day conceals.", "Truth lies in the shadows."}, | |||
Opsithia = {"Abundance flows from the earth's bounty.", "Harvest with gratitude."}, | |||
Stygian = {"Transitions are the essence of existence.", "Embrace the flow of change."}, | |||
Faunian = {"Harmony nurtures growth.", "Nature is the great teacher."}, | |||
Silenian = {"Celebrate life's joys.", "Revelry renews the spirit."}, | |||
Catosien = {"Order builds lasting legacies.", "Discipline is the foundation of greatness."} | |||
} | |||
-- Select the daily proverb | |||
local zodiacProverbs = proverbs[zodiac] | |||
local daySeed = (totalDaysElapsed % #zodiacProverbs) + 1 | |||
local dailyProverb = zodiacProverbs[daySeed] | |||
-- Event lookup table | -- Event lookup table | ||
| Line 89: | Line 109: | ||
local event = events[eventKey] or "No significant events today." | local event = events[eventKey] or "No significant events today." | ||
-- Return the formatted date | -- Return the formatted date with a daily proverb | ||
return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. | return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event .. " – Proverb: " .. dailyProverb | ||
end | end | ||
return p | return p | ||
Revision as of 03:13, 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 -- Number of seconds in a day
local daysPerYear = 183
-- Current date
local currentDate = os.time()
local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay)
-- Calculate PSSC year and day
local yearFraction = totalDaysElapsed / daysPerYear
local psscYear = math.floor(yearFraction)
local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1
-- Determine month, day within the month, and zodiac
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
-- Proverb lists for each zodiac
local proverbs = {
Atosien = {"The light of truth burns brightest in darkness.", "Seek clarity, and you will find purpose."},
Eosena = {"Every dawn brings new beginnings.", "Hope rises with the sun."},
Micrasha = {"Balance is the key to wisdom.", "The wise walk the middle path."},
Pyreska = {"Passion ignites the soul.", "Creativity is the fire of life."},
Indomin = {"Strength lies in adaptability.", "Resilience shapes destiny."},
Chrysen = {"Wealth is a tool, not a treasure.", "Prosperity grows from ambition."},
Thalassian = {"The sea whispers secrets to those who listen.", "Embrace the tides of change."},
Nephelia = {"Dreams are the seeds of reality.", "Imagination knows no bounds."},
Glinaeus = {"Cycles are the heartbeat of life.", "Renewal comes with time."},
Noctien = {"The night reveals what the day conceals.", "Truth lies in the shadows."},
Opsithia = {"Abundance flows from the earth's bounty.", "Harvest with gratitude."},
Stygian = {"Transitions are the essence of existence.", "Embrace the flow of change."},
Faunian = {"Harmony nurtures growth.", "Nature is the great teacher."},
Silenian = {"Celebrate life's joys.", "Revelry renews the spirit."},
Catosien = {"Order builds lasting legacies.", "Discipline is the foundation of greatness."}
}
-- Select the daily proverb
local zodiacProverbs = proverbs[zodiac]
local daySeed = (totalDaysElapsed % #zodiacProverbs) + 1
local dailyProverb = zodiacProverbs[daySeed]
-- Event lookup table
local events = {
["Atosiel,6"] = "Bayram al-Nur (Festival of Light)",
["Atosiel,18"] = "Chag Or Hadash (Festival of New Light)",
["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony)",
["Atosiel,43"] = "Alev Günü (Day of Flame)",
["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows)",
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering)",
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide)",
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination)",
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles)",
["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon)",
["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest)",
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth)",
["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper)",
["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration)",
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration)"
}
-- Find the event for the current day
local eventKey = month .. "," .. dayInMonth
local event = events[eventKey] or "No significant events today."
-- Return the formatted date with a daily proverb
return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event .. " – Proverb: " .. dailyProverb
end
return p