Home › Dev CE (experimental) › PlayerStats
Experimental: needs Dev CE (
fork of the Community Extension, release zip and source). A GameCore that adds these Lua methods by calling engine functions directly. Not part of the upstream Community Extension, single-player testing only. Descriptions on these pages were written by an AI assistant from decompiled code and are marked inferred unless a test result confirms them.
PlayerStats
51 methods (Dev CE test build). this is found with the game's own IPlayerStats instance resolver (virtual).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| AddWonderLostPlot |
PlayerStats:AddWonderLostPlot(iPlotIndex: integer) |
Appends a plot index to the vector of lost-wonder plots at this+0x3b8. |
plumbing ✓ |
— |
0x32a480 |
| CalculateImprovedTilePercentage |
PlayerStats:CalculateImprovedTilePercentage() → number |
Walks the player cities, counts purchased plots and those that are improved, and returns an improved tile percentage as an int. |
plumbing ✓ |
— |
0x32a4d0 |
| CalculateMilitaryStrength |
PlayerStats:CalculateMilitaryStrength(eDomain: integer) → number |
Sums unit strength over all player units (optionally filtered by domain): best of combat or ranged, scaled by health fraction; adds a gold-derived value when domain is -1. |
plumbing ✓ |
— |
0x32a6f0 |
| ChangeEmergenciesJoined |
PlayerStats:ChangeEmergenciesJoined(iDelta: integer) |
Adds a delta to the emergencies-joined counter at this+0x268. |
plumbing ✓ |
— |
0x32ade0 |
| ChangeGoldSpentLevying |
PlayerStats:ChangeGoldSpentLevying(iDelta: integer) |
Adds a delta to the gold-spent-levying counter at this+0x250. |
plumbing ✓ |
— |
0x32ae10 |
| ChangeScienceVictoryPointsPerTurn |
PlayerStats:ChangeScienceVictoryPointsPerTurn(xDelta: number (fixed point, 1/256 steps)) |
Adds a fixed-point delta to the science victory points earned per turn. |
plumbing ✓ ran ±1, reversible ✓, no visible effect |
Player::Stats::ChangeScienceVictoryPointsPerTurn |
0x32aeb0 |
| ChangeWMDCityHits |
PlayerStats:ChangeWMDCityHits(iDelta: integer) |
Adds a delta to the WMD city hits counter at this+0x1d8 and dispatches a game signal with the new value. |
plumbing ✓ |
— |
0x32aee0 |
| DoTurnActivate |
PlayerStats:DoTurnActivate() |
Start-of-turn stats refresh: recomputes military strength overall and per domain, then updates other stats from yields and congress; decompilation is truncated. |
plumbing ✓ |
— |
0x32b260 |
| GetAverageNumConstructableDistricts |
PlayerStats:GetAverageNumConstructableDistricts() → number |
Computes the average number of built specialty districts among constructable specialty district types as an 8-bit fixed point value. |
plumbing ✓ |
— |
0x32b6e0 |
| GetBestUnitOfDomain |
PlayerStats:GetBestUnitOfDomain(eDomain: integer) → number |
Returns the unit type with highest combat strength within a domain that the player can build (tech and civic requirements met). |
plumbing ✓ |
— |
0x32b870 |
| GetBestUnitOfPromotionClass |
PlayerStats:GetBestUnitOfPromotionClass(eClass: integer) → number |
Returns the unit type with highest strength in a promotion class that the player can use. |
plumbing ✓ |
— |
0x32b990 |
| GetMaxRangedStrengthTrained |
PlayerStats:GetMaxRangedStrengthTrained() → number |
Returns the larger of the stored max ranged strength trained and a global parameter minimum. |
plumbing ✓ |
— |
0x32bb10 |
| GetMilitaryStrength |
PlayerStats:GetMilitaryStrength(eDomain: integer, includeGold: boolean) → number |
Returns cached military strength for domain 0, 1 or 2; for other values returns total, minus the gold part unless includeGold. |
plumbing ✓ |
— |
0x32bb70 |
| GetNumArmada |
PlayerStats:GetNumArmada() → number |
Counts the player naval combat units (domain 0) that are armadas. |
plumbing ✓ |
— |
0x32bbd0 |
| GetNumArmy |
PlayerStats:GetNumArmy() → number |
Counts the player land combat units that are armies. |
plumbing ✓ |
— |
0x32bc70 |
| GetNumBuildingsCompleted |
PlayerStats:GetNumBuildingsCompleted() → number |
Sums the number of completed buildings across all building types in the player cities. |
plumbing ✓ |
— |
0x32bd50 |
| GetNumCitiesOnLandmassOfSize |
PlayerStats:GetNumCitiesOnLandmassOfSize(iMinSize: integer, iMaxSize: integer) → number |
Counts the player cities whose landmass size lies within a range. |
plumbing ✓ |
— |
0x32c020 |
| GetNumCivicsCulturevated |
PlayerStats:GetNumCivicsCulturevated() → number |
Returns the number of civics the player has completed, 0 if no player. |
plumbing ✓ |
— |
0x32c0c0 |
| GetNumCivicsCulturevatedPerEra |
PlayerStats:GetNumCivicsCulturevatedPerEra(eEra: integer) → number |
Counts civics from a given era that the player has completed. |
plumbing ✓ |
— |
0x32c0e0 |
| GetNumCombatUnits |
PlayerStats:GetNumCombatUnits() → number |
Counts the player units that have positive combat, ranged or bombard strength and a flag clear. |
plumbing ✓ |
— |
0x32c1a0 |
| GetNumCorps |
PlayerStats:GetNumCorps() → number |
Counts the player land combat units that are corps. |
plumbing ✓ |
— |
0x32c230 |
| GetNumDifferentTerrainTypesForCities |
PlayerStats:GetNumDifferentTerrainTypesForCities() → number |
Counts distinct terrain classes found under the player cities by marking a temporary array, which it frees afterwards. |
plumbing ✓ |
— |
0x32c2d0 |
| GetNumDistrictsCompleted |
PlayerStats:GetNumDistrictsCompleted(bSpecialtyDistrictsOnly: boolean, bIncludeCivUnique: boolean) → number |
Counts completed (non-pillaged) districts, optionally only specialty districts and including civ-unique replacements. |
plumbing ✓ |
— |
0x32c4a0 |
| GetNumDistrictsOfType |
PlayerStats:GetNumDistrictsOfType(eDistrict: integer, bIncludeUnderConstruction: boolean, bIncludeCivUnique: boolean, bIsIncludePillaged: boolean) → number |
Counts the player districts of a type, optionally including unique replacements, under-construction and pillaged ones. |
plumbing ✓ |
— |
0x32c710 |
| GetNumDistrictsPossible |
PlayerStats:GetNumDistrictsPossible() → number |
Sums the number of allowed districts across all of the player cities. |
plumbing ✓ |
— |
0x32c7e0 |
| GetNumGreatPeopleEarned |
PlayerStats:GetNumGreatPeopleEarned() → number |
Returns the number of great people the owning player has received from the game great-people tracker. |
plumbing ✓ |
— |
0x32cb80 |
| GetNumGreatWorks |
PlayerStats:GetNumGreatWorks() → number |
Sums the great works in all of the player cities. |
plumbing ✓ |
— |
0x32cbb0 |
| GetNumHolySitesFollowingReligion |
PlayerStats:GetNumHolySitesFollowingReligion(bMustHaveFoundedReligion: boolean) → number |
Counts major players whose holy city is of the religion this player founded (or, if bMustHaveFoundedReligion is false, the religion followed by the majority of its cities). |
plumbing ✓ |
— |
0x32cc70 |
| GetNumImprovedTiles |
PlayerStats:GetNumImprovedTiles() → number |
Counts plots owned by this player that have no district, hold an improvement that is not a barbarian camp and is not pillaged. |
plumbing ✓ |
— |
0x32cd50 |
| GetNumImprovementsOfType |
PlayerStats:GetNumImprovementsOfType(eImprovement: integer) → number |
Counts non-pillaged improvements of the given type on plots owned by this player. |
plumbing ✓ |
— |
0x32ce10 |
| GetNumLandUnits |
PlayerStats:GetNumLandUnits() → number |
Counts this player's alive land-domain units (domain 2) that have any melee, ranged or bombard combat strength. |
plumbing ✓ |
— |
0x32cec0 |
| GetNumNavalUnits |
PlayerStats:GetNumNavalUnits() → number |
Counts this player's alive sea-domain units (domain 0) that have any melee, ranged or bombard combat strength. |
plumbing ✓ |
— |
0x32cfa0 |
| GetNumOwnedCoastalLandTiles |
PlayerStats:GetNumOwnedCoastalLandTiles() → number |
Counts plots owned by this player that are coastal land. |
plumbing ✓ |
— |
0x32d030 |
| GetNumOwnedTiles |
PlayerStats:GetNumOwnedTiles() → number |
Counts all map plots whose owner is this player. |
plumbing ✓ |
— |
0x32d0c0 |
| GetNumProjectsAdvanced |
PlayerStats:GetNumProjectsAdvanced(eProject: integer) → number |
Returns how many times the given project has been completed by this player from a per-project counter array. |
plumbing ✓ |
— |
0x32d150 |
| GetNumReligiousUnits |
PlayerStats:GetNumReligiousUnits(includeHealers: boolean) → number |
Counts this player's alive units that have religious spread charges, optionally also units with a second charge counter (healers). |
plumbing ✓ |
— |
0x32d180 |
| GetNumTechnologiesResearchedPerEra |
PlayerStats:GetNumTechnologiesResearchedPerEra(eEra: integer) → number |
Counts the technologies of the given era that this player has researched. |
plumbing ✓ |
— |
0x32d1e0 |
| GetNumTechsResearched |
PlayerStats:GetNumTechsResearched() → number |
Returns the number of techs this player has researched (excluding repeatable techs). |
plumbing ✓ |
— |
0x32d2a0 |
| GetNumThemedBuildings |
PlayerStats:GetNumThemedBuildings() → number |
Counts, across all of this player's cities, the buildings that exist and are themed correctly (e.g. museums). |
plumbing ✓ |
— |
0x32d2c0 |
| GetNumUniqueDistrictsAvailable |
PlayerStats:GetNumUniqueDistrictsAvailable(bSpecialtyDistrictsOnly: boolean) → number |
Counts district types this player has the tech and civic to zone and can ever zone; with the flag set only specialty districts count. |
plumbing ✓ |
— |
0x32d3a0 |
| GetNumUniqueDistrictsCompleted |
PlayerStats:GetNumUniqueDistrictsCompleted(bSpecialtyDistrictsOnly: boolean) → number |
Counts district types of which this player has at least one completed district (flag at +0x3f8); with the flag set only specialty districts count. |
plumbing ✓ |
— |
0x32d480 |
| GetNumUnitsOfPromotionClass |
PlayerStats:GetNumUnitsOfPromotionClass(eClass: integer) → number |
Counts this player's alive units whose unit definition has the given promotion class. |
plumbing ✓ |
— |
0x32d5c0 |
| GetNumUnpillagedImprovements |
PlayerStats:GetNumUnpillagedImprovements() → number |
Copies this player's improvement plot-index list into a temporary buffer and counts the plots whose improvement is not pillaged. |
plumbing ✓ |
— |
0x32d710 |
| GetNumWMDsOfType |
PlayerStats:GetNumWMDsOfType(eWMD: integer) → number |
Returns the count of weapons of mass destruction of the given type stored for this player (read from a temporary copy of the counter array). |
plumbing ✓ |
— |
0x32d850 |
| GetNumWonders |
PlayerStats:GetNumWonders() → number |
Counts wonders built across this player's cities (buildings whose definition flag 0x40 is set and that exist in the city). |
plumbing ✓ |
— |
0x32d940 |
| GetOverallHappiness |
PlayerStats:GetOverallHappiness() → number |
Sums the happiness level of all of this player's cities. |
plumbing ✓ |
— |
0x32d9f0 |
| GetPopulation |
PlayerStats:GetPopulation() → number |
Sums the population of all of this player's cities. |
plumbing ✓ |
— |
0x32da50 |
| GetTourism |
PlayerStats:GetTourism() → number |
Calculates the player's tourism via CalculateTourism and returns the resulting value. |
plumbing ✓ |
— |
0x32dbe0 |
| GetYield |
PlayerStats:GetYield(eYield: integer, useChachedValue: boolean) → number |
Returns the player's total yield of the given type, either from a cached per-yield array or by summing the yield of every city. |
plumbing ✓ |
— |
0x32dc70 |
| IsUnitAffectMaxStrengthStats |
PlayerStats:IsUnitAffectMaxStrengthStats(eUnitType: integer) → boolean |
Checks whether a unit type counts toward max-strength stats: a non-sea unit lacking a specific property, whose XP2 definition is missing or has flag 4 set. |
plumbing ✓ |
— |
0x32e560 |
| IsWonderLostPlot |
PlayerStats:IsWonderLostPlot(iPlotIndex: integer) → boolean |
Checks whether the given plot index appears in this player's list of plots where a wonder was lost. |
plumbing ✓ |
— |
0x32e5f0 |
Details
AddWonderLostPlot
Arguments: iPlotIndex — map plot index to record
Writes
- Vector at this+0x3b8 gets the plot index appended
Input checks: No range check on the plot index.
Multiplayer: may-desync, appends to synchronised player stats. Risk: low (Appends to player stats). Confidence of the reading: medium.
CalculateImprovedTilePercentage
Input checks: Handles no cities; skips district, natural wonder and certain terrain plots.
Multiplayer: read-only, pure calculation. Risk: low (Pure calculation). Confidence of the reading: medium.
CalculateMilitaryStrength
Arguments: eDomain — domain filter, -1 for all domains plus gold
Input checks: -1 means no filter; otherwise matches unit domain.
Multiplayer: read-only, pure calculation. Risk: low (Pure calculation). Confidence of the reading: medium.
ChangeEmergenciesJoined
Arguments: iDelta — amount added to counter
Writes
- Emergencies joined counter
Input checks: No range check.
Multiplayer: may-desync, writes synchronised player stats. Risk: low (Writes player stats). Confidence of the reading: medium.
ChangeGoldSpentLevying
Arguments: iDelta — amount added to counter
Writes
- Gold spent levying counter
Input checks: No range check.
Multiplayer: may-desync, writes synchronised player stats. Risk: low (Writes player stats). Confidence of the reading: medium.
ChangeScienceVictoryPointsPerTurn
Arguments: xDelta — delta raw/256
Writes
- auto variable at this+0x340 (value at this+0x350) science victory points per turn
Side effects
- auto-variable assignment
Input checks: None.
Preconditions
- gameplay state only
Multiplayer: may-desync: direct state write. Risk: low (simple additive stat). Confidence of the reading: high.
Verified from the code
- adds delta to int at this+0x350 and writes via MoveAssignmentDo
ChangeWMDCityHits
Arguments: iDelta — amount added to counter
Writes
- WMD city hits counter
Side effects
- Dispatches a game signal with the owning player and new count
Input checks: No range check; dereferences current game without a null check.
Multiplayer: may-desync, writes synchronised player stats. Risk: low (Writes player stats). Confidence of the reading: medium.
DoTurnActivate
Writes
- Military strength stats (overall and per domain)
- Several other stats via variant maps (truncated)
Side effects
- Dispatches a game signal (seen in callee list)
Input checks: Unknown due to truncation.
Multiplayer: may-desync, writes synchronised stats. Risk: medium (Writes synchronised stats). Confidence of the reading: low.
GetAverageNumConstructableDistricts
Input checks: Handles zero count.
Multiplayer: read-only, pure calculation. Risk: low (Pure calculation). Confidence of the reading: medium.
GetBestUnitOfDomain
Arguments: eDomain — domain to search
Input checks: No validation of domain.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetBestUnitOfPromotionClass
Arguments: eClass — promotion class to search
Input checks: No validation.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetMaxRangedStrengthTrained
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetMilitaryStrength
Arguments: eDomain — domain 0, 1 or 2; other for total; includeGold — if true, include gold component in total
Input checks: Unknown domains fall to the total.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumArmada
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumArmy
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumBuildingsCompleted
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumCitiesOnLandmassOfSize
Arguments: iMinSize — minimum landmass size; iMaxSize — maximum landmass size
Input checks: No validation of range ordering.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumCivicsCulturevated
Input checks: Null player check.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumCivicsCulturevatedPerEra
Arguments: eEra — era type
Input checks: Null player and null era checks.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumCombatUnits
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumCorps
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumDifferentTerrainTypesForCities
Input checks: Skips cities without a plot.
Multiplayer: read-only getter. Risk: low (Only a temporary allocation). Confidence of the reading: medium.
GetNumDistrictsCompleted
Arguments: bSpecialtyDistrictsOnly — count only specialty districts; bIncludeCivUnique — also count district built as unique replacement
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: medium.
GetNumDistrictsOfType
Arguments: eDistrict — district type; bIncludeUnderConstruction — include unfinished districts; bIncludeCivUnique — include unique replacement district; bIsIncludePillaged — include pillaged districts
Input checks: No validation.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumDistrictsPossible
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumGreatPeopleEarned
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumGreatWorks
Input checks: None.
Multiplayer: read-only getter. Risk: low (Pure getter). Confidence of the reading: high.
GetNumHolySitesFollowingReligion
Arguments: bMustHaveFoundedReligion — If true only the founded religion is used; if false falls back to majority religion
Input checks: No null check on the player pointer; returns 0 when there is no religion.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumImprovedTiles
Input checks: No validation; map and player pointers are assumed valid.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumImprovementsOfType
Arguments: eImprovement — Improvement type index compared with each plot's improvement
Input checks: Type is not range checked; an invalid value simply matches nothing.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumLandUnits
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumNavalUnits
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumOwnedCoastalLandTiles
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumOwnedTiles
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumProjectsAdvanced
Arguments: eProject — Project type used as an index into the counter array
Input checks: Range checked (negative or beyond array returns 0).
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumReligiousUnits
Arguments: includeHealers — If true also counts units with the second charge field > 0 (inferred)
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumTechnologiesResearchedPerEra
Arguments: eEra — Era type whose tech list is scanned
Input checks: Null player check and era lookup check; era index itself is not range checked beyond Find returning null.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumTechsResearched
Input checks: Null player check only.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumThemedBuildings
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumUniqueDistrictsAvailable
Arguments: bSpecialtyDistrictsOnly — If true only specialty districts are considered
Input checks: No validation; null variant map passed to HaveTechAndCivicToZone.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetNumUniqueDistrictsCompleted
Arguments: bSpecialtyDistrictsOnly — If true only specialty districts are considered
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetNumUnitsOfPromotionClass
Arguments: eClass — Promotion class type compared with the unit definition's class
Input checks: Unit definition index is bounds checked, but a null definition would still be dereferenced.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetNumUnpillagedImprovements
Input checks: No validation; the list is a temporary copy.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetNumWMDsOfType
Arguments: eWMD — WMD type used as index into the copied counts
Input checks: No range check on the index and the copy is dereferenced unchecked, so an out-of-range type reads invalid memory.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter, but unchecked index). Confidence of the reading: medium.
GetNumWonders
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetOverallHappiness
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetPopulation
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.
GetTourism
Input checks: No validation.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
GetYield
Arguments: eYield — Yield type index; useChachedValue — If true return the cached value instead of recomputing from cities
Input checks: Recompute path skips when yield is -1 (returns 0); cached path indexes unchecked.
Multiplayer: read-only, only reads player/map state. Risk: low (getter; cached index unchecked). Confidence of the reading: medium.
IsUnitAffectMaxStrengthStats
Arguments: eUnitType — Unit type index to test
Input checks: Rejects -1 and out-of-range or null definitions (returns false).
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: medium.
IsWonderLostPlot
Arguments: iPlotIndex — Plot index searched in the list
Input checks: No validation; linear search.
Multiplayer: read-only, only reads player/map state. Risk: low (pure getter). Confidence of the reading: high.