Module:RatKetBuying
From Fallen London Wiki
Documentation for this module may be created at Module:RatKetBuying/doc
p = {}
-- Editable, demands list.
-- Each new demand is a key-value pair
-- key - name of the demand
-- value - list of lists that represent items sold
-- -- each list has two values
-- -- [0] - name of the item (wiki page)
-- -- [1] - name of the item as shown in-text
demands = {
Inscrutable = {{"Uncanny Incunabulum", "Uncanny Incunabula"}, {"Cartographer's Hoard", "Cartographer's Hoards"}, {"Chimerical Archive", "Chimerical Archives"}},
Intricate = {{"Unlawful Device", "Unlawful Devices"}, {"Crackling Device", "Crackling Devices"}},
Saintly = {{"Ratty Reliquary", "Ratty Reliquaries"}, {"False Hagiotoponym", "False Hagiotoponyms"}},
Soft = {{"Parabola-Linen Scrap", "Parabola-Linen"}, {"Scrap of Ivory Organza", "Ivory Organza"}},
Maudlin = {{"Captivating Ballad", "Captivating Ballads"}, {"Parabolan Parable", "Parabolan Parables"}},
Tempestuous = {{"Storm-Threnody", "Storm-Threnodies"}, {"Night-Whisper", "Night-Whispers"}},
Calculating = {{"Vital Intelligence", "Vital Intelligence"}, {"Corresponding Sounder", "Corresponding Sounders"}, {"Queen Mate", "paired sets of Queen and Epaulette Mates"}},
Ruinous = {{"Dreadful Surmise", "Dreadful Surmises"}, {"Distillation of Retribution", "Distillations of Retribution"}, {"Mortification of a Great Power", "Mortifications of a Great Power"}}
}
function p.currentDemands()
local out = "Presently, the Rat Market is buying:\n"
for demandName, demandInfo in pairs(demands) do
local demandValue = p.getDemand(demandName)
local run = true
if demandValue == "1" then
out = out .. "* Newly-available"
elseif demandValue == "2" then
out = out .. "* Leaving after"
else
run = false
end
if run then
out = out .. " this week: "
for k, itemInfo in pairs(demandInfo) do
out = out .. "[[" .. itemInfo[1] .. "|" .. itemInfo[2] .. "]] and "
end
out = out:sub(0, -6) .. ".\n"
end
end
return out
end
function p.getDemand(name)
return mw.smw.ask("[[" .. name .. " Demand]]|?Has current value")[1]["Has current value"]
end
return p