This commit is contained in:
2026-05-02 02:45:42 +03:00
parent 83b8c85557
commit 84de7082ec

View File

@@ -136,7 +136,24 @@ def evaluate_blueprints(conn):
continue
has_max = b_info.get('has_max_level', False)
deps = b_info.get('missing_dependencies')
# Do not trust the frontend 'enough_resources' flag. Grepolis lazily loads this,
# so for background towns it is almost always stale (False). We calculate it manually!
enough = b_info.get('enough_resources')
res = town.get('resources')
if res:
b_wood = b_info.get('wood', 0)
b_stone = b_info.get('stone', 0)
b_iron = b_info.get('iron', 0)
b_pop = b_info.get('pop', 0)
enough = (
res.get('wood', 0) >= b_wood and
res.get('stone', 0) >= b_stone and
res.get('iron', 0) >= b_iron and
res.get('population', 0) >= b_pop
)
log.warning(f"[blueprint] {b_name}: has_max={has_max}, deps={deps}, enough_resources={enough}")
if not has_max: