Module:ServicesData

From Against the Storm Official Wiki

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

---@module ServicesData
local ServicesData = {}



--region Dependencies
local InstitutionsData = require("Module:InstitutionsData")
--endregion



--region Public methods

---@public
---Gets the icon filename associated with the specified service.
---
---@param name string service
---@return string icon filename
function ServicesData.getIcon(name)
    return "Icon_Need_" .. name .. ".png"
end

---@public
---Gets the ID for the specified service
---
---@param name string service
---@return string ID
function ServicesData.getID(name)
    --Yep, IDs are just names right now.
    return name
end

function ServicesData.getServiceGoodID(name)

    local recipeList = InstitutionsData:getIDsAndRecipesWhereProductID(ServicesData.getID(name))
    if #recipeList > 0 then
        --Just need one.
        local recipe = recipeList[1]
        --Just the first slot, first option.
        return InstitutionsData:getRecipeIngredientOptionIDAt(recipe, 1, 1)
    else
        return nil
    end
end

--endregion

return ServicesData