Module:AutoUpdateManfPrices: Difference between revisions
From MicrasWiki
Jump to navigationJump to search
NewZimiaGov (talk | contribs) No edit summary |
NewZimiaGov (talk | contribs) No edit summary |
||
| Line 29: | Line 29: | ||
local products = { | local products = { | ||
{"BT-01 Rifle", "Baratar Corporation", 3.15}, | {"BT-01 Rifle", "Baratar Corporation", 3.15, "shipments"}, | ||
{"Q31 Spearhead", "Baratar Corporation", 0.27}, | {"Q31 Spearhead", "Baratar Corporation", 0.27, "cases"}, | ||
{"Q31 Recon", "Baratar Corporation", 2.25}, | {"Q31 Recon", "Baratar Corporation", 2.25, "units"}, | ||
{"Lowland 9mm", "Baratar Corporation", 3.90}, | {"Lowland 9mm", "Baratar Corporation", 3.90, "cases"}, | ||
{"q38.7 Sniper Rifle", "Baratar Corporation", 0.45}, | {"q38.7 Sniper Rifle", "Baratar Corporation", 0.45, "crates"}, | ||
{"Electricity", "Atterian Cattle Drivers", 550.00}, | {"Electricity", "Atterian Cattle Drivers", 550.00, "megawatts"}, | ||
{"Purple Granite", "Thalassian Temples Granite Export Cooperative", 0.036}, | {"Purple Granite", "Thalassian Temples Granite Export Cooperative", 0.036, "blocks"}, | ||
{"Iron", "East Keltian Iron Company", 1.692}, | {"Iron", "East Keltian Iron Company", 1.692, "tons"}, | ||
{"Steel", "East Keltian Iron Company", 2.412}, | {"Steel", "East Keltian Iron Company", 2.412, "tons"}, | ||
{"Concrete", "East Keltian Iron Company", 6.039}, | {"Concrete", "East Keltian Iron Company", 6.039, "tons"}, | ||
{"Coal", "Mylecian Coal Ports", 0.378}, | {"Coal", "Mylecian Coal Ports", 0.378, "tons"}, | ||
{"Diamonds", "Merchants of the Valley of Diamonds", 0.05}, | {"Diamonds", "Merchants of the Valley of Diamonds", 0.05, "carats"}, | ||
{"Timber", "East Keltian Timber Company", 5.63}, | {"Timber", "East Keltian Timber Company", 5.63, "logs"}, | ||
{"Mens' Boots", "Onceanic Boot Company", 2.00}, | {"Mens' Boots", "Onceanic Boot Company", 2.00, "pairs"}, | ||
{"Womens' Boots", "Onceanic Boot Company", 3.00}, | {"Womens' Boots", "Onceanic Boot Company", 3.00, "pairs"}, | ||
{"Garganram Sign Plains Fertilizer", "Commune of the Garganid Apostles", 0.60}, | {"Garganram Sign Plains Fertilizer", "Commune of the Garganid Apostles", 0.60, "tons"}, | ||
{"Gold Necklaces", "Shï Collective", 0.15}, | {"Gold Necklaces", "Shï Collective", 0.15, "pieces"}, | ||
{"Gold Rings", "Shï Collective", 0.40}, | {"Gold Rings", "Shï Collective", 0.40, "pieces"}, | ||
{"Gold Bracelets", "Shï Collective", 0.27}, | {"Gold Bracelets", "Shï Collective", 0.27, "pieces"}, | ||
{"Gold Earrings", "Shï Collective", 0.65}, | {"Gold Earrings", "Shï Collective", 0.65, "pairs"}, | ||
{"Robes", "Order of the Sphinx", 1.30}, | {"Robes", "Order of the Sphinx", 1.30, "units"}, | ||
{"Dresses", "Order of the Sphinx", 0.65}, | {"Dresses", "Order of the Sphinx", 0.65, "units"}, | ||
{"Tarnkappes", "Order of the Sphinx", 2.10}, | {"Tarnkappes", "Order of the Sphinx", 2.10, "cloaks"}, | ||
{"Coats", "Order of the Sphinx", 1.05}, | {"Coats", "Order of the Sphinx", 1.05, "units"}, | ||
{"Perfume", "Market Hanavusu", 0.32}, | {"Perfume", "Market Hanavusu", 0.32, "bottles"}, | ||
{"Cologne", "Market Hanavusu", 0.45}, | {"Cologne", "Market Hanavusu", 0.45, "bottles"}, | ||
{"Incense", "Market Hanavusu", 0.90}, | {"Incense", "Market Hanavusu", 0.90, "sticks"}, | ||
{"Candles", "Market Hanavusu", 0.73}, | {"Candles", "Market Hanavusu", 0.73, "pieces"}, | ||
{"Makra Class Battle Tank", "Somniant Stock Fund", 0.0083}, | {"Makra Class Battle Tank", "Somniant Stock Fund", 0.0083, "units"}, | ||
{"Laya Class Heavy Tank", "Somniant Stock Fund", 0.0033}, | {"Laya Class Heavy Tank", "Somniant Stock Fund", 0.0033, "units"}, | ||
{"Arachne Class Light Tank", "Somniant Stock Fund", 0.0099}, | {"Arachne Class Light Tank", "Somniant Stock Fund", 0.0099, "units"}, | ||
{"Thalassa Class Main Battle Tank", "Somniant Stock Fund", 0.0050}, | {"Thalassa Class Main Battle Tank", "Somniant Stock Fund", 0.0050, "units"}, | ||
{"155mm Halicarn Class Self-Propelled Howitzer", "Somniant Stock Fund", 0.0025}, | {"155mm Halicarn Class Self-Propelled Howitzer", "Somniant Stock Fund", 0.0025, "units"}, | ||
{"Syrinx Class Armored Infantry", "Somniant Stock Fund", 0.049}, | {"Syrinx Class Armored Infantry", "Somniant Stock Fund", 0.049, "squads"}, | ||
{"Bijarian Command Vehicle", "Somniant Stock Fund", 0.00083}, | {"Bijarian Command Vehicle", "Somniant Stock Fund", 0.00083, "units"}, | ||
{"Onceanic Recon Vehicle", "Somniant Stock Fund", 0.00249}, | {"Onceanic Recon Vehicle", "Somniant Stock Fund", 0.00249, "units"}, | ||
{"Ephyra Class Anti-Aircraft Vehicle", "Somniant Stock Fund", 0.00120}, | {"Ephyra Class Anti-Aircraft Vehicle", "Somniant Stock Fund", 0.00120, "units"}, | ||
{"120mm Odiferian Class Mortar Carrier", "Somniant Stock Fund", 0.00160}, | {"120mm Odiferian Class Mortar Carrier", "Somniant Stock Fund", 0.00160, "units"}, | ||
{"Aurelia Class Defense System", "Somniant Stock Fund", 0.00083}, | {"Aurelia Class Defense System", "Somniant Stock Fund", 0.00083, "systems"}, | ||
{"Aithra Class Howitzer", "Somniant Stock Fund", 0.00170}, | {"Aithra Class Howitzer", "Somniant Stock Fund", 0.00170, "units"}, | ||
{"Aetheris Class Towed Howitzer", "Somniant Stock Fund", 0.00490}, | {"Aetheris Class Towed Howitzer", "Somniant Stock Fund", 0.00490, "units"}, | ||
{"Iynas Class Field Gun", "Somniant Stock Fund", 0.00420}, | {"Iynas Class Field Gun", "Somniant Stock Fund", 0.00420, "units"}, | ||
{"Kalithros Class Rifle", "Somniant Stock Fund", 0.83}, | {"Kalithros Class Rifle", "Somniant Stock Fund", 0.83, "units"}, | ||
{"Delphica Class Grenadier Rifle", "Somniant Stock Fund", 0.249}, | {"Delphica Class Grenadier Rifle", "Somniant Stock Fund", 0.249, "units"}, | ||
{"Chrysos Class Commando Rifle", "Somniant Stock Fund", 0.124}, | {"Chrysos Class Commando Rifle", "Somniant Stock Fund", 0.124, "units"}, | ||
{"Lothaya Class Sniper Rifle", "Somniant Stock Fund", 0.0332}, | {"Lothaya Class Sniper Rifle", "Somniant Stock Fund", 0.0332, "units"}, | ||
{"Erythros Class Pistol", "Somniant Stock Fund", 0.166}, | {"Erythros Class Pistol", "Somniant Stock Fund", 0.166, "units"}, | ||
{"Kalypso Class Aircraft Carrier", "Somniant Stock Fund", 0.00005}, | {"Kalypso Class Aircraft Carrier", "Somniant Stock Fund", 0.00005, "ships"}, | ||
{"Xylanda Class Attack Submarine", "Somniant Stock Fund", 0.00025}, | {"Xylanda Class Attack Submarine", "Somniant Stock Fund", 0.00025, "ships"}, | ||
{"Saluria Class Gunboat", "Somniant Stock Fund", 0.00041}, | {"Saluria Class Gunboat", "Somniant Stock Fund", 0.00041, "ships"}, | ||
{"Cetus Class Attack Craft", "Somniant Stock Fund", 0.00050}, | {"Cetus Class Attack Craft", "Somniant Stock Fund", 0.00050, "ships"}, | ||
{"Eidolon Class Cruiser", "Somniant Stock Fund", 0.00020}, | {"Eidolon Class Cruiser", "Somniant Stock Fund", 0.00020, "ships"}, | ||
{"Vaeringheim Class Corvette", "Somniant Stock Fund", 0.00050}, | {"Vaeringheim Class Corvette", "Somniant Stock Fund", 0.00050, "ships"}, | ||
{"Acheron Class Submersible Destroyer", "Somniant Stock Fund", 0.00016}, | {"Acheron Class Submersible Destroyer", "Somniant Stock Fund", 0.00016, "ships"}, | ||
{"Luminaria Class Carrier", "Somniant Stock Fund", 0.00004}, | {"Luminaria Class Carrier", "Somniant Stock Fund", 0.00004, "ships"}, | ||
{"Sylvapolis Class Frigate", "Somniant Stock Fund", 0.00032}, | {"Sylvapolis Class Frigate", "Somniant Stock Fund", 0.00032, "ships"}, | ||
{"Ferrum Citadel Class Battleship", "Somniant Stock Fund", 0.00009}, | {"Ferrum Citadel Class Battleship", "Somniant Stock Fund", 0.00009, "ships"}, | ||
{"Aetherium Class Patrol Ship", "Somniant Stock Fund", 0.00058}, | {"Aetherium Class Patrol Ship", "Somniant Stock Fund", 0.00058, "ships"}, | ||
{"Tartarian Amphibious Assault Craft", "Somniant Stock Fund", 0.00083}, | {"Tartarian Amphibious Assault Craft", "Somniant Stock Fund", 0.00083, "craft"}, | ||
{"Aithra Class Proximity Aircraft", "Somniant Stock Fund", 0.00083}, | {"Aithra Class Proximity Aircraft", "Somniant Stock Fund", 0.00083, "aircraft"}, | ||
{"Thalassa Class Attack Helicopter", "Somniant Stock Fund", 0.00130}, | {"Thalassa Class Attack Helicopter", "Somniant Stock Fund", 0.00130, "aircraft"}, | ||
{"Catonis Class Unmanned Aircraft", "Somniant Stock Fund", 0.00083}, | {"Catonis Class Unmanned Aircraft", "Somniant Stock Fund", 0.00083, "aircraft"}, | ||
{"Chrysos Class Sea Bomber", "Somniant Stock Fund", 0.00166}, | {"Chrysos Class Sea Bomber", "Somniant Stock Fund", 0.00166, "aircraft"}, | ||
{"Misttalon Class Heavy Bomber", "Somniant Stock Fund", 0.00025}, | {"Misttalon Class Heavy Bomber", "Somniant Stock Fund", 0.00025, "aircraft"}, | ||
{"Symphonara Class Compound Intercept", "Somniant Stock Fund", 0.00066}, | {"Symphonara Class Compound Intercept", "Somniant Stock Fund", 0.00066, "aircraft"}, | ||
{"Nefelian Transport Plane", "Somniant Stock Fund", 0.00083}, | {"Nefelian Transport Plane", "Somniant Stock Fund", 0.00083, "aircraft"}, | ||
{"Quadwalker \"Horehound\" 4170", "Somniant Stock Fund", 0.00050}, | {"Quadwalker \"Horehound\" 4170", "Somniant Stock Fund", 0.00050, "units"}, | ||
{"Quadwalker \"Dungbeetle\" 4172", "Somniant Stock Fund", 0.00041}, | {"Quadwalker \"Dungbeetle\" 4172", "Somniant Stock Fund", 0.00041, "units"}, | ||
{"Quadwalker \"Killbot\" 4200", "Somniant Stock Fund", 0.00020}, | {"Quadwalker \"Killbot\" 4200", "Somniant Stock Fund", 0.00020, "units"}, | ||
{"Quadwalker \"Oble-Lisea\" 4189", "Somniant Stock Fund", 0.00025}, | {"Quadwalker \"Oble-Lisea\" 4189", "Somniant Stock Fund", 0.00025, "units"}, | ||
{"Nexa Class Advanced Prototype", "Somniant Stock Fund", 0.00025}, | {"Nexa Class Advanced Prototype", "Somniant Stock Fund", 0.00025, "prototypes"}, | ||
{"Fenruvian THAAD System Facility", "Somniant Stock Fund", 0.00005}, | {"Fenruvian THAAD System Facility", "Somniant Stock Fund", 0.00005, "facilities"}, | ||
{"Atterian Class Combat Ship", "Somniant Stock Fund", 0.00016}, | {"Atterian Class Combat Ship", "Somniant Stock Fund", 0.00016, "ships"}, | ||
{"300mm Secutor Class Coastal Guns", "Somniant Stock Fund", 0.0033}, | {"300mm Secutor Class Coastal Guns", "Somniant Stock Fund", 0.0033, "guns"}, | ||
} | } | ||
| Line 148: | Line 148: | ||
function p.generateTable() | function p.generateTable() | ||
local date, dayOfMonth, month = getCurrentDate() | local date, dayOfMonth, month = getCurrentDate() | ||
local wikitable = "{| class=\"wikitable\"\n! Date (Day/Month/Year [[PSSC]]) !! Product !! Producing Company !! Base Price !! Tier III Price !! Tier II Price !! Tier I Price !! Explanation\n" | local wikitable = "{| class=\"wikitable\"\n! Date (Day/Month/Year [[PSSC]]) !! Product !! Producing Company !! Base Price !! Tier III Price !! Tier II Price !! Tier I Price !! Units !! Explanation\n" | ||
for _, product in ipairs(products) do | for _, product in ipairs(products) do | ||
local name, company, basePrice = product[1], product[2], product[3] | local name, company, basePrice, units = product[1], product[2], product[3], product[4] | ||
if basePrice > 0 then -- Only include products with prices greater than 0 | if basePrice > 0 then -- Only include products with prices greater than 0 | ||
local newPrice, changeFactor, explanation = simulatePriceChange(basePrice, dayOfMonth, month) | local newPrice, changeFactor, explanation = simulatePriceChange(basePrice, dayOfMonth, month) | ||
-- Calculate Tier prices | -- Calculate Tier prices | ||
local tierIIIPrice = math.floor((newPrice / 3) * 10000) / 10000 | local tierIIIPrice = math.floor((newPrice / 3) * 10000) / 10000 | ||
| Line 161: | Line 160: | ||
local tierIPrice = newPrice | local tierIPrice = newPrice | ||
wikitable = wikitable .. string.format("|-\n| %s || %s || %s || %.4f || %.4f || %.4f || %.4f || %s\n", | wikitable = wikitable .. string.format("|-\n| %s || %s || %s || %.4f || %.4f || %.4f || %.4f || %s || %s\n", | ||
date, name, company, basePrice, tierIIIPrice, tierIIPrice, tierIPrice, explanation) | date, name, company, basePrice, tierIIIPrice, tierIIPrice, tierIPrice, units, explanation) | ||
end | end | ||
end | end | ||
Revision as of 06:45, 25 December 2024
Documentation for this module may be created at Module:AutoUpdateManfPrices/doc
local p = {}
local function 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, dayOfMonth
if dayOfYear <= 61 then
month = 1
dayOfMonth = dayOfYear
elseif dayOfYear <= 122 then
month = 2
dayOfMonth = dayOfYear - 61
else
month = 3
dayOfMonth = dayOfYear - 122
end
return string.format("%d/%d/%d [[PSSC]]", dayOfMonth, month, psscYear), dayOfMonth, month
end
local products = {
{"BT-01 Rifle", "Baratar Corporation", 3.15, "shipments"},
{"Q31 Spearhead", "Baratar Corporation", 0.27, "cases"},
{"Q31 Recon", "Baratar Corporation", 2.25, "units"},
{"Lowland 9mm", "Baratar Corporation", 3.90, "cases"},
{"q38.7 Sniper Rifle", "Baratar Corporation", 0.45, "crates"},
{"Electricity", "Atterian Cattle Drivers", 550.00, "megawatts"},
{"Purple Granite", "Thalassian Temples Granite Export Cooperative", 0.036, "blocks"},
{"Iron", "East Keltian Iron Company", 1.692, "tons"},
{"Steel", "East Keltian Iron Company", 2.412, "tons"},
{"Concrete", "East Keltian Iron Company", 6.039, "tons"},
{"Coal", "Mylecian Coal Ports", 0.378, "tons"},
{"Diamonds", "Merchants of the Valley of Diamonds", 0.05, "carats"},
{"Timber", "East Keltian Timber Company", 5.63, "logs"},
{"Mens' Boots", "Onceanic Boot Company", 2.00, "pairs"},
{"Womens' Boots", "Onceanic Boot Company", 3.00, "pairs"},
{"Garganram Sign Plains Fertilizer", "Commune of the Garganid Apostles", 0.60, "tons"},
{"Gold Necklaces", "Shï Collective", 0.15, "pieces"},
{"Gold Rings", "Shï Collective", 0.40, "pieces"},
{"Gold Bracelets", "Shï Collective", 0.27, "pieces"},
{"Gold Earrings", "Shï Collective", 0.65, "pairs"},
{"Robes", "Order of the Sphinx", 1.30, "units"},
{"Dresses", "Order of the Sphinx", 0.65, "units"},
{"Tarnkappes", "Order of the Sphinx", 2.10, "cloaks"},
{"Coats", "Order of the Sphinx", 1.05, "units"},
{"Perfume", "Market Hanavusu", 0.32, "bottles"},
{"Cologne", "Market Hanavusu", 0.45, "bottles"},
{"Incense", "Market Hanavusu", 0.90, "sticks"},
{"Candles", "Market Hanavusu", 0.73, "pieces"},
{"Makra Class Battle Tank", "Somniant Stock Fund", 0.0083, "units"},
{"Laya Class Heavy Tank", "Somniant Stock Fund", 0.0033, "units"},
{"Arachne Class Light Tank", "Somniant Stock Fund", 0.0099, "units"},
{"Thalassa Class Main Battle Tank", "Somniant Stock Fund", 0.0050, "units"},
{"155mm Halicarn Class Self-Propelled Howitzer", "Somniant Stock Fund", 0.0025, "units"},
{"Syrinx Class Armored Infantry", "Somniant Stock Fund", 0.049, "squads"},
{"Bijarian Command Vehicle", "Somniant Stock Fund", 0.00083, "units"},
{"Onceanic Recon Vehicle", "Somniant Stock Fund", 0.00249, "units"},
{"Ephyra Class Anti-Aircraft Vehicle", "Somniant Stock Fund", 0.00120, "units"},
{"120mm Odiferian Class Mortar Carrier", "Somniant Stock Fund", 0.00160, "units"},
{"Aurelia Class Defense System", "Somniant Stock Fund", 0.00083, "systems"},
{"Aithra Class Howitzer", "Somniant Stock Fund", 0.00170, "units"},
{"Aetheris Class Towed Howitzer", "Somniant Stock Fund", 0.00490, "units"},
{"Iynas Class Field Gun", "Somniant Stock Fund", 0.00420, "units"},
{"Kalithros Class Rifle", "Somniant Stock Fund", 0.83, "units"},
{"Delphica Class Grenadier Rifle", "Somniant Stock Fund", 0.249, "units"},
{"Chrysos Class Commando Rifle", "Somniant Stock Fund", 0.124, "units"},
{"Lothaya Class Sniper Rifle", "Somniant Stock Fund", 0.0332, "units"},
{"Erythros Class Pistol", "Somniant Stock Fund", 0.166, "units"},
{"Kalypso Class Aircraft Carrier", "Somniant Stock Fund", 0.00005, "ships"},
{"Xylanda Class Attack Submarine", "Somniant Stock Fund", 0.00025, "ships"},
{"Saluria Class Gunboat", "Somniant Stock Fund", 0.00041, "ships"},
{"Cetus Class Attack Craft", "Somniant Stock Fund", 0.00050, "ships"},
{"Eidolon Class Cruiser", "Somniant Stock Fund", 0.00020, "ships"},
{"Vaeringheim Class Corvette", "Somniant Stock Fund", 0.00050, "ships"},
{"Acheron Class Submersible Destroyer", "Somniant Stock Fund", 0.00016, "ships"},
{"Luminaria Class Carrier", "Somniant Stock Fund", 0.00004, "ships"},
{"Sylvapolis Class Frigate", "Somniant Stock Fund", 0.00032, "ships"},
{"Ferrum Citadel Class Battleship", "Somniant Stock Fund", 0.00009, "ships"},
{"Aetherium Class Patrol Ship", "Somniant Stock Fund", 0.00058, "ships"},
{"Tartarian Amphibious Assault Craft", "Somniant Stock Fund", 0.00083, "craft"},
{"Aithra Class Proximity Aircraft", "Somniant Stock Fund", 0.00083, "aircraft"},
{"Thalassa Class Attack Helicopter", "Somniant Stock Fund", 0.00130, "aircraft"},
{"Catonis Class Unmanned Aircraft", "Somniant Stock Fund", 0.00083, "aircraft"},
{"Chrysos Class Sea Bomber", "Somniant Stock Fund", 0.00166, "aircraft"},
{"Misttalon Class Heavy Bomber", "Somniant Stock Fund", 0.00025, "aircraft"},
{"Symphonara Class Compound Intercept", "Somniant Stock Fund", 0.00066, "aircraft"},
{"Nefelian Transport Plane", "Somniant Stock Fund", 0.00083, "aircraft"},
{"Quadwalker \"Horehound\" 4170", "Somniant Stock Fund", 0.00050, "units"},
{"Quadwalker \"Dungbeetle\" 4172", "Somniant Stock Fund", 0.00041, "units"},
{"Quadwalker \"Killbot\" 4200", "Somniant Stock Fund", 0.00020, "units"},
{"Quadwalker \"Oble-Lisea\" 4189", "Somniant Stock Fund", 0.00025, "units"},
{"Nexa Class Advanced Prototype", "Somniant Stock Fund", 0.00025, "prototypes"},
{"Fenruvian THAAD System Facility", "Somniant Stock Fund", 0.00005, "facilities"},
{"Atterian Class Combat Ship", "Somniant Stock Fund", 0.00016, "ships"},
{"300mm Secutor Class Coastal Guns", "Somniant Stock Fund", 0.0033, "guns"},
}
local events = {
["1,6"] = "Bayram al-Nur (Festival of Light) [Vaeringheim]",
["1,18"] = "Chag Or Hadash (Festival of New Light) [Luminaria]",
["1,30"] = "Symposion Eirinis (Symposium of Harmony) [Serena]",
["1,43"] = "Alev Günü (Day of Flame) [Pyralis]",
["1,48"] = "Day of Abandonment [Vaeringheim]",
["1,55"] = "Tikkun Tzel (Repair of Shadows) [Symphonara]",
["2,6"] = "Panegyris Chrysou (Golden Gathering) [Aurelia]",
["2,17"] = "Constitution Day [Luminaria]",
["2,19"] = "Mehtap Dalgası (Moonlit Tide) [Vaeringheim]",
["2,31"] = "Oneiro Foteino (Dream of Illumination) [Somniumpolis]",
["2,39"] = "Anniversary of victory in the New South Jangsong Campaign [Nexa]",
["2,44"] = "Erev Galgal (Eve of Cycles) [Nexa]",
["2,45"] = "Bassaridia Festival [Somniumpolis]",
["2,48"] = "Anniversary of victory in the Southern Lake Morovia Campaign [Somniumpolis]",
["2,54"] = "Leilat al-Kamar (Night of the Moon) [Lunalis Sancta]",
["2,61"] = "Taşrakah (Reverence of the Stone) [Luminaria]",
["3,6"] = "Chag Tvuah (Festival of Harvest) [Sylvapolis]",
["3,18"] = "Anagenesis Eirmos (Procession of Rebirth) [Acheron]",
["3,28"] = "Panagia Therizis (Holy Day of the Reaper) [Sylvapolis]",
["3,37"] = "Anniversary of victory in the Morovian Frontier Campaign [Acheron]",
["3,43"] = "Karnavali Thysias (Carnival of Celebration) [Erythros]",
["3,53"] = "Sefar Yashar (Straight Path Celebration) [Catonis Atrium]",
}
local function simulatePriceChange(basePrice, dayOfMonth, month)
local dateKey = string.format("%d,%d", month, dayOfMonth)
local changeFactor = math.random(-20, 20) / 100
local explanation = ""
if events[dateKey] then
explanation = events[dateKey] .. ": Prices influenced by event dynamics."
changeFactor = changeFactor + 0.05 -- Boost price change for significant events
else
explanation = "General market fluctuations."
end
local newPrice = math.floor((basePrice * (1 + changeFactor)) * 10000) / 10000
return newPrice, changeFactor, explanation
end
function p.generateTable()
local date, dayOfMonth, month = getCurrentDate()
local wikitable = "{| class=\"wikitable\"\n! Date (Day/Month/Year [[PSSC]]) !! Product !! Producing Company !! Base Price !! Tier III Price !! Tier II Price !! Tier I Price !! Units !! Explanation\n"
for _, product in ipairs(products) do
local name, company, basePrice, units = product[1], product[2], product[3], product[4]
if basePrice > 0 then -- Only include products with prices greater than 0
local newPrice, changeFactor, explanation = simulatePriceChange(basePrice, dayOfMonth, month)
-- Calculate Tier prices
local tierIIIPrice = math.floor((newPrice / 3) * 10000) / 10000
local tierIIPrice = math.floor((newPrice * 2 / 3) * 10000) / 10000
local tierIPrice = newPrice
wikitable = wikitable .. string.format("|-\n| %s || %s || %s || %.4f || %.4f || %.4f || %.4f || %s || %s\n",
date, name, company, basePrice, tierIIIPrice, tierIIPrice, tierIPrice, units, explanation)
end
end
wikitable = wikitable .. "|}"
return wikitable
end
return p