The City Resource objects can reference details about the various resources of city the script is run in.
City resource objects can be referenced as:
m_city.cityManager.resource.property or city.resource.property
The .property at the end is how you will specify which detail you are referencing. Using the table below, you can for example get the loyalty of the city with city.resource.support.
Properties
Property |
Type |
Description |
maxPopulation |
int |
Returns the maximum population possible in the city based on cottage levels. |
curPopulation |
int |
Returns the current population in the city. |
workPeople |
int |
Returns the total number of the city's population assigned to the labor force. |
support |
int |
Returns the city's loyalty. |
complaint |
int |
Returns the city's grievance. |
troopCostFood |
int |
Returns the city's upkeep based on troops. |
texRate |
int |
Returns the tax rate. |
taxIncome |
int |
Returns the amount of gold gained per hour based on the tax rate. |
gold |
int |
Returns the amount of gold in the city. |
food |
int |
Returns the amount of food in the city. |
wood |
int |
Returns the amount of wood in the city. |
stone |
int |
Returns the amount of stone in the city. |
iron |
int |
Returns the amount of iron in the city. |
The following city resource objects are available for each type of in-game resource. For example, you can reference the amount of workers assigned to iron production with city.resource.iron.workPeople.
Each of the following should be used in the format city.resource.xxx.property, for example: city.resource.food.amount.
Available in-game resource types here would be food, wood, stone, and iron.
Property |
Type |
Description |
xxx.workPeople |
int |
Returns the amount of the city's population assigned to the labor force for this particular resource, ie - city.resource.food.workPeople returns population assigned to farm production. |
xxx.increaseRate |
int |
Returns the amount per hour of the city's gain in this particular resource, ie - city.resource.food.increaseRate returns food income per hour, before upkeep is deducted. |
xxx.storeRercent |
int |
Returns the amount of this particular resource that is stored in the warehouse, ie - city.resource.food.storeRercent returns the % of food saved by the warehouse if one exists. These all default to 25% unless changed via warehousepolicy. Yes there is a typo in the name, it's Rercent not Percent. |
xxx.amount |
int |
Returns the amount of this particular resource in the city, ie - city.resource.iron.amount returns how much iron the city has. |
xxx.max |
int |
Returns the maximum production capacity for this particular resource in the city, ie - city.resource.iron.max returns how much iron the city can have before production will stop. |
The following city resource objects are also available for each type of in-game resource, but do not use the same format to reference them.
The following should be used as m_city.cityManager.property.xxx or city.property.xxx, for example to reference the amount of reserved food in the city, you would use city.reservedResource.food.
Available in-game resource types here would be gold, food, wood, stone, and iron.
Property |
Type |
Description |
estResource.xxx |
int |
Returns the estimated amount of this particular resource, ie - city.estResource.wood would return the estimated wood amount in the city. Estimated resources are what the bot thinks it should have based on income and use, and may vary slightly from the actual amount the server thinks it has. The bot updates the actual amount with the server the same as the Evony client does, on a delay. |
ResourceProduction.xxx |
int |
Returns the percentage amount of labor force assigned to this particular resource, ie - city.ResourceProduction.wood would return 100 when you have 100% possible assigned to it. Since gold is not produced by labor force, it is not valid as a resource here. |
reservedResource.xxx |
int |
Returns the amount of this particular resource that is reserved for upkeep, etc. For example city.reservedResource.gold would return the amount of gold needed in that city for hero salary for 24 hours. |