Home › Lua API › PlayerResources

Available out of the box. Usable from Lua in the unmodified game.

PlayerResources

18 methods. Symbol/current columns are function addresses (RVA) of the native wrapper.

Community reference for this object: PlayerResources (Sukrit Tan, external).

Signatures are recovered from the game code. ⚠ = partly understood (arguments may be missing or approximate). ? after a name = optional argument. Types: integer/number are Lua numbers, enum-typed arguments show the C++ type in brackets. Two signatures mean the method is registered separately for the UI and the gameplay state and each wrapper was decoded on its own. "same code as" in the Symbol column means the compiler merged identical functions: those methods share one wrapper and cannot be told apart by address.

Method Signature Where Reference Symbol Current
ChangeResourceAmount PlayerResources:ChangeResourceAmount(arg1?: number, arg2?: number) (or nothing)
touches (inferred from the code): reads Player::Resources::m_aResourceOwnership, Player::Resources::m_aiReservedResources, Player::Resources::m_aiNoCapResources, Player::Resources::m_iExtraAmenitiesPerOwnedLuxuryResource, Player::Resources::m_iExtraAmenitiesPerOwnedBonusResource …
gameplay yes ↗ 0x7459d0 0x746270
GetBonusResourcePerTurn PlayerResources:GetBonusResourcePerTurn(arg1: string/number[ResourceTypes]) → number
args: arg1 — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x98
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741ce0 0x742620
GetCityResourceAllocations PlayerResources:GetCityResourceAllocations(arg1?: number) → table{Resource: number, AllocationAmount: number}[]
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x48
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b36c0 0x6b3c10
GetExportedResourceAmount PlayerResources:GetExportedResourceAmount(arg1: string/number[ResourceTypes]) → number
args: arg1 — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x20
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b38d0 0x6b3e20
GetPowerResourceDemandPerTurn PlayerResources:GetPowerResourceDemandPerTurn(resource: string/number[ResourceTypes]) → number (FixedPoint)
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0xc8
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741d50 0x742690
GetReservedResourceAmount PlayerResources:GetReservedResourceAmount(eResource: string/number[ResourceTypes]) → number
args: eResource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x50
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741dc0 0x742700
GetResourceAccumulationPerTurn PlayerResources:GetResourceAccumulationPerTurn(resource: string/number[ResourceTypes]) → number (FixedPoint)
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x68
✓ exists at runtime (not called)
returns: A turn number (the scripts name the result turn). (inferred)
ui-cache yes ↗ 0x741e30 0x742770
GetResourceAllocationCities PlayerResources:GetResourceAllocationCities(arg1: string/number[ResourceTypes]) → table{CityID: number, AllocationAmount: number}[]
args: arg1 — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index). The scripts pass its index
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x48
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b3940 0x6b3e90
GetResourceAmount PlayerResources:GetResourceAmount(resource: string/number[ResourceTypes]) → number
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x8
✓ exists at runtime (not called)
returns: A count or amount (the scripts name the result count / num / amount). (inferred)
ui-cache, gameplay yes ↗ 0x6b3b40 0x6b4090
GetResourceImportPerTurn PlayerResources:GetResourceImportPerTurn(arg1: string/number[ResourceTypes]) → number
args: arg1 — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x80
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741ea0 0x7427e0
GetResourceStockpileCap PlayerResources:GetResourceStockpileCap(eResource: string/number[ResourceTypes]) → number
args: eResource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0xe0
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741f10 0x742850
GetResourcesExtractedByCity PlayerResources:GetResourcesExtractedByCity(arg1?: number, arg2?: integer) → table{ResourceType: number, Amount: number, PlotIndex: number, IsPillaged: boolean, AreAnyPillaged: boolean}[] (or nothing)
args: arg1 — Id of a city (named cityID in the scripts). (inferred); arg2 — A constant from the Lua table ResultFormat.
touches (inferred from the code): reads Cache::Player::Instance::m_kConstant+0x8
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b3bb0 0x6b4100
GetUnitResourceDemandPerTurn PlayerResources:GetUnitResourceDemandPerTurn(resource: string/number[ResourceTypes]) → number (FixedPoint)
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0xb0
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741f80 0x7428c0
HasExportedResource PlayerResources:HasExportedResource(arg1: string/number[ResourceTypes]) → boolean
args: arg1 — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x20
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b3f00 0x6b4450
HasResource UI state: PlayerResources:HasResource(resource: string/number[ResourceTypes]) → boolean
gameplay state: PlayerResources:HasResource(resource: string/number[ResourceTypes]) → boolean
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Resources::m_kValues+0x8
✓ exists at runtime (not called)
ui-cache, gameplay yes ↗ 0x6b3f70 0x6b44c0
IsResourceBanned PlayerResources:IsResourceBanned(eResource: string/number[ResourceTypes]) → boolean
args: eResource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Instance::m_kConstant+0x8
✓ exists at runtime (not called)
ui-cache yes ↗ 0x741ff0 0x742930
IsResourceExtractableAt PlayerResources:IsResourceExtractableAt(plot: MapPlot) → boolean
args: plot — Plot index (named plotIndex / plotID in the scripts). (inferred)
touches (inferred from the code): reads Cache::Player::Instance::m_kConstant+0x8
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b3fe0 0x6b4530
IsResourceVisible PlayerResources:IsResourceVisible(resource: integer[ResourceTypes]) → boolean
args: resource — Index of a row of the Resources table (the value of GameInfo.Resources[...].Index).
touches (inferred from the code): reads Cache::Player::Instance::m_kConstant+0x8
✓ exists at runtime (not called)
ui-cache yes ↗ 0x6b4050 0x6b45a0