Module:Shops
From The Walkscape Walkthrough
Documentation for this module may be created at Module:Shops/doc
local p = {}
local shops = {
{ShopName = "Adventurers' Guild Outpost", Type = "Outpost", Icon = "File:Adventure Guild Outpost Cabin Icon.svg|frameless|32x32px", Location = "Horn of Respite", Region = "Jarvonia"},
{ShopName = "Fort of Permafrost (Castle)", Type = "Castle", Icon = "File:Castle Icon.svg|frameless|32x32px", Location = "Fort of Permafrost", Region = "Jarvonia"},
{ShopName = "Frosthook Emporium", Type = "Fishing Store", Icon = "File:Fishing Shop Icon.svg|frameless|32x32px", Location = "Port Skildar", Region = "Jarvonia"},
{ShopName = "Helpful Herbert's Hut", Type = "House", Icon = "File:Cabin Icon.svg|frameless|32x32px", Location = "Disenchanted Forest", Region = "Jarvonia"},
{ShopName = "The Icy Goblet", Type = "Tavern", Icon = "File:Tavern Icon.svg|frameless|32x32px", Location = "Kallaheim", Region = "Jarvonia"},
{ShopName = "JarvoJoy", Type = "Activity Shop", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Frusenholm", Region = "Jarvonia"},
{ShopName = "Kallaheim's Frosty Finds", Type = "General Store", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Kallaheim", Region = "Jarvonia"},
{ShopName = "Northstar Mercantile", Type = "General Store", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Centaham", Region = "Jarvonia"},
{ShopName = "Polar Pruning", Type = "Barber", Icon = "File:Barber Icon.svg|frameless|32x32px", Location = "Azurazera", Region = "Jarvonia"},
{ShopName = "Tundra Trends", Type = "Clothing Shop", Icon = "File:Clothing Shop Icon.svg|frameless|32x32px", Location = "Azurazera", Region = "Jarvonia"},
{ShopName = "Woodcutter's Cabin", Type = "House", Icon = "File:Cabin Icon.svg|frameless|32x32px", Location = "Nomad Woods", Region = "Jarvonia"},
{ShopName = "Bog & Blade", Type = "Barber", Icon = "File:Barber Icon.svg|frameless|32x32px", Location = "Salsfirth", Region = "GDTE"},
{ShopName = "Fish Market Stall", Type = "Market Stall", Icon = "File:Market Stall Icon.svg|frameless|32x32px", Location = "Granfiddich", Region = "GDTE"},
{ShopName = "Food Market Stall", Type = "Market Stall", Icon = "File:Market Stall Icon.svg|frameless|32x32px", Location = "Granfiddich", Region = "GDTE"},
{ShopName = "Mossy Merchant's Breeze Mart", Type = "General Store", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Everhaven", Region = "GDTE"},
{ShopName = "Paws are Us", Type = "Animal Shelter", Icon = "File:Animal Shelter Icon.svg|frameless|32x32px", Location = "Salsfirth", Region = "GDTE"},
{ShopName = "Quagmire Couture", Type = "Clothing Shop", Icon = "File:Clothing Shop Icon.svg|frameless|32x32px", Location = "Salsfirth", Region = "GDTE"},
{ShopName = "Tool Market Stall", Type = "Market Stall", Icon = "File:Market Stall Icon.svg|frameless|32x32px", Location = "Granfiddich", Region = "GDTE"},
{ShopName = "Casbrant's Sunken Ship", Type = "Fishing Store", Icon = "File:Fishing Shop Icon.svg|frameless|32x32px", Location = "Casbrant's Grave", Region = "Syrenthia"},
{ShopName = "Fin-tastic Fashion", Type = "Clothing Shop", Icon = "File:Clothing Shop Icon.svg|frameless|32x32px", Location = "Vastalume", Region = "Syrenthia"},
{ShopName = "Go with the Flow Barbershop", Type = "Barber", Icon = "File:Barber Icon.svg|frameless|32x32px", Location = "Vastalume", Region = "Syrenthia"},
{ShopName = "Pearl of the Sea", Type = "Tavern", Icon = "File:Tavern Icon.svg|frameless|32x32px", Location = "Vastalume", Region = "Syrenthia"},
{ShopName = "Sunken Anchor", Type = "General Store", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Vastalume", Region = "Syrenthia"},
{ShopName = "Undercurrent", Type = "General Store", Icon = "File:General Store Icon.svg|frameless|32x32px", Location = "Vastalume", Region = "Syrenthia"},
}
function p.getShopData(frame)
local shopName = frame.args[1]
for _, shop in ipairs(shops) do
if shop.ShopName == shopName then
return shop
end
end
return "Shop not found."
end
function p.getShopData_AsTableRow(frame)
-- Extract the shop name from the frame arguments
local shopName = frame.args[1]
for _, shop in ipairs(shops) do
if shop.ShopName == shopName then
return string.format("|-\n| [[%s]] || [[%s]] || %s || [[%s]] || [[%s]]", shop.Icon, shop.ShopName, shop.Type, shop.Location, shop.Region)
end
end
return string.format("Shop %s not found", shopName)
end
function p.getShops()
return shops
end
function p.getAllShops()
local rows = {}
table.insert(rows, string.format("{| class=\"wikitable sortable\"\n! colspan=\"2\" |Shop Name !! Type !! Location !! Region"))
for _, shop in ipairs(shops) do
table.insert(rows, string.format("|-\n| [[%s]] || [[%s]] || %s || [[%s]] || [[%s]]", shop.Icon, shop.ShopName, shop.Type, shop.Location, shop.Region))
end
table.insert(rows, "|}")
return table.concat(rows, "\n")
end
function p.getAllShopsByLocation(frame)
local location = frame.args[1]
local rows = {}
table.insert(rows, string.format("{| class=\"wikitable sortable\"\n! colspan=\"2\" |Shop Name !! Type !! Region"))
for _, shop in ipairs(shops) do
if shop.Location == location then
table.insert(rows, string.format("|-\n| [[%s]] || [[%s]] || %s || [[%s]]", shop.Icon, shop.ShopName, shop.Type, shop.Region))
end
end
table.insert(rows, "|}")
return table.concat(rows, "\n")
end
function p.getAllShopsByRegion(frame)
local region = frame.args[1]
local rows = {}
table.insert(rows, string.format("{| class=\"wikitable sortable\"\n! colspan=\"2\" |Shop Name !! Type !! Location"))
for _, shop in ipairs(shops) do
if shop.Region == region then
table.insert(rows, string.format("|-\n| [[%s]] || [[%s]] || %s || [[%s]]", shop.Icon, shop.ShopName, shop.Type, shop.Location))
end
end
table.insert(rows, "|}")
return table.concat(rows, "\n")
end
function p.getAllShopsByType(frame)
local shoptype = frame.args[1]
local rows = {}
table.insert(rows, string.format("{| class=\"wikitable sortable\"\n! colspan=\"2\" |Building Name !! Location !! Region"))
for _, shop in ipairs(shops) do
if shop.Type == shoptype then
table.insert(rows, string.format("|-\n| [[%s]] || [[%s]] || [[%s]] || [[%s]]", shop.Icon, shop.ShopName, shop.Location, shop.Region))
end
end
table.insert(rows, "|}")
return table.concat(rows, "\n")
end
return p