Code Farm economy rebalance: market saturation, infrastructure/defense/cosmetics, mastery track, secondary leaderboards, admin eras, underdog bonus and weekly contracts

Every purchase/upgrade path (new and pre-existing) is now race-safe against concurrent requests via atomic conditional SQL updates.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 23:55:46 +02:00
co-authored by Claude Sonnet 5
parent 024edb5291
commit 34f76aad65
54 changed files with 3886 additions and 164 deletions
+1
View File
@@ -99,6 +99,7 @@ from devplacepy.schemas.backups import (
BackupStoragePathOut,
)
from devplacepy.schemas.admin import (
AdminGameOut,
AdminMediaItemOut,
AdminMediaOut,
AdminNewsItemOut,
+9
View File
@@ -72,3 +72,12 @@ class AdminTrashOut(_Out):
tables: list[dict] = []
pagination: Optional[Any] = None
admin_section: Optional[str] = None
class AdminGameOut(_Out):
era_active: bool = False
era_name: str = ""
era_number: int = 0
era_started_at: str = ""
era_ends_at: str = ""
admin_section: Optional[str] = None
+57
View File
@@ -15,6 +15,7 @@ class GameCropOut(_Out):
min_level: int = 1
grow_seconds: int = 0
locked: bool = False
market_state: str = "normal"
class GamePlotOut(_Out):
@@ -62,6 +63,38 @@ class GameLegacyOut(_Out):
effect: str = ""
class GameMasteryOut(_Out):
key: str = ""
name: str = ""
icon: str = ""
description: str = ""
level: int = 0
max_level: int = 0
cost: int = 0
maxed: bool = False
effect: str = ""
class GameInfrastructureOut(_Out):
key: str = ""
name: str = ""
icon: str = ""
description: str = ""
cost: int = 0
min_prestige: int = 0
owned: bool = False
class GameCosmeticOut(_Out):
key: str = ""
name: str = ""
icon: str = ""
description: str = ""
cost_coins: int = 0
kind: str = ""
owned: bool = False
class GameQuestOut(_Out):
kind: str = ""
label: str = ""
@@ -71,6 +104,8 @@ class GameQuestOut(_Out):
reward_xp: int = 0
claimed: bool = False
can_claim: bool = False
scope: str = "daily"
reward_stars: int = 0
class GameFarmOut(_Out):
@@ -107,6 +142,25 @@ class GameFarmOut(_Out):
stars: int = 0
legacy: list[GameLegacyOut] = []
steal_cooldown_seconds: int = 0
mastery_points: int = 0
mastery_points_earned_total: int = 0
mastery: list[GameMasteryOut] = []
infrastructure: list[GameInfrastructureOut] = []
defense_level: int = 0
defense_tier_name: str = ""
defense_upkeep_daily: int = 0
defense_next_cost: int = 0
cosmetics: list[GameCosmeticOut] = []
active_title: str = ""
underdog_boost_seconds_remaining: int = 0
mastery_analytics_unlocked: bool = False
lifetime_coins_earned: int = 0
lifetime_harvests: int = 0
harvests_week: int = 0
era_active: bool = False
era_name: str = ""
era_coins: int = 0
era_harvests: int = 0
class GameStateOut(_Out):
@@ -130,6 +184,9 @@ class GameLeaderboardEntryOut(_Out):
total_harvests: int = 0
prestige: int = 0
score: int = 0
raid_avg: float = 0.0
time_to_kernel_seconds: int = 0
title: str = ""
class GameLeaderboardOut(_Out):