Module:GoodsData/doc

Overview
Module for compiling goods (or resources as some call them) information from wiki data sources. Restructures the flat data tables that are produced from CsvUtils to make them more conducive to Lua methods that need to display the information.

Usage
The standard way of using this module is a call like the following:

iconFilename = GoodsData.getGoodIcon(goodName)

This will return a string corresponding to the filename of the good, including the .png extension. It is preferable to call the getter methods with the name of the good rather than retrieving the entire record for the good, so that your code stays protected from any variations in this module. The getter methods are all called with the plain-language name of the good, as spelled in the game.

longDescription = GoodsData.getGoodDescription(goodName)

inventoryCategory = GoodsData.getGoodCategory(goodName)

isEatable = GoodsData.isGoodEatable(goodName)

isBurnable = GoodsData.isGoodBurnable(goodName)

burnSeconds = GoodsData.getGoodBurnTime(goodName)

amberSellValue, amberBuyValue = GoodsData.getGoodValue(goodName)

iconFilename = GoodsData.getGoodIcon(goodName)

As a last resort, or if you need to transform the data structure, you can call the method. This returns a whole record from the data table corresponding to the requested display name.

The data table for goods has the following structure:

goodsTable = { ["good1_ID"] = { ["id"] = "good1_ID", ["displayName"] = "Plain Language Name", ["description"] = "A long string with some HTML entities too.", ["category"] = "Inventory category", ["eatable"] = true or false if food ["canBeBurned"] = true or false if fuel and sacrifice ["burningTime"] = 99, number of seconds ["tradingSellValue"] = 99.99, in amber ["tradingBuyValue"] = 99.99, in amber ["iconName"] = "Icon_Resource_filename.png" including PNG extension },	["good2_ID"] = { ...	},	["good3_ID"] = { ...	},	... }