Module:ProjectLister: Difference between revisions

From Terra Invicta Official Wiki
Redwah (talk | contribs)
No edit summary
Redwah (talk | contribs)
No edit summary
Line 14: Line 14:
local TechNames = mw.loadData('Module:ENReader/Tech')
local TechNames = mw.loadData('Module:ENReader/Tech')
local ObjectiveNames = mw.loadData('Module:ENReader/Objective')
local ObjectiveNames = mw.loadData('Module:ENReader/Objective')
local OrgNames = mw.loadData('Module:ENReader/Org')


local ProjectPrereqs = mw.loadData('Module:ProjectLister/Prereqs')
local ProjectPrereqs = mw.loadData('Module:ProjectLister/Prereqs')
local ProjectCosts = mw.loadData('Module:ProjectLister/Costs')
local ProjectCosts = mw.loadData('Module:ProjectLister/Costs')
local ProjectProjects = mw.loadData('Module:ProjectLister/Projects')
local ProjectProjects = mw.loadData('Module:ProjectLister/Projects')
 
local ProjectUnlocks = mw.loadData('Module:ProjectLister/UnlocksFormatted')
local BatteryNames = mw.loadData('Module:ENReader/Battery')
local DriveNames = mw.loadData('Module:ENReader/Drive')
-- local EffectNames = mw.loadData('Module:ENReader/Effect')
local GunNames = mw.loadData('Module:ENReader/Gun')
local HabModuleNames = mw.loadData('Module:ENReader/HabModule')
local HeatSinkNames = mw.loadData('Module:ENReader/HeatSink')
local LaserWeaponNames = mw.loadData('Module:ENReader/LaserWeapon')
local MagneticGunNames = mw.loadData('Module:ENReader/MagneticGun')
local MissileNames = mw.loadData('Module:ENReader/Missile')
local NationNames = mw.loadData('Module:ENReader/Nation')
local OrgNames = mw.loadData('Module:ENReader/Org')
local ParticleWeaponNames = mw.loadData('Module:ENReader/ParticleWeapon')
local PlasmaWeaponNames = mw.loadData('Module:ENReader/PlasmaWeapon')
local PowerPlantNames = mw.loadData('Module:ENReader/PowerPlant')
local RadiatorNames = mw.loadData('Module:ENReader/Radiator')
local RegionNames = mw.loadData('Module:ENReader/Region')
local ShipArmorNames = mw.loadData('Module:ENReader/ShipArmor')
local ShipHullNames = mw.loadData('Module:ENReader/ShipHull')
-- local TraitNames = mw.loadData('Module:ENReader/Trait')
local UtilityModuleNames = mw.loadData('Module:ENReader/UtilityModule')
 
local BatteryProjects = mw.loadData('Module:BatteryLister/Projects')
local ClaimProjects = mw.loadData('Module:ClaimLister/Projects')
local DriveProjects = mw.loadData('Module:DriveLister/Projects')
local GunProjects = mw.loadData('Module:GunLister/Projects')
local HabModuleProjects = mw.loadData('Module:HabModuleLister/Projects')
local HeatSinkProjects = mw.loadData('Module:HeatSinkLister/Projects')
local LaserWeaponProjects = mw.loadData('Module:LaserWeaponLister/Projects')
local MagneticGunProjects = mw.loadData('Module:MagneticGunLister/Projects')
local MissileProjects = mw.loadData('Module:MissileLister/Projects')
local ParticleWeaponProjects = mw.loadData('Module:ParticleWeaponLister/Projects')
local PlasmaWeaponProjects = mw.loadData('Module:PlasmaWeaponLister/Projects')
local PowerPlantProjects = mw.loadData('Module:PowerPlantLister/Projects')
local RadiatorProjects = mw.loadData('Module:RadiatorLister/Projects')
local ShipArmorProjects = mw.loadData('Module:ShipArmorLister/Projects')
local ShipHullProjects = mw.loadData('Module:ShipHullLister/Projects')
local UtilityModuleProjects = mw.loadData('Module:UtilityModuleLister/Projects')
--endregion
--endregion


Line 524: Line 488:
end
end
local unlockItems = BatteryProjects[ProjectID]
local punlocks = projectUnlocks[ProjectID]
local uitems = {}
if punlocks and punlocks ~= {} then
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks:'
returnString = returnString .. '\n! Unlocks [[Spaceships#Battery|Batteries]]:'
returnString = returnString .. '\n| colspan=3 | ' .. concat(punlocks, ' • ')
for unlock, _ in pairs(unlockItems) do
insert(uitems, BatteryNames['TIBatteryTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = ClaimProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Foreign_Relations#Claims|Claim(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, '[[' .. BilateralData[unlock]['nation1'] .. '|' .. NationNames['TINationTemplate.displayName.' .. BilateralData[unlock]['nation1']] .. ']] gains a claim on ' .. RegionNames['TIRegionTemplate.displayName.' .. BilateralData[unlock]['region1']])
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = DriveProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Drive|Drive(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, DriveNames['TIDriveTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = GunProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Guns|Naval Gun(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, GunNames['TIGunTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = HabModuleProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Habs|Hab Module(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, HabModuleNames['TIGunTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = HeatSinkProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Heat Sink|Heat Sink(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, HeatSinkNames['TIHeatSinkTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = LaserWeaponProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Lasers|Laser(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, LaserWeaponNames['TILaserWeaponTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
 
unlockItems = MagneticGunProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Magnetic Weapons|Magnetic Gun(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, MagneticGunNames['TIMagneticGunTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = MissileProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Missiles|Missile(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, MissileNames['TIMissileTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
returnString = returnString .. '\n|-'
end
end
unlockItems = ParticleWeaponProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Particle Weapons|Particle Weapon(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, ParticleWeaponNames['TIParticleWeaponTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = PlasmaWeaponProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Plasma Weapons|Plasma Weapon(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, PlasmaWeaponNames['TIPlasmaWeaponTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = PowerPlantProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Power Plant|Power Plant(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, PowerPlantNames['TIPowerPlantTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = RadiatorProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Radiator|Radiator(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, RadiatorNames['TIRadiatorTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = ShipArmorProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Armor|Ship Armor(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, ShipArmorNames['TIShipArmorTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = ShipHullProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Hull|Ship Hull(s)]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, ShipHullNames['TIShipHullTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
unlockItems = UtilityModuleProjects[ProjectID]
uitems = {}
if unlockItems and unlockItems ~= {} then
returnString = returnString .. '\n! Unlocks [[Spaceships#Utility Modules|Utility Modules]]:'
for unlock, _ in pairs(unlockItems) do
insert(uitems, UtilityModuleNames['TIUtilityModuleTemplate.displayName.' .. unlock] or unlock)
end
returnString = returnString .. '\n| colspan=3 | ' .. concat(uitems, ' • ')
returnString = returnString .. '\n|-'
end
returnString = returnString .. '\n! colspan=4 | Notes'
returnString = returnString .. '\n! colspan=4 | Notes'

Revision as of 02:27, 27 September 2025

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

---
---Reads the Project data files and presents them in readable formats, with additional calculated statistics.
---
---@module ProjectLister
local ProjectLister = {}

--region Dependencies
local IconModule = require('Module:Icon')
local ProjectData = mw.loadData('Module:CSVReader/Project')
local TechData = mw.loadData('Module:CSVReader/Tech')
local BilateralData = mw.loadData('Module:CSVReader/Bilateral')

local ProjectNames = mw.loadData('Module:ENReader/Project')
local TechNames = mw.loadData('Module:ENReader/Tech')
local ObjectiveNames = mw.loadData('Module:ENReader/Objective')
local OrgNames = mw.loadData('Module:ENReader/Org')

local ProjectPrereqs = mw.loadData('Module:ProjectLister/Prereqs')
local ProjectCosts = mw.loadData('Module:ProjectLister/Costs')
local ProjectProjects = mw.loadData('Module:ProjectLister/Projects')
local ProjectUnlocks = mw.loadData('Module:ProjectLister/UnlocksFormatted')
--endregion

--region Private constants
local insert = table.insert
local concat = table.concat
local floor = math.floor
local sfind = string.find
local ssub = string.sub
local ScienceCategories = {
	Energy = 'energy',
	InformationScience='information',
	LifeScience='life',
	Materials='material',
	MilitaryScience='military',
	SocialScience='social',
	SpaceScience='space',
	Xenology='xenology'
}
local CouncilIcons = {
	DestroyCouncil='destroy',
	ResistCouncil='resist',
	EscapeCouncil='escape',
	ExploitCouncil='exploit',
	CooperateCouncil='cooperate',
	AppeaseCouncil='appease',
	SubmitCouncil='submit',
	AlienCouncil='alien'
}
--endregion



--region Private member variables
--none
--endregion

--region Private methods
local round = function(num, decimals)
    local mult = 10^(decimals or 0)
    return floor(num * mult + 0.5) / mult
end

-- Replaces ONE instance of the stringToReplace with replacementString in the fullString
local sreplace = function(fullString, stringToReplace, replacementString)
	local si, ei = sfind(fullString, stringToReplace, 1, true)
	if not si then
		return fullString
	end
	local prefix = ssub(fullString,1,si - 1)
	local suffix = ssub(fullString,ei+1)
	return prefix .. replacementString .. suffix
end
--endregion

--region Public methods
-- Might remove this detailed view. It's too cluttered.
function ProjectLister.ListDetailedProjects()
	return ProjectLister.ListProjects(true)
end

function ProjectLister.ListBasicProjects()
	return ProjectLister.ListProjects(false)
end

---@param detailed boolean whether to show the detailed or basic version.
---@return wiki table of Projects
function ProjectLister.ListProjects(detailed)
	local returnString = '{| class="wikitable sortable mw-collapsible" style="text-align: center;"'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! Project'
	returnString = returnString .. '\n! Type'
	returnString = returnString .. '\n! Research<br>Cost'
	returnString = returnString .. '\n! Full<br>Cost'
	if detailed then
		returnString = returnString .. '\n! Unlockable<br>Projects'
		returnString = returnString .. '\n! Full<br>Prereqs'
	else
		returnString = returnString .. '\n! Direct<br>Prereqs'
	end
	returnString = returnString .. '\n! Alt<br>Prereq'
	returnString = returnString .. '\n|-'
	
	for rowID, row in pairs(ProjectData) do
		if (not row['disable'] or row['disable'] ~= 'true') and row['factionPrereq/0'] ~= 'AlienCouncil' then
			returnString = returnString .. '\n| [[' .. rowID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. rowID] or rowID) .. ']]'
			returnString = returnString .. '\n| ' .. IconModule.Icon({args={ScienceCategories[row['techCategory']]}})
			returnString = returnString .. '\n| ' .. row['researchCost']
			returnString = returnString .. '\n| ' .. tostring(ProjectCosts[rowID]['total'])
			
			if detailed then
				if ProjectProjects[rowID] then
					local projects = {}
					for projectID, _ in pairs(ProjectProjects[rowID]) do
						local projectChance = ProjectData[projectID]['factionAvailableChance']
						insert(projects, '(' .. projectChance .. '%)[[' .. projectID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. projectID] or projectID) .. ']]')
					end
					returnString = returnString .. '\n| ' .. concat(projects, '<br>')
				else
					returnString = returnString .. '\n| '
				end
			end
			
			local prereqs = {}
			if detailed then
				for prereqID, _ in pairs(ProjectPrereqs[rowID]) do
					if string.sub(prereqID,1,7) == 'Project' then
						insert(prereqs, '[[' .. prereqID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. prereqID] or prereqID) .. ']]')
					else
						insert(prereqs, '[[' .. prereqID .. '|' .. TechNames['TITechTemplate.displayName.' .. prereqID] .. ']]')
					end
				end
			else
				for i = 0, 4 do
					local prereq = row['prereqs/' .. i]
					if prereq and prereq ~= '' and prereq ~= 0 then
						if string.sub(prereq,1,7) == 'Project' then
							insert(prereqs, '[[' .. prereq .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. prereq] or prereq) .. ']]')
						else
							insert(prereqs, '[[' .. prereq .. '|' .. TechNames['TITechTemplate.displayName.' .. prereq] .. ']]')
						end
					end
				end
			end
			returnString = returnString .. '\n| ' .. concat(prereqs, '<br>')
			
			local prereq0 = row['prereqs/0']
			local altprereq = row['altPrereq0']
			if not altprereq or altprereq == '' then
				returnString = returnString .. '\n| '
			else
				if string.sub(prereq0,1,7) == 'Project' then
					prereq0 = '[[' .. prereq0 .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. prereq0] or prereq0) .. ']]'
				else
					prereq0 = '[[' .. prereq0 .. '|' .. TechNames['TITechTemplate.displayName.' .. prereq0] .. ']]'
				end
				if string.sub(altprereq,1,7) == 'Project' then
					altprereq = '[[' .. altprereq .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. altprereq] or altprereq) .. ']]'
				else
					altprereq = '[[' .. altprereq .. '|' .. TechNames['TITechTemplate.displayName.' .. altprereq] .. ']]'
				end
				returnString = returnString .. '\n| Replace ' .. prereq0 .. '<br>With ' .. altprereq
			end
			
			returnString = returnString .. '\n|-'
		end
	end
	returnString = returnString .. '\n|}'
	
	return returnString
end

function ProjectLister.ListProjectChances()
	local returnString = '{| class="wikitable sortable mw-collapsible" style="text-align: center;"'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! rowspan=2|Project'
	returnString = returnString .. '\n! rowspan=2|Base Unlock Chance'
	returnString = returnString .. '\n! colspan=3|Available Chance'
	returnString = returnString .. '\n! rowspan=2|Available To:'
	returnString = returnString .. '\n! rowspan=2|Guaranteed Unlock for:'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! Initial'
	returnString = returnString .. '\n! Monthly Increase'
	returnString = returnString .. '\n! Maximum'
	returnString = returnString .. '\n|-'
	
	for rowID, row in pairs(ProjectData) do
		if (not row['disable'] or row['disable'] ~= 'true') and row['factionPrereq/0'] ~= 'AlienCouncil' then
			returnString = returnString .. '\n| [[' .. rowID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. rowID] or rowID) .. ']]'
			
			returnString = returnString .. '\n| ' .. row['factionAvailableChance'] .. '%'
			returnString = returnString .. '\n| ' .. row['initialUnlockChance'] .. '%'
			returnString = returnString .. '\n| ' .. row['deltaUnlockChance'] .. '%'
			returnString = returnString .. '\n| ' .. row['maxUnlockChance'] .. '%'
			
			if not row['factionPrereq/0'] or row['factionPrereq/0'] == '' then
				returnString = returnString .. '\n| All'
			else
				local councils = {}
				for i = 0, 5 do
					local freq = row['factionPrereq/' .. i]
					if freq and freq ~= '' and freq ~= 0 then
						insert(councils, IconModule.Icon({args={CouncilIcons[freq]}}))
					end
				end
				returnString = returnString .. '\n| ' .. concat(councils, '')
			end
			
			local falways = row['factionAlways']
			if not falways or falways == '' then
				returnString = returnString .. '\n| '
			elseif falways == 'Random' then
				returnString = returnString .. '\n| Random' 
			else
				returnString = returnString .. '\n| ' .. IconModule.Icon({args={CouncilIcons[falways]}})
			end
			
			returnString = returnString .. '\n|-'
		end
	end
	returnString = returnString .. '\n|}'
	
	return returnString
end

---@param frame a set of arguments that includes:
----frame.args[1] the dataName of the project
----frame.args['notes'] any additional notes the output table should contain
---@return wiki table of details for that project
function ProjectLister.SingleProjectTable(frame)
	local ProjectID = frame.args[1]
    local ProjectNotes = frame.args['notes'] or ''
    
	local returnString = '{| class="wikitable" style="width: 100%;text-align:center;"'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! colspan=4 | <big>' .. (ProjectNames['TIProjectTemplate.displayName.' .. ProjectID] or ProjectID) .. '</big><br>' .. IconModule.Icon({args={ScienceCategories[ProjectData[ProjectID]['techCategory']], size='120px'}})
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! colspan=4 | ' .. IconModule.Icon({args={'research'}}) .. 'Research Cost: ' .. ProjectData[ProjectID]['researchCost']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! colspan=4 | Summary'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n| colspan=4 | ' .. (ProjectNames['TIProjectTemplate.summary.' .. ProjectID] or 'Error: Missing Summary')
	returnString = returnString .. '\n|-'
	if ProjectNames['TIProjectTemplate.description.' .. ProjectID] then
		returnString = returnString .. '\n! colspan=4 | Description'
		returnString = returnString .. '\n|-'
		returnString = returnString .. '\n| colspan=4 | ' .. ProjectNames['TIProjectTemplate.description.' .. ProjectID]
		returnString = returnString .. '\n|-'
	end
	
	if ProjectData[ProjectID]['repeatable'] and ProjectData[ProjectID]['repeatable'] == 'true' then
		returnString = returnString .. '\n! <big>Repeatable Project</big>'
		returnString = returnString .. '\n| colspan=3 | Can be researched an unlimited number of times, but research cost is multiplied by (1 + number of times researched).'
		returnString = returnString .. '\n|-'
	end
	
	if ProjectData[ProjectID]['oneTimeGlobally'] and ProjectData[ProjectID]['oneTimeGlobally'] == 'true' then
		returnString = returnString .. '\n! <big>Global Project</big>'
		returnString = returnString .. '\n| colspan=3 | Can be researched by only one faction. As soon as a faction researches this project, it is removed from all factions. Global projects usually give a global bonus (such as nation claims) that all factions can potentially benefit from, but may also have smaller bonuses that are only given to the faction that researches the project.'
		returnString = returnString .. '\n|-'
	end
	
	returnString = returnString .. '\n! rowspan=2| Base Unlock Chance'
	returnString = returnString .. '\n! colspan=3| Monthly Available Chance'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! Initial'
	returnString = returnString .. '\n! Monthly Increase'
	returnString = returnString .. '\n! Maximum'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n| style="width:25%;" | ' .. ProjectData[ProjectID]['factionAvailableChance'] .. '%'
	returnString = returnString .. '\n| style="width:25%;" | ' .. ProjectData[ProjectID]['initialUnlockChance'] .. '%'
	returnString = returnString .. '\n| style="width:25%;" | ' .. ProjectData[ProjectID]['deltaUnlockChance'] .. '%'
	returnString = returnString .. '\n| style="width:25%;" | ' .. ProjectData[ProjectID]['maxUnlockChance'] .. '%'
	returnString = returnString .. '\n|-'
	
	returnString = returnString .. '\n! Available to Faction(s): '
	if not ProjectData[ProjectID]['factionPrereq/0'] or ProjectData[ProjectID]['factionPrereq/0'] == '' then
		returnString = returnString .. '\n| colspan=3 | All'
	else
		local councils = {}
		for i = 0, 5 do
			local freq = ProjectData[ProjectID]['factionPrereq/' .. i]
			if freq and freq ~= '' and freq ~= 0 then
				insert(councils, IconModule.Icon({args={CouncilIcons[freq]}}))
			end
		end
		returnString = returnString .. '\n| colspan=3 | ' .. concat(councils, '')
	end
	returnString = returnString .. '\n|-'
	
	returnString = returnString .. '\n! Guaranteed for Faction: '	
	local falways = ProjectData[ProjectID]['factionAlways']
	if not falways or falways == '' then
		returnString = returnString .. '\n| colspan=3 | '
	elseif falways == 'Random' then
		returnString = returnString .. '\n| colspan=3 | Random' 
	else
		returnString = returnString .. '\n| colspan=3 | ' .. IconModule.Icon({args={CouncilIcons[falways]}})
	end
	returnString = returnString .. '\n|-'	
	
	returnString = returnString .. '\n| colspan=4 | \n{| class="wikitable sortable mw-collapsible" style="width: 100%;text-align:center;"'
	returnString = returnString .. '\n|+ Full List of Prerequisites.'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! Name'
	returnString = returnString .. '\n! Type'
	returnString = returnString .. '\n! Cost'
	returnString = returnString .. '\n|-'
	for prereqID, _ in pairs(ProjectPrereqs[ProjectID]) do
		if string.sub(prereqID,1,7) == 'Project' then
			local prereqIDChance = ProjectData[prereqID]['factionAvailableChance']
			returnString = returnString .. '\n| (' .. prereqIDChance .. '%) [[' .. prereqID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. prereqID] or prereqID) .. ']]'
			returnString = returnString .. '\n| ' .. IconModule.Icon({args={ScienceCategories[ProjectData[prereqID]['techCategory']]}}) .. IconModule.Icon({args={'projects'}})
			returnString = returnString .. '\n| ' .. ProjectData[prereqID]['researchCost']
			returnString = returnString .. '\n|-'
		else
			returnString = returnString .. '\n| [[' .. prereqID .. '|' .. (TechNames['TITechTemplate.displayName.' .. prereqID] or prereqID) .. ']]'
			returnString = returnString .. '\n| ' .. IconModule.Icon({args={ScienceCategories[TechData[prereqID]['techCategory']]}})
			returnString = returnString .. '\n| ' .. TechData[prereqID]['researchCost']
			returnString = returnString .. '\n|-'
		end
	end
	returnString = returnString .. '\n|}'
	returnString = returnString .. '\n|-'
	
	local prereq0 = ProjectData[ProjectID]['prereqs/0']
	local altprereq = ProjectData[ProjectID]['altPrereq0']
	if altprereq and altprereq ~= '' then
		if string.sub(prereq0,1,7) == 'Project' then
			prereq0 = '[[' .. prereq0 .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. prereq0] or prereq0) .. ']]'
		else
			prereq0 = '[[' .. prereq0 .. '|' .. TechNames['TITechTemplate.displayName.' .. prereq0] .. ']]'
		end
		if string.sub(altprereq,1,7) == 'Project' then
			altprereq = '[[' .. altprereq .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. altprereq] or altprereq) .. ']]'
		else
			altprereq = '[[' .. altprereq .. '|' .. TechNames['TITechTemplate.displayName.' .. altprereq] .. ']]'
		end
		returnString = returnString .. '\n! Alt Prereq: ||  colspan=3 | Replace ' .. prereq0 .. '<br>With ' .. altprereq
		returnString = returnString .. '\n|-'
	end	
	
	local requiredObjectiveName = ProjectData[ProjectID]['requiredObjectiveName']
	local altRequiredObjectiveName = ProjectData[ProjectID]['altRequiredObjectiveName']
	if requiredObjectiveName and requiredObjectiveName ~= '' then
		returnString = returnString .. '\n! colspan=4 | Required Objective (only one needed)'
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'destroy'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.DestroyCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.DestroyCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'resist'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.ResistCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.ResistCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'escape'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.EscapeCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.EscapeCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'exploit'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.ExploitCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.ExploitCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'cooperate'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.CooperateCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.CooperateCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'appease'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.AppeaseCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.AppeaseCouncil']
		end
		returnString = returnString .. '\n|-'
		
		returnString = returnString .. '\n! ' .. IconModule.Icon({args={'submit'}})
		returnString = returnString .. '\n| colspan=3 | ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. requiredObjectiveName .. '.SubmitCouncil']
		if altRequiredObjectiveName and altRequiredObjectiveName ~= '' then
			returnString = returnString .. ' • ' .. ObjectiveNames['TIObjectiveTemplate.displayName.' .. altRequiredObjectiveName .. '.SubmitCouncil']
		end
		returnString = returnString .. '\n|-'
	end
	
	returnString = returnString .. '\n! colspan=4 | Total ' .. IconModule.Icon({args={'research'}}) .. 'Research Cost (including itself)<br>(Does not consider Alt Prereqs)' 
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. 'Category'
	returnString = returnString .. '\n!' .. 'From Projects'
	returnString = returnString .. '\n!' .. 'From Techs'
	returnString = returnString .. '\n!' .. 'Category Subtotal'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'energy'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['energyProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['energyTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['energyTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'information'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['informationProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['informationTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['informationTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'life'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['lifeProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['lifeTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['lifeTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'material'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['materialProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['materialTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['materialTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'military'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['militaryProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['militaryTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['militaryTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'social'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['socialProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['socialTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['socialTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'space'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['spaceProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['spaceTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['spaceTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n!' .. IconModule.Icon({args={'xenology'}})
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['xenologyProject']
	returnString = returnString .. '\n|' 
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['xenologyTotal']
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! Total'
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['totalProject']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['totalTech']
	returnString = returnString .. '\n|' .. ProjectCosts[ProjectID]['total']
	returnString = returnString .. '\n|-'
	
	if ProjectProjects[ProjectID] then
		returnString = returnString .. '\n! colspan=4 | Direct Prerequisite For Projects:'
		returnString = returnString .. '\n|-'
		local projectprojects = {}
		for projectprojectID, _ in pairs(ProjectProjects[ProjectID]) do
			insert(projectprojects, '[[' .. projectprojectID .. '|' .. (ProjectNames['TIProjectTemplate.displayName.' .. projectprojectID] or projectprojectID) .. ']]')
		end
		returnString = returnString .. '\n| colspan=4 | ' .. concat(projectprojects, ' • ')
		returnString = returnString .. '\n|-'
	end
	
	returnString = returnString .. '\n! colspan=4| Effects'
	returnString = returnString .. '\n|-'
		
	if ProjectData[ProjectID]['effects/0'] and ProjectData[ProjectID]['effects/0'] ~= '' and ProjectData[ProjectID]['effects/0'] ~= 0 then
		for i = 0, 2 do
			local peffect = ProjectData[ProjectID]['effects/' .. i]
			if peffect and peffect ~= '' and peffect ~= 0 then
				returnString = returnString .. '\n| colspan=4| ' .. peffect
				returnString = returnString .. '\n|-'
			end
		end
	end
	
	local projectOrg = ProjectData[ProjectID]['orgGranted']
	if projectOrg and projectOrg ~= '' and projectOrg ~= 0 then
		returnString = returnString .. '\n! Creates [[Orgs|Org]]:'
		returnString = returnString .. '\n| colspan=3 | ' .. (OrgNames['TIOrgTemplate.displayName.' .. projectOrg] or projectOrg)
		returnString = returnString .. '\n|-'
	end
	
	local projectResourceType = ProjectData[ProjectID]['resourcesGranted/0/resource']
	if projectResourceType and projectResourceType ~= '' and projectResourceType ~= 0 then
		returnString = returnString .. '\n! Gives [[Resources|Resource]]:'
		returnString = returnString .. '\n| colspan=3 | ' .. ProjectData[ProjectID]['resourcesGranted/0/value'] .. ' ' .. projectResourceType
		returnString = returnString .. '\n|-'
	end
	
	local punlocks = projectUnlocks[ProjectID]
	if punlocks and punlocks ~= {} then
		returnString = returnString .. '\n! Unlocks:'
		returnString = returnString .. '\n| colspan=3 | ' .. concat(punlocks, ' • ')
		returnString = returnString .. '\n|-'
	end
	
	returnString = returnString .. '\n! colspan=4 | Notes'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n| colspan=4 | ' .. ProjectNotes
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! colspan=4 | Data Sources'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n| colspan=4 | [[TIProjectTemplate_CSV]] • [[TIProjectTemplate_EN]] • [[TITechTemplate_CSV]] • [[TITechTemplate_EN]] • [[TIBatteryTemplate_CSV]] • [[TIBatteryTemplate_EN]] • [[TIBilateralTemplate_CSV]] • [[TIDriveTemplate_CSV]] • [[TIDriveTemplate_EN]] • [[TIGunTemplate_CSV]] • [[TIGunTemplate_EN]] • [[TIHabModuleTemplate_CSV]] • [[TIHabModuleTemplate_EN]] • [[TIHeatSinkTemplate_CSV]] • [[TIHeatSinkTemplate_EN]] • [[TILaserWeaponTemplate_CSV]] • [[TILaserWeaponTemplate_EN]] • [[TIMagneticGunTemplate_CSV]] • [[TIMagneticGunTemplate_EN]] • [[TIMissileTemplate_CSV]] • [[TIMissileTemplate_EN]] • [[TINationTemplate_EN]] • [[TIOrgTemplate_CSV]] • [[TIOrgTemplate_EN]] • [[TIParticleWeaponTemplate_CSV]] • [[TIParticleWeaponTemplate_EN]] • [[TIPlasmaWeaponTemplate_CSV]] • [[TIPlasmaWeaponTemplate_EN]] • [[TIPowerPlantTemplate_CSV]] • [[TIPowerPlantTemplate_EN]] • [[TIRadiatorTemplate_CSV]] • [[TIRadiatorTemplate_EN]] • [[TIRegionTemplate_EN]] • [[TIShipArmorTemplate_CSV]] • [[TIShipArmorTemplate_EN]] • [[TIShipHullTemplate_CSV]] • [[TIShipHullTemplate_EN]] • [[TIUtilityModuleTemplate_CSV]] • [[TIUtilityModuleTemplate_EN]]'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n! colspan=4 | Related Pages'
	returnString = returnString .. '\n|-'
	returnString = returnString .. '\n| colspan=4 | [[Tech List]] • [[Project List]] • [[Technology]]'
	returnString = returnString .. '\n|-'
	
	returnString = returnString .. '\n|}'

	return returnString
end

--endregion

return ProjectLister