Module:ClaimLister/Projects

From Terra Invicta Official Wiki

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

---
---Reads the Bilateral data files and computes a table of Project to Claim unlocks

--region Dependencies
local BilateralData = mw.loadData('Module:CSVReader/Bilateral')
--endregion

--region Private constants
--endregion

--region Private member variables
local projectTable = {}
--endregion

--region Private methods

-- Present Claims for now, not Future Claims
function getProjectTable()
	for rowID, row in pairs(BilateralData) do
		if row['relationType'] == 'Claim' and not string.find( row['dataName'], '2026', 1, true) and not string.find( row['dataName'], '2070', 1, true) then
			local reqProject = row['projectUnlockName']
			if reqProject and reqProject ~= '' and reqProject ~= 0 then
				if not projectTable[reqProject] then
					projectTable[reqProject] = {}
				end
				projectTable[reqProject][rowID] = true
			end
		end
	end
	return projectTable
end

--endregion

--region Public methods
--endregion

return getProjectTable()