Module:ResourceData: Difference between revisions

From Against the Storm Official Wiki
(added buildings)
m (Aeredor moved page Module:IconFilenames to Module:ResourceData without leaving a redirect: expanding the data beyond icon filenames; specializing this data file to resources)

Revision as of 18:57, 3 February 2023

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

-------------------------------------------------------------------------------
-- Lua storage table for looking up image files based on in-game names.
--
-- The table contains some deconfliction, but only for spaces and just a few
-- cases of singular and plural versions.
-- Use in-game names for things, and help keep this table updated as the game
-- is updated.
--
-- Using the table requires a locally defined lookup function that performs 
-- a string.lower on the argument so that the lookup table can accept any case 
-- and still function properly. Otherwise, we would need the table to define
-- Berries = "Berries.png" and berries = "Berries.png" which would suck.
-------------------------------------------------------------------------------


-- for returning when REQUIRE'd by other Lua modules.
local IconFilenames = {}



-------------------------------------------------------------------------------
-- Main data table, with string keys and string values.
-- Some of these are defined inline with string.lower to make the key easier
-- to spell and read correctly.
-------------------------------------------------------------------------------

local tableStrStrFilenames = {

	---------------------------------------
	-- Resources
	---------------------------------------
	
    -- Raw Food
	["berries"] = "Berries.png",
	["eggs"] = "Eggs.png",
	["insects"] = "Insects.png",
	["meat"] = "Meat.png",
	["mushrooms"] = "Mushrooms.png",
	["roots"] = "Roots.png",
	["vegetables"] = "Vegetables.png",
	-- Complex Food
	["biscuits"] = "Biscuits.png",
	["jerky"] = "Jerky.png",
	[string.lower("PickledGoods")] = "PickledGoods.png",
	["pickled goods"] = "PickledGoods.png",
	["pie"] = "Pie.png",
	["skewers"] = "Skewers.png",
	-- Building Materials
	["bricks"] = "Bricks.png",
	["fabric"] = "Fabric.png",
	["planks"] = "Planks.png",
	["parts"] = "Parts.png",
	[string.lower("WildfireEssence")] = "Wildfire Essence.png",
	["wildfire essence"] = "Wildfire Essence.png",
	-- Consumable Items
	["coats"] = "Coats.png",
	["ale"] = "Ale.png",
	["cosmetics"] = "Cosmetics.png",
	["incense"] = "Incense.png",
	["scrolls"] = "Scrolls.png",
	[string.lower("TrainingGear")] = "TrainingGear.png",
	["training gear"] = "TrainingGear.png",
	["wine"] = "Wine.png",
	-- Crafting Materials
	["clay"] = "Clay.png",
	[string.lower("CopperOre")] = "CopperOre.png",
	["copper ore"] = "CopperOre.png",
	[string.lower("CrystalizedDew")] = "CrystalizedDew.png",
	["crystalized dew"] = "CrystalizedDew.png",
	["grain"] = "Grain.png",
	["herbs"] = "Herbs.png",
	["leather"] = "Leather.png",
	["plantfiber"] = "PlantFiber.png",
	["plant fiber"] = "PlantFiber.png",
	["reeds"] = "Reeds.png",
	["reed"] = "Reeds.png",
	["resin"] = "Resin.png",
	["sparkdew"] = "Sparkdew.png",
	["stone"] = "Stone.png",
	-- Refined Crafting Materials
	["barrels"] = "Barrels.png",
	["barrel"] = "Barrels.png",
	["copperbar"] = "CopperBar.png",
	["copper bar"] = "CopperBar.png",
	["flour"] = "Flour.png",
	["pigment"] = "Pigment.png",
	["pigments"] = "Pigment.png",
	["pottery"] = "Pottery.png",
	["waterskins"] = "Waterskins.png",
	["waterskin"] = "Waterskins.png",
	-- Trade Goods
	["buildingmaterials"] = "BuildingMaterials.png",
	["packofbuildingmaterials"] = "BuildingMaterials.png",
	["crops"] = "Crops.png",
	["packofcrops"] = "Crops.png",
	["luxurygoods"] = "Luxury.png",
	["packofluxurygoods"] = "Luxury.png",
	["provisions"] = "Provisions.png",
	["packofprovisions"] = "Provisions.png",
	["tradegoods"] = "TradeGoods.png",
	["packoftradegoods"] = "TradeGoods.png",
	["amber"] = "Amber.png",
	[string.lower("AncientTablet")] = "AncientTablet.png",
	["ancient tablet"] = "AncientTablet.png",
	["foodstockpiles"] = "Icon MetaResource FoodStockpiles.png",
	["food stockpiles"] = "Icon MetaResource FoodStockpiles.png",
	["metafood"] = "Icon MetaResource FoodStockpiles.png",
	["machinery"] = "Icon MetaResource Machinery.png",
	["metamachinery"] = "Icon MetaResource Machinery.png",
	["artifact"] = "Icon MetaResource Artifact.png",
	["artifacts"] = "Icon MetaResource Artifact.png",
	[string.lower("MetaArtifact")] = "Icon MetaResource Artifact.png",
	-- Fuel & Exploration
	["coal"] = "Coal.png",
	["oil"] = "Oil.png",
	["seamarrow"] = "SeaMarrow.png",
	["sea marrow"] = "SeaMarrow.png",
	["wood"] = "Wood.png",
	["simpletools"] = "SimpleTools.png",
	["simple tools"] = "SimpleTools.png",
	["infusedtools"] = "InfusedTools.png",
	["infused tools"] = "InfusedTools.png",
	["purgingfire"] = "PurgingFire.png",
	["purging fire"] = "PurgingFire.png",
	
	---------------------------------------
	-- Buildings
	---------------------------------------
	
	-- Starting Buildings
	["ancienthearth"] = "Small Hearth icon.png",
	["ancient hearth"] = "Small Hearth icon.png",
	["mainwarehouse"] = "Main_Storage_icon.png",
	["main warehouse"] = "Main_Storage_icon.png",
	-- Camps
	["foragers'camp"] = "Forager's Camp icon",
	["foragers' camp"] = "Forager's Camp icon",
	["forager'scamp"] = "Forager's Camp icon",
	["forager's camp"] = "Forager's Camp icon",
	["harvesters'camp"] = "Harvester Camp icon.png",
	["harvesters' camp"] = "Harvester Camp icon.png",
	["harvester'scamp"] = "Harvester Camp icon.png",
	["harvester's camp"] = "Harvester Camp icon.png",
	["herbalists'camp"] = "Herbalist's_Camp_icon.png",
	["herbalists' camp"] = "Herbalist's_Camp_icon.png",
	["herbalist'scamp"] = "Herbalist's_Camp_icon.png",
	["herbalist's camp"] = "Herbalist's_Camp_icon.png",
	["stonecutters'camp"] = "Stonecutter's Camp icon.png",
	["stonecutters' camp"] = "Stonecutter's Camp icon.png",
	["stonecutter'scamp"] = "Stonecutter's Camp icon.png",
	["stonecutter's camp"] = "Stonecutter's Camp icon.png",
	["woodcutters'camp"] = "Woodcutters Camp icon",
	["woodcutters' camp"] = "Woodcutters Camp icon",
	["woodcutter'scamp"] = "Woodcutters Camp icon",
	["woodcutter's camp"] = "Woodcutters Camp icon",
	["trappers'camp"] = "Trapper's Camp icon.png",
	["trappers' camp"] = "Trapper's Camp icon.png",
	["trapper'scamp"] = "Trapper's Camp icon.png",
	["trapper's camp"] = "Trapper's Camp icon.png",
	-- Food Production
	["farmfield"] = "Farmfield_icon.png",
	["farm field"] = "Farmfield_icon.png",
	["herbgarden"] = "HerbGarden_icon.png",
	["herb garden"] = "HerbGarden_icon.png",
	["plantation"] = "Plantation_icon.png",
	["smallfarm"] = "SmallFarm_icon.png",
	["small farm"] = "SmallFarm_icon.png",
	["bakery"] = "Bakery_icon.png",
	["cellar"] = "Cellar_icon.png",
	["cookhouse"] = "Cookhouse_icon.png",
	["ranch"] = "Ranch_icon.png",
	["smokehouse"] = "Smokehouse_icon.png",
	["grill"] = "Grill_icon.png",
	-- Housing
	["shelter"] = "Shelter icon.png",
	["bigshelter"] = "Big Shelter icon.png",
	["big shelter"] = "Big Shelter icon.png",
	["humanhouse"] = "Human House icon.png",
	["human house"] = "Human House icon.png",
	["beaverhouse"] = "Beaver House icon.png",
	["beaver house"] = "Beaver House icon.png",
	["lizardhouse"] = "Lizard House icon.png",
	["lizard house"] = "Lizard House icon.png",
	["harpyhouse"] = "Harpy House icon.png",
	["harpy house"] = "Harpy House icon.png",
	-- Industry
	["crudeworkstation"] = "Crude_Workstation_icon.png",
	["crude workstation"] = "Crude_Workstation_icon.png",
	["makeshiftpost"] = "Makeshift_Post_icon.png",
	["makeshift post"] = "Makeshift_Post_icon.png",
	["raincollector"] = "Rain_Collector_icon.png",
	["rain collector"] = "Rain_Collector_icon.png",
	["mine"] = "Mine_icon.png",
	["carpenter"] = "Carpenter_icon.png",
	["weaver"] = "Weaver_icon.png",
	["clothier"] = "Clothier_icon.png",
	["brickyard"] = "Brickyard_icon.png",
	["kiln"] = "Kiln_icon.png",
	["rainmill"] = "Rain_Mill_icon.png",
	["rain mill"] = "Rain_Mill_icon.png",
	["provisioner"] = "Provisioner_icon.png",
	["artisan"] = "Artisan_icon.png",
	["brewery"] = "Brewery_icon.png",
	["cooperage"] = "Cooperage_icon.png",
	["druids'hut"] = "Druid_icon.png",
	["druids' hut"] = "Druid_icon.png",
	["druid'shut"] = "Druid_icon.png",
	["druid's hut"] = "Druid_icon.png",
	["leatherworker"] = "Leatherworks_icon.png",
	["lumbermill"] = "Lumbermill_icon.png",
	["lumber mill"] = "Lumbermill_icon.png",
	["press"] = "Press_icon.png",
	["scribe"] = "Scribe_icon.png",
	["smelter"] = "Smelter_icon.png",
	-- City Buildings
	["smallhearth"] = "Temporary_Hearth_icon.png",
	["small hearth"] = "Temporary_Hearth_icon.png",
	["warehouse"] = "Storage_icon.png",
	["tradingpost"] = "Trading_Post_icon.png",
	["trading post"] = "Trading_Post_icon.png",
	["blightpost"] = "Blight_Post_icon.png",
	["blight post"] = "Blight_Post_icon.png",
	["hydrant"] = "Hydrant_icon.png",
	["forsakenaltar"] = "Altar_icon.png",
	["forsaken altar"] = "Altar_icon.png",
	-- Service Buildings
	[string.lower("BathHouse")] = "Bath_House_icon.png",
	["bath house"] = "Bath_House_icon.png",
	["clanhall"] = "Clan_Hall_icon.png",
	["clan hall"] = "Clan_Hall_icon.png",
	["explorers'lodge"] = "Explorers_Lodge_icon.png",
	["explorers' lodge"] = "Explorers_Lodge_icon.png",
	["explorer'slodge"] = "Explorers_Lodge_icon.png",
	["explorer's lodge"] = "Explorers_Lodge_icon.png",
	["guildhouse"] = "Guild_House_icon.png",
	["guild house"] = "Guild_House_icon.png",
	["monastery"] = "Monastery_icon.png",
	["tavern"] = "Tavern_icon.png",
	["temple"] = "Temple_icon.png"
}



-------------------------------------------------------------------------------
-- Main lookup function
-- Accepts the name of an icon, as it appears in the game, and returns the
-- filename associated with that in-game item, resource, building, etc.
-------------------------------------------------------------------------------

function IconFilenames.getIconFilename(strIconName)

	-- Convert the key to lower case for case-insensitive lookups
    local strLowercaseIconName = string.lower(strIconName)
	
	-- Get it from the big table below and return it.
    return tableStrStrFilenames[strLowercaseIconName]
end



-------------------------------------------------------------------------------
-- Return when required into another Module.
-------------------------------------------------------------------------------
return IconFilenames