Module:VaeringheimGossip

From MicrasWiki
Revision as of 22:38, 25 December 2024 by NewZimiaGov (talk | contribs)
Jump to navigationJump to search

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

local p = {}

function p.getCurrentDate()
    local startDate = os.time({year = 1999, month = 8, day = 6})
    local secondsInDay = 86400
    local daysPerYear = 183

    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

    local month, dayInMonth
    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 dateInfo = {
        year = psscYear,
        month = month,
        day = dayInMonth
    }

    return dateInfo
end

function p.generateSingleGossip()
    local npcs = {
        {name = "Amar Sefar", role = "Canal Dockworker", company = "Lake Morovia Blockade Fund", cult = "Ordo Solis Invicti", description = "A burly man with weathered skin, always wearing a wide-brimmed hat to shield himself from the sun."},
        {name = "Liora Eoseth", role = "Merchant of Silks", company = "Market Hanavusu", cult = "Order of Aurora Mystica", description = "A petite woman with sharp features and flowing auburn hair, known for her vibrant robes."},
        {name = "Tahir Morion", role = "Priest of the Host Spirit", company = "Temple Bank of the Reformed Stripping Path", cult = "Ordo Solis Invicti", description = "A tall, solemn man with a shaved head and piercing green eyes."},
        {name = "Kala Inephra", role = "Goldsmith", company = "Shï Collective", cult = "Guild of Golden Shadows", description = "A middle-aged woman with nimble fingers and a streak of silver in her jet-black hair."},
        {name = "Nadir Alphon", role = "Tavern Keeper", company = "Ale of the Night Central Brewery", cult = "Mystery of Red Mirth", description = "A stout man with a booming laugh and a thick mustache."},
        {name = "Elina Voraith", role = "Fisherwoman", company = "Suncliff Fisheries", cult = "Azure Sentinel Sect", description = "A lean, tanned woman with a perpetual smell of saltwater and a streak of mischief in her smile."},
        {name = "Darin Ilphas", role = "Caravan Guard", company = "East Keltian Iron Company", cult = "Court of the Ironclad", description = "A rugged man with a scar across his cheek and a protective demeanor."},
        {name = "Saira Lineth", role = "Student of the Arts", company = "La Sái Ebile", cult = "Reverie Nebulous", description = "A dreamy young woman with ink-stained fingers and a penchant for painting sunsets."},
        {name = "Marik Troven", role = "Historian", company = "Temple University of Delphica", cult = "Conclave Illuminara", description = "A wiry man with spectacles perpetually sliding down his nose and a satchel full of scrolls."},
        {name = "Zia Falorin", role = "Street Performer", company = "Maritime Guild of the Cult of Maskmakers", cult = "Harmony Sanctum", description = "A flamboyant figure with a painted face and a penchant for acrobatics."},
        {name = "Vera Myrian", role = "Apothecary", company = "Salurian Temple of Sacred Horehound", cult = "Mystery of the Verdant Embrace", description = "A serene woman with gentle eyes and a belt full of pouches and vials."},
        {name = "Torin Velar", role = "Blacksmith", company = "East Keltian Iron Company", cult = "Court of the Ironclad", description = "A burly man with soot-streaked arms and a hammer that rarely leaves his side."},
        {name = "Ilari Draven", role = "Architect", company = "Thalassian Granite Export Cooperative", cult = "Guild of Golden Shadows", description = "A meticulous man with a monocle and a leather-bound notebook always in hand."},
        {name = "Nina Iseth", role = "Trader", company = "Gladeseed Farmers' Union", cult = "Harmony Sanctum", description = "A shrewd woman with sharp eyes and a knack for bartering."},
        {name = "Orin Lareth", role = "Boat Builder", company = "Lake Morovia Blockade Fund", cult = "Azure Sentinel Sect", description = "A stocky man with calloused hands and a deep tan."},
        {name = "Rina Fahl", role = "Chef", company = "Ale of the Night Central Brewery", cult = "Mystery of Red Mirth", description = "A jovial woman with a round face and a knack for making people smile with her cooking."},
        {name = "Khalid Fenra", role = "Scholar", company = "Temple University of Delphica", cult = "Reverie Nebulous", description = "A lanky man with a dreamy expression and a habit of muttering to himself."},
        {name = "Evanor Tyreth", role = "Carpenter", company = "East Keltian Timber Company", cult = "Sylvan Fellowship", description = "A wiry man with a saw always slung over his shoulder and a warm smile."},
        {name = "Sorin Althis", role = "Guard Captain", company = "Baratar Corporation", cult = "Court of the Ironclad", description = "A stoic man with a commanding presence and a deep, gravelly voice."}
    }

    local gossip = {
        "The canals have seen fewer Morovian Rainbow Birds this season—some say it's an omen of change.",
        "Gold prices in the General Port are skyrocketing; whispers of a new trade route opening abound.",
        "A secretive cult was spotted performing rituals near the Tomb of Styx.",
        "The Shï Collective's latest sculptures fetch unimaginable prices in the markets.",
        "Fishermen claim the Atterian Armored Pufferfish are growing larger this year, likely due to new hatchery practices.",
        "Vaeringheim’s canal system is rumored to be expanded with a new section linking it directly to the eastern sea routes.",
        "The annual Regatta Festival in Vaeringheim has seen an influx of competitors from neighboring regions.",
        "A rare sighting of a Somniant Eidolon near Lake Morovia has captivated the city’s mystics.",
        "The newly restored statue of Atos in the city square has become a pilgrimage site.",
        "Residents complain about increasing water taxes as the city council funds new trade initiatives."
    }

    local dateInfo = p.getCurrentDate()
    local npc = npcs[math.random(#npcs)]
    local story = gossip[math.random(#gossip)]

    local entry = string.format(
        "Date: %d %s, %s PSSC | Reporter: %s (%s, %s, %s) | Gossip: %s",
        dateInfo.day,
        dateInfo.month,
        dateInfo.year,
        npc.name,
        npc.role,
        npc.company,
        npc.cult,
        story
    )

    return entry
end

function p.generate(frame)
    return p.generateSingleGossip()
end

return p