battlepoint show

This commit is contained in:
2026-05-05 20:29:35 +03:00
parent 138841b027
commit 4f7e0fae51
6 changed files with 56 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ def receive_state():
player_id = data.get('player_id', '')
alliance_id = str(data.get('alliance_id', '') or '')
world_id = data.get('world_id', '')
battle_points = data.get('battle_points', {})
# Auto-register this player to the clan that matches the key (if any)
clan = _get_clan_from_request()
@@ -72,6 +73,7 @@ def receive_state():
x = town.get('x')
y = town.get('y')
sea = town.get('sea')
town['battle_points'] = battle_points
c.execute('''
INSERT INTO town_state
(town_id, town_name, player, player_id, alliance_id, world_id, x, y, sea, data, updated_at)

View File

@@ -268,7 +268,8 @@ def get_towns():
'total_points': d.get('total_points', 0),
'alliance_name': d.get('alliance_name', None),
'blueprint_name': row['blueprint_name'],
'blueprint_active': bool(row['blueprint_active'])
'blueprint_active': bool(row['blueprint_active']),
'battle_points': d.get('battle_points', {'att': 0, 'def': 0, 'available': 0, 'used': 0})
})
return jsonify(towns)