BobobUnicorn
Chieftain
- Joined
- Feb 17, 2025
- Messages
- 2
As far as I can tell, the current celebration type that the player has picked isn't directly exposed via the standard game objects; I figured it might be helpful to post some code for how to get the information through
This returns an object (or
ReflectionArchives
.
JavaScript:
function getCurrentGoldenAge() {
const allPlayers = ReflectionArchives.getPlayers().getChildren();
const idIndex = findFieldIndex(allPlayers[0], 'm_id');
const currentPlayer = allPlayers.find(player => player.getMemberValueString(idIndex) === String(GameContext.localPlayerID));
const happiness = currentPlayer?.getChildren().find((child) => child.typeStr === 'PlayerHappiness');
const goldenAgeIndex = findFieldIndex(happiness, 'm_eCurrentGoldenAge');
const goldenAgeValue = happiness?.getMemberValueString(goldenAgeIndex);
return GameInfo.GoldenAges.find(age => String(age.$index) === goldenAgeValue);
}
This returns an object (or
undefined
if the player isn't in a celebration) with this interface:
JavaScript:
interface GoldenAgeDefinition {
GoldenAgeType: string;
Name: LocalizedStringId;
Description: LocalizedStringId;
}
Name
and Description
should be run through Locale.compose
to get the localized strings.