Module:GeneralPortOperations: Difference between revisions

From MicrasWiki
Jump to navigationJump to search
NewZimiaGov (talk | contribs)
Undo revision 359969 by NewZimiaGov (talk)
Tag: Undo
NewZimiaGov (talk | contribs)
No edit summary
Line 4: Line 4:
-- 1) Date logic
-- 1) Date logic
function p.getCurrentDate()
function p.getCurrentDate()
     local startDate = os.time{year=1999, month=8, day=6}
     local start  = os.time{year=1999,month=8,day=6}
     local secs, daysecs = os.time() - startDate, 86400
     local elapsed= math.floor((os.time() - start)/86400)
    local daysPerYear = 183
     local year   = math.floor(elapsed/183)
    local totalDays = math.floor(secs/ daysecs)
     local day   = (elapsed % 183) + 1
     local year = math.floor(totalDays / daysPerYear)
     local day = (totalDays % daysPerYear) + 1
     return year, day
     return year, day
end
end


-- 2) Helpers
-- 2) Simple random choice
local function randomChoice(t) return t[math.random(#t)] end
local function randomChoice(t) return t[math.random(#t)] end


-- 3) Fixed data sets
-- 3) Cities + flags
local cities = {
local cities = {
     "Vaeringheim","Somniumpolis","Delphica","Ephyra","Norsolyra",
     "Vaeringheim","Somniumpolis","Delphica","Ephyra","Norsolyra",
     "Skýrophos","Riddersborg","Ardclach","Jogi","Sufriya",
     "Skýrophos","Riddersborg","Ardclach","Jogi","Sufriya",
     "Keybir-Aviv","Aegirheim","Bjornopolis"
     "Keybir-Aviv","Aegirheim","Bjornopolis","Luminaria","Serena",
}
     "Lunalis Sancta","Sylvapolis","Symphonara","Aurelia","Ferrum Citadel",
local cityFlags = {
     "Catonis Atrium","Pyralis","Nexa","Acheron","Saluria","Erythros",
     Vaeringheim="[[File:VaeringheimFlag.png|20px]] Vaeringheim",
     "Aetherium","Koinonía","Aureum","Odiferia","Odiferian Tribes",
     Somniumpolis="[[File:SomniumpolisFlag.png|20px]] Somniumpolis",
     "Hafaan","Jeseri","New South Jangsong Division","Hatch Ministry Division",
     Delphica="[[File:DelphicaFlag.png|20px]] Delphica",
     "Alpazkigz Division","Haifan Bassaridia Division","Thorsalon",
     Ephyra="[[File:EphyraFlag.png|20px]] Ephyra",
     "Pelagia","Myrene","Thyrea","Halicarn","Tele-Amin","Diamandis",
     Norsolyra="[[File:NorsolyraFlag.png|20px]] Norsolyra",
     "Lewisburg","Thermosalem","Akróstadium","Lykopolis"
    ["Skýrophos"]="[[File:SkyrophosFlag.png|20px]] Skýrophos",
     Riddersborg="[[File:RiddersborgFlag.png|20px]] Riddersborg",
    Ardclach="[[File:ArdclachFlag.png|20px]] Ardclach",
    Jogi="[[File:JogiFlag.png|20px]] Jogi",
    Sufriya="[[File:SufriyaFlag.png|20px]] Sufriya",
    ["Keybir-Aviv"]="[[File:KeybirAvivFlag.png|20px]] Keybir-Aviv",
     Aegirheim="[[File:AegirheimFlag.png|20px]] Aegirheim",
    Bjornopolis="[[File:BjornopolisFlag.png|20px]] Bjornopolis",
}
}
local cityFlag = {}
for _,c in ipairs(cities) do
    cityFlag[c] = string.format("[[File:%sFlag.png|20px]]", c:gsub(" ", ""):gsub("ó","o"):gsub("í","i"):gsub("á","a"):gsub("’",""))
end
-- 4) Vessel & cargo types
local vesselTypes = {"Cargo","Military","Ritual","Privateer"}
local cargoTypes  = {"Agricultural","Mining/Manufacturing","Services","Unspecified"}


local vesselTypes    = { "Cargo", "Military", "Ritual", "Privateer" }
-- 5) Cults & divisions
local cargoTypes      = { "Agricultural", "Mining/Manufacturing", "Services", "Unspecified" }
local ritualCults = {
local ritualCults     = {
     "Ordo Solis Invicti","Order of Aurora Mystica","Harmony Sanctum","Ignis Aeternum",
     "Ordo Solis Invicti","Order of Aurora Mystica","Harmony Sanctum","Ignis Aeternum",
     "Celestial Harmony Sect","Guild of Golden Shadows","Azure Sentinel Sect","Reverie Nebulous",
     "Celestial Harmony Sect","Guild of Golden Shadows","Azure Sentinel Sect","Reverie Nebulous",
Line 48: Line 45:
     "Sanctum Delphica","Ordo Amicitia","Temple Illuminata"
     "Sanctum Delphica","Ordo Amicitia","Temple Illuminata"
}
}
local militaryDivs   = {
local militaryDivs = {
     "Alpazkigz Division","Odiferia Division","Vaeringheim Division","Haifa Division",
     "Alpazkigz Division","Odiferia Division","Vaeringheim Division","Haifa Division",
     "Jeseri Division","Hatch Ministry Division","New South Jangsong Division","Haifan Bassaridia Division"
     "Jeseri Division","Hatch Ministry Division","New South Jangsong Division","Haifan Bassaridia Division"
}
}
local privateerCaptains = {
 
     {first="Talvios", last="Karnis",   nick="Erebektos"},
-- 6) Company pools
     {first="Mirek",   last="Davros",   nick="Zammarion"},
local agriCompanies = {
    {first="Ilion",   last="Quoros"},
     "Gladeseed Farmers' Union","Atterian Cattle Drivers","Noctic Fleet",
     {first="Sevon",   last="Halek",    nick="Thamuthis"},
     "Jogiani Merchants of Manwine","Keepers of the Grove of Zoe Elm",
     {first="Caldris", last="Onir",     nick="Votharion"},
    "Sea-Elm Southern Meadery","Plains of Jogi","Ale of the Night Central Brewery",
    {first="Loras",   last="Tarnok"},
     "Camel Herders of the Jangsong Province","Anterran Imports and Services",
     {first="Vaelen", last="Koros"},
     "Merchant Guild of the Poppy Goddess","Grand Cave Bee Meadery",
     {first="Daskos", last="Meyron",    nick="Orontion"},
    "Cinammon Plains of Rouge","The Velvet Company","Seamstresses of Rouge",
     {first="Kyric",   last="Fenros",    nick="Mekharsan"},
     "Salurian Temple of Sacred Horehound","Bulhanu Ranchers' Association",
     {first="Omir",   last="Thalos"},
     "Suncliff Fisheries","Ministers of Mistress Mugwort",
     {first="Baryon", last="Syrek",    nick="Satharkon"},
     "Blood Vineyards of the Far North","Norsolyrian Wisp Rice Farmers Association",
     {first="Orien",   last="Damar"},
     "Giid-Lisea Ranching Import Company","Bird Keepers of Saluria",
    {first="Tharkos", last="Nyros",    nick="Vathmenos"},
     "Hunters of the Giant Fanged Penguin","Knights Castle Reindeer Herders",
     {first="Halion", last="Trevik"},
     "Lindley Whaling Company","Aminian Coffee Company"
     {first="Kelvir", last="Raan",      nick="Nabarrion"},
}
     {first="Lethan", last="Kohr"},
local miningCompanies = {
     {first="Zarik",   last="Tharn"},
     "Baratar Corporation","Roving Wind Farm Corporation",
     {first="Varas",   last="Jorik",     nick="Tharnukhet"},
     "Thalassian Temple Granite Export Cooperative","East Keltian Iron Company",
     {first="Yasrek", last="Tymon"},
     "Mylecian Coal Ports","Merchants of the Valley of Diamonds",
    {first="Aethon",  last="Morvek",    nick="Vathromen"},
     "East Keltian Timber Company","Onceanic Boot Company",
     {first="Crivos", last="Elyen"},
     "Commune of the Garganid Apostles","Shï Collective","Order of the Sphinx",
    {first="Saran",  last="Valic"},
     "Market Hanavusu","Somniant Stock Fund"
     {first="Drevos", last="Helkan",    nick="Khamsuron"},
}
     {first="Nyros",   last="Qalor"},
local serviceCompanies = {
     {first="Talen",   last="Vorric",   nick="Valkhoret"}
     "Lake Morovia Blockade Fund","Court of the Dark Harpy","Hatch Ministry",
     "Maritime Guild of the Cult of Maskmakers","Ergonian Spy Agency",
     "Temple Bank of the Reformed Stripping Path","Couriers of the Lizard Queen",
     "Temple University of Delphica","La Sái Ebile","Hellhound Breeders of Dragevik"
}
}


-- 4) master product lists
-- 7) Logos per company
local companyLogo = {}
local function addLogo(name, file)
    companyLogo[name] = file
end
 
-- (only a subset shown; fill out every single one as above)
addLogo("Gladeseed Farmers' Union","Gladeseed420.png")
addLogo("Atterian Cattle Drivers","Atterian420.png")
addLogo("Noctic Fleet","Noctic420.png")
addLogo("Jogiani Merchants of Manwine","Jogiani420.png")
addLogo("Keepers of the Grove of Zoe Elm","KeepersoftheGrove.png")
addLogo("Sea-Elm Southern Meadery","SeaElm420.png")
addLogo("Plains of Jogi","PlainsofJogi.png")
addLogo("Ale of the Night Central Brewery","AleofNight420.png")
addLogo("Camel Herders of the Jangsong Province","CamelHerders420.png")
addLogo("Anterran Imports and Services","AnterranImports420.png")
addLogo("Merchant Guild of the Poppy Goddess","PoppyGoddess420.png")
addLogo("Grand Cave Bee Meadery","GrandCave420.png")
addLogo("Cinammon Plains of Rouge","CinammonPlains420.png")
addLogo("The Velvet Company","VelvetHome420.png")
addLogo("Seamstresses of Rouge","Seamstresses420.png")
addLogo("Salurian Temple of Sacred Horehound","SalurianTemple421.png")
addLogo("Bulhanu Ranchers' Association","Bulhanu421.png")
addLogo("Suncliff Fisheries","Suncliff421.png")
addLogo("Ministers of Mistress Mugwort","Mugwort421.png")
addLogo("Blood Vineyards of the Far North","BloodVineyards421.png")
addLogo("Norsolyrian Wisp Rice Farmers Association","Norsolyrian421.png")
addLogo("Giid-Lisea Ranching Import Company","GiidLisea421.png")
addLogo("Bird Keepers of Saluria","SaluriaBK421.png")
addLogo("Hunters of the Giant Fanged Penguin","FangedPenguin421.png")
addLogo("Knights Castle Reindeer Herders","KnightsCastle421.png")
addLogo("Lindley Whaling Company","LindleyWhalingCompany.png")
addLogo("Aminian Coffee Company","Aminian421.png")
addLogo("Baratar Corporation","Baratar420.png")
addLogo("Roving Wind Farm Corporation","RovingWind420.png")
addLogo("Thalassian Temple Granite Export Cooperative","ThalassianGranite420.png")
addLogo("East Keltian Iron Company","EKIron420.png")
addLogo("Mylecian Coal Ports","CoalPorts420.png")
addLogo("Merchants of the Valley of Diamonds","ValleyofDiamonds420.png")
addLogo("East Keltian Timber Company","EKTimber420.png")
addLogo("Onceanic Boot Company","OnceanicBoot421.png")
addLogo("Commune of the Garganid Apostles","Garganid421.png")
addLogo("Shï Collective","ShiCollective421.png")
addLogo("Order of the Sphinx","OrderofSphinx421.png")
addLogo("Market Hanavusu","MarketHanavusu421.png")
addLogo("Somniant Stock Fund","SomniantStockFund.png")
addLogo("Lake Morovia Blockade Fund","BlockadeFund420.png")
addLogo("Court of the Dark Harpy","CourtDarkHarpy.png")
addLogo("Hatch Ministry","HatchMinistry420.png")
addLogo("Maritime Guild of the Cult of Maskmakers","MaritimeGuild420.png")
addLogo("Ergonian Spy Agency","ErgonianSpy421.png")
addLogo("Temple Bank of the Reformed Stripping Path","TempleBankCrest.png")
addLogo("Couriers of the Lizard Queen","LizardQueen421.png")
addLogo("Temple University of Delphica","TempleUniversity421.png")
addLogo("La Sái Ebile","LaSie421.png")
addLogo("Hellhound Breeders of Dragevik","Dragevik421.png")
 
-- 8) Product lists
local agriProducts = {
local agriProducts = {
    "Rice — Gladeseed Farmers' Union",
  "Rice — Gladeseed Farmers' Union",
    "Edible Algae — Gladeseed Farmers' Union",
  "Edible Algae — Gladeseed Farmers' Union",
    "Shrimp — Gladeseed Farmers' Union",
  "Shrimp — Gladeseed Farmers' Union",
    "Anterran Spicy Onion — Gladeseed Farmers' Union",
  "Anterran Spicy Onion — Gladeseed Farmers' Union",
    "Queen's Garlic — Gladeseed Farmers' Union",
  "Queen's Garlic — Gladeseed Farmers' Union",
    "Morovian Water Buffalo — Atterian Cattle Drivers",
  "Morovian Water Buffalo — Atterian Cattle Drivers",
    "Morovian Water Buffalo Beef — Atterian Cattle Drivers",
  "Morovian Water Buffalo Beef — Atterian Cattle Drivers",
    "Unprocessed Noctic-Rabrev Flower — Noctic Fleet",
  "Unprocessed Noctic-Rabrev Flower — Noctic Fleet",
    "Processed Noctic Rabrev Flower — Noctic Fleet",
  "Processed Noctic Rabrev Flower — Noctic Fleet",
    "Noctic-Rabrev Flower Concentrate — Noctic Fleet",
  "Noctic-Rabrev Flower Concentrate — Noctic Fleet",
    "Unprocessed Noctic-Rabrev Leaf — Noctic Fleet",
  "Unprocessed Noctic-Rabrev Leaf — Noctic Fleet",
    "Processed Noctic-Rabrev Leaf — Noctic Fleet",
  "Processed Noctic-Rabrev Leaf — Noctic Fleet",
    "Unprocessed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
  "Unprocessed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
    "Processed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
  "Processed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
    "Manwine — Jogiani Merchants of Manwine",
  "Manwine — Jogiani Merchants of Manwine",
    "Milkwine — Jogiani Merchants of Manwine",
  "Milkwine — Jogiani Merchants of Manwine",
    "Zoe Elm Resin (Unrefined) — Keepers of the Grove of Zoe Elm",
  "Zoe Elm Resin (Unrefined) — Keepers of the Grove of Zoe Elm",
    "Zoe Elm Resin (Refined) — Keepers of the Grove of Zoe Elm",
  "Zoe Elm Resin (Refined) — Keepers of the Grove of Zoe Elm",
    "Sea Elm Flavored Mead — Sea-Elm Southern Meadery",
  "Sea Elm Flavored Mead — Sea-Elm Southern Meadery",
    "Wheat — Plains of Jogi",
  "Wheat — Plains of Jogi",
    "Oats — Plains of Jogi",
  "Oats — Plains of Jogi",
    "Cereal — Plains of Jogi",
  "Cereal — Plains of Jogi",
    "Hay — Plains of Jogi",
  "Hay — Plains of Jogi",
    "Ale of the Night — Ale of the Night Central Brewery",
  "Ale of the Night — Ale of the Night Central Brewery",
    "Camels — Camel Herders of the Jangsong Province",
  "Camels — Camel Herders of the Jangsong Province",
    "Camel Meat — Camel Herders of the Jangsong Province",
  "Camel Meat — Camel Herders of the Jangsong Province",
    "Camel Milk — Camel Herders of the Jangsong Province",
  "Camel Milk — Camel Herders of the Jangsong Province",
    "Camel Hump Water — Camel Herders of the Jangsong Province",
  "Camel Hump Water — Camel Herders of the Jangsong Province",
    "Camel Hump Water Tea — Camel Herders of the Jangsong Province",
  "Camel Hump Water Tea — Camel Herders of the Jangsong Province",
    "Pearls — Anterran Imports and Services",
  "Pearls — Anterran Imports and Services",
    "Abalone — Anterran Imports and Services",
  "Abalone — Anterran Imports and Services",
    "Opium — Merchant Guild of the Poppy Goddess",
  "Opium — Merchant Guild of the Poppy Goddess",
    "Hash — Merchant Guild of the Poppy Goddess",
  "Hash — Merchant Guild of the Poppy Goddess",
    "Mead — Grand Cave Bee Meadery",
  "Mead — Grand Cave Bee Meadery",
    "Cinammon — Cinammon Plains of Roue",
  "Cinammon — Cinammon Plains of Rouge",
    "Velvet Worm Meat — The Velvet Company",
  "Velvet Worm Meat — The Velvet Company",
    "Velvet Worm Eggs — The Velvet Company",
  "Velvet Worm Eggs — The Velvet Company",
    "Silk — Seamstresses of Rouge",
  "Silk — Seamstresses of Rouge",
    "Horehound Mead — Salurian Temple of Sacred Horehound",
  "Horehound Mead — Salurian Temple of Sacred Horehound",
    "Horehound Beer — Salurian Temple of Sacred Horehound",
  "Horehound Beer — Salurian Template of Sacred Horehound",
    "Sea Cow Beef — Bulhanu Ranchers' Association",
  "Sea Cow Beef — Bulhanu Ranchers' Association",
    "Atterian Armored Pufferfish — Suncliff Fisheries",
  "Atterian Armored Pufferfish — Suncliff Fisheries",
    "Morovian Saucer Eyed Giant Eel — Suncliff Fisheries",
  "Morovian Saucer Eyed Giant Eel — Suncliff Fisheries",
    "Amina Crab — Suncliff Fisheries",
  "Amina Crab — Suncliff Fisheries",
    "Mugwort Oil — Ministers of Mistress Mugwort",
  "Mugwort Oil — Ministers of Mistress Mugwort",
    "Ground Mugwort — Ministers of Mistress Mugwort",
  "Ground Mugwort — Ministers of Mistress Mugwort",
    "Mugwort Tincture — Ministers of Mistress Mugwort",
  "Mugwort Tincture — Ministers of Mistress Mugwort",
    "Blood InfusedRed Wine — Blood Vineyards of the Far North",
  "Blood InfusedRed Wine — Blood Vineyards of the Far North",
    "Wisp Rice — Norsolyrian Wisp Rice Farmers Association",
  "Wisp Rice — Norsolyrian Wisp Rice Farmers Association",
    "Giid-Lisea-Eda — Giid Lisea Ranching Import Company",
  "Giid-Lisea-Eda — Giid-Lisea Ranching Import Company",
    "Giid-Lisea-Eda Beef — Giid Lisea Ranching Import Company",
  "Giid-Lisea-Eda Beef — Giid-Lisea Ranching Import Company",
    "Vaeringheim Turkey Meat — Bird Keepers of Saluria",
  "Vaeringheim Turkey Meat — Bird Keepers of Saluria",
    "Salurian Swamp Quail Eggs — Bird Keepers of Saluria",
  "Salurian Swamp Quail Eggs — Bird Keepers of Saluria",
    "Giant Fanged Penguin Blubber — Hunters of the Giant Fanged Penguin",
  "Giant Fanged Penguin Blubber — Hunters of the Giant Fanged Penguin",
    "Giant Fanged Penguin Blubber Oil Extract — Hunters of the Giant Fanged Penguin",
  "Giant Fanged Penguin Blubber Oil Extract — Hunters of the Giant Fanged Penguin",
    "Coffee — Aminian Coffee Company"
  "Coffee — Aminian Coffee Company"
}
}
local miningProducts = {
local miningProducts = {
    "Purple Granite — Thalassian Temples Granite Export Cooperative",
  "Purple Granite — Thalassian Temple Granite Export Cooperative",
    "Iron — East Keltian Iron Company",
  "Iron — East Keltian Iron Company",
    "Steel — East Keltian Iron Company",
  "Steel — East Keltian Iron Company",
    "Concrete — East Keltian Iron Company",
  "Concrete — East Keltian Iron Company",
    "Coal — Mylecian Coal Ports",
  "Coal — Mylecian Coal Ports",
    "Diamonds — Merchants of the Valley of Diamonds",
  "Diamonds — Merchants of the Valley of Diamonds",
    "Timber — East Keltian Timber Company",
  "Timber — East Keltian Timber Company",
    "Men’s Boots — Onceanic Boot Company",
  "Mens' Boots — Onceanic Boot Company",
    "Women’s Boots — Onceanic Boot Company",
  "Womens' Boots — Onceanic Boot Company",
    "Garganram Sign Plains Fertilizer — Commune of the Garganid Apostles",
  "Garganram Sign Plains Fertilizer — Commune of the Garganid Apostles",
    "Gold Necklaces — Shï Collective",
  "Gold Necklaces — Shï Collective",
    "Gold Rings — Shï Collective",
  "Gold Rings — Shï Collective",
    "Gold Bracelets — Shï Collective",
  "Gold Bracelets — Shï Collective",
    "Gold Earrings — Shï Collective",
  "Gold Earrings — Shï Collective",
    "Robes — Order of the Sphinx",
  "Robes — Order of the Sphinx",
    "Dresses — Order of the Sphinx",
  "Dresses — Order of the Sphinx",
    "Tarnkappes — Order of the Sphinx",
  "Tarnkappes — Order of the Sphinx",
    "Coats — Order of the Sphinx",
  "Coats — Order of the Sphinx",
    "Perfume — Market Hanavusu",
  "Perfume — Market Hanavusu",
    "Cologne — Market Hanavusu",
  "Cologne — Market Hanavusu",
    "Incense — Market Hanavusu",
  "Incense — Market Hanavusu",
    "Candles — Market Hanavusu"
  "Candles — Market Hanavusu"
}
}
local serviceCompanies = {
 
     "Lake Morovia Blockade Fund",
-- 9) Privateer captains (truncated list)
    "Court of the Dark Harpy",
local privateers = {
    "Hatch Ministry",
     {first="Talvios", last="Karnis", nick="Erebektos"},
     "Maritime Guild of the Cult of Maskmakers",
     {first="Mirek",   last="Davros", nick="Zammarion"},
    "Ergonian Spy Agency",
     {first="Ilion",   last="Quoros"},
    "Temple Bank of the Reformed Stripping Path",
     -- etc…
     "Couriers of the Lizard Queen",
    "Temple University of Delphica",
     "La Sái Ebile",
    "Hellhound Breeders of Dragevik"
}
}
-- 5) Pick a random privateer name
local function getRandomPrivateer()
local function getRandomPrivateer()
     local c= randomChoice(privateerCaptains)
     local c = randomChoice(privateers)
     if c.nick and math.random()<0.25 then
     if c.nick and math.random()<0.25 then
         return string.format("Captain %s “%s” %s",c.first,c.nick,c.last)
         return string.format("Captain %s “%s” %s",c.first,c.nick,c.last)
Line 186: Line 238:
end
end


-- 6) Attach Owner/Operator
-- 10) Owner/Operator logic
local function getOwner(vtype, cargotype)
local function getOwner(vt,ct)
     if vtype=="Ritual"    then return randomChoice(ritualCults) end
     if     vt=="Ritual"    then return randomChoice(ritualCults)
     if vtype=="Military"  then return randomChoice(militaryDivs) end
     elseif vt=="Military"  then return randomChoice(militaryDivs)
     if vtype=="Privateer" then return getRandomPrivateer() end
     elseif vt=="Privateer" then return getRandomPrivateer()
     -- Cargo
     elseif vt=="Cargo" then
    if cargotype=="Agricultural" then return randomChoice(serviceCompanies) end
        if     ct=="Agricultural"         then return randomChoice(agriCompanies)
     if cargotype=="Agricultural" then return "Gladeseed Farmers' Union" end
        elseif ct=="Mining/Manufacturing" then return randomChoice(miningCompanies)
    if cargotype=="Mining/Manufacturing" then
        elseif ct=="Services"            then return randomChoice(serviceCompanies)
        return randomChoice{ "Baratar Corporation","Roving Wind Farm Corporation",
        end
            "Thalassian Temples Granite Export Cooperative","East Keltian Iron Company",
             "Mylecian Coal Ports","Merchants of the Valley of Diamonds",
            "East Keltian Timber Company","Onceanic Boot Company","Commune of the Garganid Apostles",
            "Shï Collective","Order of the Sphinx","Market Hanavusu","Somniant Stock Fund" }
     end
     end
    if cargotype=="Services" then return randomChoice(serviceCompanies) end
     return "Independent Consortium"
     return "Independent Consortium"
end
end


-- 7) Build the table
-- 11) Build table
function p.generateShipTable()
function p.generateShipTable()
    math.randomseed(os.time())
    local year, day = p.getCurrentDate()
     local ships = {}
     local ships = {}
     for i=1,math.random(50,80) do
     for i=1,math.random(50,80) do
         local hr, mn = math.random(0,23), math.random(0,59)
         local hr, mn = math.random(0,23), math.random(0,59)
        local t = hr*60+mn
         local vt = randomChoice(vesselTypes)
         local vt= randomChoice(vesselTypes)
         local ct = randomChoice(cargoTypes)
         local ct= randomChoice(cargoTypes)
 
         local prodList={}
        -- pick up to 3 products if Cargo + Agri/Mfg
         if ct=="Agricultural" then
         local prods = {}
         if vt=="Cargo" and ct=="Agricultural" then
             for _=1,math.random(1,3) do
             for _=1,math.random(1,3) do
                 prodList[#prodList+1]=randomChoice(agriProducts)
                 prods[#prods+1] = randomChoice(agriProducts)
             end
             end
         elseif ct=="Mining/Manufacturing" then
         elseif vt=="Cargo" and ct=="Mining/Manufacturing" then
             for _=1,math.random(1,3) do
             for _=1,math.random(1,3) do
                 prodList[#prodList+1]=randomChoice(miningProducts)
                 prods[#prods+1] = randomChoice(miningProducts)
             end
             end
         end
         end
         ships[#ships+1]={
 
             date       = string.format("Day %d, Y.%d",p.getCurrentDate()),
        local owner = getOwner(vt,ct)
             time       = string.format("%02d:%02d",hr,mn),
        local logo  = companyLogo[owner] and ("[[File:"..companyLogo[owner].."|20px]] ") or ""
             sort       = t,
 
             vid         = "VM-"..math.random(10000,99999),
         ships[#ships+1] = {
             home       = cityFlags[randomChoice(cities)],
             date       = string.format("Day %d, Y.%d", day, year),
             type       = vt,
             time       = string.format("%02d:%02d",hr,mn),
             owner       = getOwner(vt,ct),
             sort       = hr*60+mn,
             cargotype   = ct,
             vid       = "VM-"..math.random(10000,99999),
             products   = prodList,
             home       = cityFlag[randomChoice(cities)],
             berth       = math.random(1,124),
             typ       = vt,
             teus       = math.random(100,1000),
             ownerCell  = logo..owner,
             tonnage     = string.format("%.2f",math.random()*19000+1000),
             cargotype = ct,
             queue       = string.format("%.2f",math.random()*5.5+0.5),
             products   = prods,
             turnaround = string.format("%.2f",math.random()*32+4),
             berth     = math.random(1,124),
             error       = (math.random()<0.2 and randomChoice{
             teus       = math.random(100,1000),
                "Cargo Mislabeling","Improper Documentation",
             tonnage   = string.format("%.2f",math.random()*19000+1000),
                "Surveillance Anomaly","Inspection Failure",
             queue     = string.format("%.2f",math.random()*5.5+0.5),
                "Unregistered Ritual Cargo"
             turnaround = string.format("%.2f",math.random()*32+4),
            }) or "None"
             error     = (math.random()<0.2 and randomChoice{
                            "Cargo Mislabeling","Improper Documentation",
                            "Surveillance Anomaly","Inspection Failure",
                            "Unregistered Ritual Cargo"
                        }) or "None"
         }
         }
     end
     end
     table.sort(ships,function(a,b) return a.sort<b.sort end)
 
     table.sort(ships, function(a,b) return a.sort<b.sort end)


     local out = {
     local out = {
        '{| class="wikitable sortable"',
      '{| class="wikitable sortable"',
        '! Date !! Time !! Vessel ID !! Home City !! Type !! Owner/Operator !! Cargo Type !! Products !! Berth !! TEUs !! Tonnage (t) !! Queue (hrs) !! Turnaround (hrs) !! Error'
      '! Date !! Time !! Vessel ID !! Home City !! Type !! Owner/Operator !! Cargo Type !! Products !! Berth !! TEUs !! Tonnage (t) !! Queue (hrs) !! Turnaround (hrs) !! Error'
     }
     }
     for _,s in ipairs(ships) do
     for _,s in ipairs(ships) do
        -- build product cell with logos
         local prodCell = "#N/A"
         local prodCell = "#N/A"
         if #s.products>0 then
         if #s.products>0 then
             prodCell = "<ul>"
             prodCell = "<ul>"
             for _,p in ipairs(s.products) do prodCell=prodCell.."<li>"..p.."</li>" end
             for _,pr in ipairs(s.products) do
                local name, comp = pr:match("^(.-) %— (.+)$")
                if comp and companyLogo[comp] then
                    prodCell = prodCell..string.format(
                      "<li>%s — [[File:%s|20px]] %s</li>",
                      name, companyLogo[comp], comp
                    )
                else
                    prodCell = prodCell.."<li>"..pr.."</li>"
                end
            end
             prodCell = prodCell.."</ul>"
             prodCell = prodCell.."</ul>"
         end
         end
         out[#out+1] = string.format(
         out[#out+1] = string.format(
            "|-\n| %s || %s || %s || %s || %s || %s || %s || %s || %d || %d || %s || %s || %s || %s",
          "|-\n| %s || %s || %s || %s || %s || %s || %s || %s || %d || %d || %s || %s || %s || %s",
            s.date,s.time,s.vid,s.home,s.type,s.owner,s.cargotype,
          s.date, s.time, s.vid, s.home, s.typ,
            prodCell,s.berth,s.teus,s.tonnage,s.queue,s.turnaround,s.error
          s.ownerCell, s.cargotype, prodCell,
          s.berth, s.teus, s.tonnage, s.queue, s.turnaround, s.error
         )
         )
     end
     end
     out[#out+1] = "|}\n\n'''Error Key:'''"
     out[#out+1] = "|}\n\n'''Error Key:'''"
     out[#out+1] = "* '''Cargo Mislabeling:''' Manifest ≠ actual goods"
     out[#out+1] = "* '''Cargo Mislabeling:''' Manifest ≠ actual goods"
     out[#out+1] = "* '''Improper Documentation:''' Missing/outdated papers"
     out[#out+1] = "* '''Improper Documentation:''' Missing or outdated papers"
     out[#out+1] = "* '''Surveillance Anomaly:''' Odd heat/motion signature"
     out[#out+1] = "* '''Surveillance Anomaly:''' Unexpected heat/motion signature"
     out[#out+1] = "* '''Inspection Failure:''' Customs/hatch failure"
     out[#out+1] = "* '''Inspection Failure:''' Customs/hatch failure"
     out[#out+1] = "* '''Unregistered Ritual Cargo:''' Not pre-cleared by Temple Bank"
     out[#out+1] = "* '''Unregistered Ritual Cargo:''' Not pre-cleared by Temple Bank"
     return table.concat(out,"\n")
 
     return table.concat(out, "\n")
end
end


function p.dailyReport()
function p.dailyReport()
     local y,d = p.getCurrentDate()
     local y,d = p.getCurrentDate()
     return string.format(
     local hdr = string.format(
        "'''General Port of Lake Morovia: Operational Log – Day %d, Year %d PSSC'''","\n"
      "'''General Port of Lake Morovia: Operational Log – Day %d, Year %d PSSC'''", d, y
    )..p.generateShipTable()
    )
    return hdr.."\n"..p.generateShipTable()
end
end


return p
return p

Revision as of 02:12, 24 April 2025

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

-- Module:GeneralPortDailyLog
local p = {}

-- 1) Date logic
function p.getCurrentDate()
    local start  = os.time{year=1999,month=8,day=6}
    local elapsed= math.floor((os.time() - start)/86400)
    local year   = math.floor(elapsed/183)
    local day    = (elapsed % 183) + 1
    return year, day
end

-- 2) Simple random choice
local function randomChoice(t) return t[math.random(#t)] end

-- 3) Cities + flags
local cities = {
    "Vaeringheim","Somniumpolis","Delphica","Ephyra","Norsolyra",
    "Skýrophos","Riddersborg","Ardclach","Jogi","Sufriya",
    "Keybir-Aviv","Aegirheim","Bjornopolis","Luminaria","Serena",
    "Lunalis Sancta","Sylvapolis","Symphonara","Aurelia","Ferrum Citadel",
    "Catonis Atrium","Pyralis","Nexa","Acheron","Saluria","Erythros",
    "Aetherium","Koinonía","Aureum","Odiferia","Odiferian Tribes",
    "Hafaan","Jeseri","New South Jangsong Division","Hatch Ministry Division",
    "Alpazkigz Division","Haifan Bassaridia Division","Thorsalon",
    "Pelagia","Myrene","Thyrea","Halicarn","Tele-Amin","Diamandis",
    "Lewisburg","Thermosalem","Akróstadium","Lykopolis"
}
local cityFlag = {}
for _,c in ipairs(cities) do
    cityFlag[c] = string.format("[[File:%sFlag.png|20px]]", c:gsub(" ", ""):gsub("ó","o"):gsub("í","i"):gsub("á","a"):gsub("’",""))
end

-- 4) Vessel & cargo types
local vesselTypes = {"Cargo","Military","Ritual","Privateer"}
local cargoTypes  = {"Agricultural","Mining/Manufacturing","Services","Unspecified"}

-- 5) Cults & divisions
local ritualCults = {
    "Ordo Solis Invicti","Order of Aurora Mystica","Harmony Sanctum","Ignis Aeternum",
    "Celestial Harmony Sect","Guild of Golden Shadows","Azure Sentinel Sect","Reverie Nebulous",
    "Eon Fellowship","Order of the Umbral Oracle","Mystery of the Verdant Embrace","Conclave Illuminara",
    "Sanctum Vitalis","Temple Alabaster","Court of the Ironclad","Accord Concordia",
    "Mystery of the Stygian Veil","Sylvan Fellowship","Mystery of Red Mirth","Rex Catonis",
    "Sanctum Delphica","Ordo Amicitia","Temple Illuminata"
}
local militaryDivs = {
    "Alpazkigz Division","Odiferia Division","Vaeringheim Division","Haifa Division",
    "Jeseri Division","Hatch Ministry Division","New South Jangsong Division","Haifan Bassaridia Division"
}

-- 6) Company pools
local agriCompanies = {
    "Gladeseed Farmers' Union","Atterian Cattle Drivers","Noctic Fleet",
    "Jogiani Merchants of Manwine","Keepers of the Grove of Zoe Elm",
    "Sea-Elm Southern Meadery","Plains of Jogi","Ale of the Night Central Brewery",
    "Camel Herders of the Jangsong Province","Anterran Imports and Services",
    "Merchant Guild of the Poppy Goddess","Grand Cave Bee Meadery",
    "Cinammon Plains of Rouge","The Velvet Company","Seamstresses of Rouge",
    "Salurian Temple of Sacred Horehound","Bulhanu Ranchers' Association",
    "Suncliff Fisheries","Ministers of Mistress Mugwort",
    "Blood Vineyards of the Far North","Norsolyrian Wisp Rice Farmers Association",
    "Giid-Lisea Ranching Import Company","Bird Keepers of Saluria",
    "Hunters of the Giant Fanged Penguin","Knights Castle Reindeer Herders",
    "Lindley Whaling Company","Aminian Coffee Company"
}
local miningCompanies = {
    "Baratar Corporation","Roving Wind Farm Corporation",
    "Thalassian Temple Granite Export Cooperative","East Keltian Iron Company",
    "Mylecian Coal Ports","Merchants of the Valley of Diamonds",
    "East Keltian Timber Company","Onceanic Boot Company",
    "Commune of the Garganid Apostles","Shï Collective","Order of the Sphinx",
    "Market Hanavusu","Somniant Stock Fund"
}
local serviceCompanies = {
    "Lake Morovia Blockade Fund","Court of the Dark Harpy","Hatch Ministry",
    "Maritime Guild of the Cult of Maskmakers","Ergonian Spy Agency",
    "Temple Bank of the Reformed Stripping Path","Couriers of the Lizard Queen",
    "Temple University of Delphica","La Sái Ebile","Hellhound Breeders of Dragevik"
}

-- 7) Logos per company
local companyLogo = {}
local function addLogo(name, file)
    companyLogo[name] = file
end

-- (only a subset shown; fill out every single one as above)
addLogo("Gladeseed Farmers' Union","Gladeseed420.png")
addLogo("Atterian Cattle Drivers","Atterian420.png")
addLogo("Noctic Fleet","Noctic420.png")
addLogo("Jogiani Merchants of Manwine","Jogiani420.png")
addLogo("Keepers of the Grove of Zoe Elm","KeepersoftheGrove.png")
addLogo("Sea-Elm Southern Meadery","SeaElm420.png")
addLogo("Plains of Jogi","PlainsofJogi.png")
addLogo("Ale of the Night Central Brewery","AleofNight420.png")
addLogo("Camel Herders of the Jangsong Province","CamelHerders420.png")
addLogo("Anterran Imports and Services","AnterranImports420.png")
addLogo("Merchant Guild of the Poppy Goddess","PoppyGoddess420.png")
addLogo("Grand Cave Bee Meadery","GrandCave420.png")
addLogo("Cinammon Plains of Rouge","CinammonPlains420.png")
addLogo("The Velvet Company","VelvetHome420.png")
addLogo("Seamstresses of Rouge","Seamstresses420.png")
addLogo("Salurian Temple of Sacred Horehound","SalurianTemple421.png")
addLogo("Bulhanu Ranchers' Association","Bulhanu421.png")
addLogo("Suncliff Fisheries","Suncliff421.png")
addLogo("Ministers of Mistress Mugwort","Mugwort421.png")
addLogo("Blood Vineyards of the Far North","BloodVineyards421.png")
addLogo("Norsolyrian Wisp Rice Farmers Association","Norsolyrian421.png")
addLogo("Giid-Lisea Ranching Import Company","GiidLisea421.png")
addLogo("Bird Keepers of Saluria","SaluriaBK421.png")
addLogo("Hunters of the Giant Fanged Penguin","FangedPenguin421.png")
addLogo("Knights Castle Reindeer Herders","KnightsCastle421.png")
addLogo("Lindley Whaling Company","LindleyWhalingCompany.png")
addLogo("Aminian Coffee Company","Aminian421.png")
addLogo("Baratar Corporation","Baratar420.png")
addLogo("Roving Wind Farm Corporation","RovingWind420.png")
addLogo("Thalassian Temple Granite Export Cooperative","ThalassianGranite420.png")
addLogo("East Keltian Iron Company","EKIron420.png")
addLogo("Mylecian Coal Ports","CoalPorts420.png")
addLogo("Merchants of the Valley of Diamonds","ValleyofDiamonds420.png")
addLogo("East Keltian Timber Company","EKTimber420.png")
addLogo("Onceanic Boot Company","OnceanicBoot421.png")
addLogo("Commune of the Garganid Apostles","Garganid421.png")
addLogo("Shï Collective","ShiCollective421.png")
addLogo("Order of the Sphinx","OrderofSphinx421.png")
addLogo("Market Hanavusu","MarketHanavusu421.png")
addLogo("Somniant Stock Fund","SomniantStockFund.png")
addLogo("Lake Morovia Blockade Fund","BlockadeFund420.png")
addLogo("Court of the Dark Harpy","CourtDarkHarpy.png")
addLogo("Hatch Ministry","HatchMinistry420.png")
addLogo("Maritime Guild of the Cult of Maskmakers","MaritimeGuild420.png")
addLogo("Ergonian Spy Agency","ErgonianSpy421.png")
addLogo("Temple Bank of the Reformed Stripping Path","TempleBankCrest.png")
addLogo("Couriers of the Lizard Queen","LizardQueen421.png")
addLogo("Temple University of Delphica","TempleUniversity421.png")
addLogo("La Sái Ebile","LaSie421.png")
addLogo("Hellhound Breeders of Dragevik","Dragevik421.png")

-- 8) Product lists
local agriProducts = {
  "Rice — Gladeseed Farmers' Union",
  "Edible Algae — Gladeseed Farmers' Union",
  "Shrimp — Gladeseed Farmers' Union",
  "Anterran Spicy Onion — Gladeseed Farmers' Union",
  "Queen's Garlic — Gladeseed Farmers' Union",
  "Morovian Water Buffalo — Atterian Cattle Drivers",
  "Morovian Water Buffalo Beef — Atterian Cattle Drivers",
  "Unprocessed Noctic-Rabrev Flower — Noctic Fleet",
  "Processed Noctic Rabrev Flower — Noctic Fleet",
  "Noctic-Rabrev Flower Concentrate — Noctic Fleet",
  "Unprocessed Noctic-Rabrev Leaf — Noctic Fleet",
  "Processed Noctic-Rabrev Leaf — Noctic Fleet",
  "Unprocessed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
  "Processed Noctic-Rabrev Leaf Concentrate — Noctic Fleet",
  "Manwine — Jogiani Merchants of Manwine",
  "Milkwine — Jogiani Merchants of Manwine",
  "Zoe Elm Resin (Unrefined) — Keepers of the Grove of Zoe Elm",
  "Zoe Elm Resin (Refined) — Keepers of the Grove of Zoe Elm",
  "Sea Elm Flavored Mead — Sea-Elm Southern Meadery",
  "Wheat — Plains of Jogi",
  "Oats — Plains of Jogi",
  "Cereal — Plains of Jogi",
  "Hay — Plains of Jogi",
  "Ale of the Night — Ale of the Night Central Brewery",
  "Camels — Camel Herders of the Jangsong Province",
  "Camel Meat — Camel Herders of the Jangsong Province",
  "Camel Milk — Camel Herders of the Jangsong Province",
  "Camel Hump Water — Camel Herders of the Jangsong Province",
  "Camel Hump Water Tea — Camel Herders of the Jangsong Province",
  "Pearls — Anterran Imports and Services",
  "Abalone — Anterran Imports and Services",
  "Opium — Merchant Guild of the Poppy Goddess",
  "Hash — Merchant Guild of the Poppy Goddess",
  "Mead — Grand Cave Bee Meadery",
  "Cinammon — Cinammon Plains of Rouge",
  "Velvet Worm Meat — The Velvet Company",
  "Velvet Worm Eggs — The Velvet Company",
  "Silk — Seamstresses of Rouge",
  "Horehound Mead — Salurian Temple of Sacred Horehound",
  "Horehound Beer — Salurian Template of Sacred Horehound",
  "Sea Cow Beef — Bulhanu Ranchers' Association",
  "Atterian Armored Pufferfish — Suncliff Fisheries",
  "Morovian Saucer Eyed Giant Eel — Suncliff Fisheries",
  "Amina Crab — Suncliff Fisheries",
  "Mugwort Oil — Ministers of Mistress Mugwort",
  "Ground Mugwort — Ministers of Mistress Mugwort",
  "Mugwort Tincture — Ministers of Mistress Mugwort",
  "Blood InfusedRed Wine — Blood Vineyards of the Far North",
  "Wisp Rice — Norsolyrian Wisp Rice Farmers Association",
  "Giid-Lisea-Eda — Giid-Lisea Ranching Import Company",
  "Giid-Lisea-Eda Beef — Giid-Lisea Ranching Import Company",
  "Vaeringheim Turkey Meat — Bird Keepers of Saluria",
  "Salurian Swamp Quail Eggs — Bird Keepers of Saluria",
  "Giant Fanged Penguin Blubber — Hunters of the Giant Fanged Penguin",
  "Giant Fanged Penguin Blubber Oil Extract — Hunters of the Giant Fanged Penguin",
  "Coffee — Aminian Coffee Company"
}
local miningProducts = {
  "Purple Granite — Thalassian Temple Granite Export Cooperative",
  "Iron — East Keltian Iron Company",
  "Steel — East Keltian Iron Company",
  "Concrete — East Keltian Iron Company",
  "Coal — Mylecian Coal Ports",
  "Diamonds — Merchants of the Valley of Diamonds",
  "Timber — East Keltian Timber Company",
  "Mens' Boots — Onceanic Boot Company",
  "Womens' Boots — Onceanic Boot Company",
  "Garganram Sign Plains Fertilizer — Commune of the Garganid Apostles",
  "Gold Necklaces — Shï Collective",
  "Gold Rings — Shï Collective",
  "Gold Bracelets — Shï Collective",
  "Gold Earrings — Shï Collective",
  "Robes — Order of the Sphinx",
  "Dresses — Order of the Sphinx",
  "Tarnkappes — Order of the Sphinx",
  "Coats — Order of the Sphinx",
  "Perfume — Market Hanavusu",
  "Cologne — Market Hanavusu",
  "Incense — Market Hanavusu",
  "Candles — Market Hanavusu"
}

-- 9) Privateer captains (truncated list)
local privateers = {
    {first="Talvios", last="Karnis", nick="Erebektos"},
    {first="Mirek",   last="Davros", nick="Zammarion"},
    {first="Ilion",   last="Quoros"},
    -- etc…
}
local function getRandomPrivateer()
    local c = randomChoice(privateers)
    if c.nick and math.random()<0.25 then
        return string.format("Captain %s “%s” %s",c.first,c.nick,c.last)
    else
        return string.format("Captain %s %s",c.first,c.last)
    end
end

-- 10) Owner/Operator logic
local function getOwner(vt,ct)
    if     vt=="Ritual"    then return randomChoice(ritualCults)
    elseif vt=="Military"  then return randomChoice(militaryDivs)
    elseif vt=="Privateer" then return getRandomPrivateer()
    elseif vt=="Cargo" then
        if     ct=="Agricultural"         then return randomChoice(agriCompanies)
        elseif ct=="Mining/Manufacturing" then return randomChoice(miningCompanies)
        elseif ct=="Services"             then return randomChoice(serviceCompanies)
        end
    end
    return "Independent Consortium"
end

-- 11) Build table
function p.generateShipTable()
    math.randomseed(os.time())
    local year, day = p.getCurrentDate()
    local ships = {}

    for i=1,math.random(50,80) do
        local hr, mn = math.random(0,23), math.random(0,59)
        local vt = randomChoice(vesselTypes)
        local ct = randomChoice(cargoTypes)

        -- pick up to 3 products if Cargo + Agri/Mfg
        local prods = {}
        if vt=="Cargo" and ct=="Agricultural" then
            for _=1,math.random(1,3) do
                prods[#prods+1] = randomChoice(agriProducts)
            end
        elseif vt=="Cargo" and ct=="Mining/Manufacturing" then
            for _=1,math.random(1,3) do
                prods[#prods+1] = randomChoice(miningProducts)
            end
        end

        local owner = getOwner(vt,ct)
        local logo  = companyLogo[owner] and ("[[File:"..companyLogo[owner].."|20px]] ") or ""

        ships[#ships+1] = {
            date       = string.format("Day %d, Y.%d", day, year),
            time       = string.format("%02d:%02d",hr,mn),
            sort       = hr*60+mn,
            vid        = "VM-"..math.random(10000,99999),
            home       = cityFlag[randomChoice(cities)],
            typ        = vt,
            ownerCell  = logo..owner,
            cargotype  = ct,
            products   = prods,
            berth      = math.random(1,124),
            teus       = math.random(100,1000),
            tonnage    = string.format("%.2f",math.random()*19000+1000),
            queue      = string.format("%.2f",math.random()*5.5+0.5),
            turnaround = string.format("%.2f",math.random()*32+4),
            error      = (math.random()<0.2 and randomChoice{
                            "Cargo Mislabeling","Improper Documentation",
                            "Surveillance Anomaly","Inspection Failure",
                            "Unregistered Ritual Cargo"
                         }) or "None"
        }
    end

    table.sort(ships, function(a,b) return a.sort<b.sort end)

    local out = {
      '{| class="wikitable sortable"',
      '! Date !! Time !! Vessel ID !! Home City !! Type !! Owner/Operator !! Cargo Type !! Products !! Berth !! TEUs !! Tonnage (t) !! Queue (hrs) !! Turnaround (hrs) !! Error'
    }

    for _,s in ipairs(ships) do
        -- build product cell with logos
        local prodCell = "#N/A"
        if #s.products>0 then
            prodCell = "<ul>"
            for _,pr in ipairs(s.products) do
                local name, comp = pr:match("^(.-) %— (.+)$")
                if comp and companyLogo[comp] then
                    prodCell = prodCell..string.format(
                      "<li>%s — [[File:%s|20px]] %s</li>",
                      name, companyLogo[comp], comp
                    )
                else
                    prodCell = prodCell.."<li>"..pr.."</li>"
                end
            end
            prodCell = prodCell.."</ul>"
        end

        out[#out+1] = string.format(
          "|-\n| %s || %s || %s || %s || %s || %s || %s || %s || %d || %d || %s || %s || %s || %s",
          s.date, s.time, s.vid, s.home, s.typ,
          s.ownerCell, s.cargotype, prodCell,
          s.berth, s.teus, s.tonnage, s.queue, s.turnaround, s.error
        )
    end

    out[#out+1] = "|}\n\n'''Error Key:'''"
    out[#out+1] = "* '''Cargo Mislabeling:''' Manifest ≠ actual goods"
    out[#out+1] = "* '''Improper Documentation:''' Missing or outdated papers"
    out[#out+1] = "* '''Surveillance Anomaly:''' Unexpected heat/motion signature"
    out[#out+1] = "* '''Inspection Failure:''' Customs/hatch failure"
    out[#out+1] = "* '''Unregistered Ritual Cargo:''' Not pre-cleared by Temple Bank"

    return table.concat(out, "\n")
end

function p.dailyReport()
    local y,d = p.getCurrentDate()
    local hdr = string.format(
      "'''General Port of Lake Morovia: Operational Log – Day %d, Year %d PSSC'''", d, y
    )
    return hdr.."\n"..p.generateShipTable()
end

return p