How stefan2200/twb works
Project type and purpose
• This is a Python-based “bot” for the browser game Tribal Wars. It provides both a CLI‐driven automation engine (twb.py/manager.py) and an optional Flask-based web dashboard (webmanager/). The core purpose is to scrape the game via HTTP (using your browser cookie for authentication), extract game state, make decisions (manage villages, troops, buildings, etc.), and post commands back to the game server automatically.
File structure
Top-level entrypoints:
• twb.py – main CLI bot
• manager.py – secondary CLI to adjust configuration
• installer.bat / start.bat – Windows helpers
Core packages:
• core/ – low-level services (HTTP requests, file I/O, templating, notifications, updates, reporting)
• game/ – domain logic (village, troops, map, attacks/defense, simulation, resource management)
• pages/ – page‐specific scraper definitions (overview.py, etc.)
Web UI:
• webmanager/ – Flask app (server.py), templates, static assets, helper code
Other:
• templates/ – text templates to generate game commands (building, offensive, troops)
• config.example.json & readme/configs.md – configuration for endpoints, villages, strategies
• requirements.txt – dependencies
README for additional insights
• Describes features (building, defense, troop, market, research management, etc.), usage flow (CLI startup, cookie string for auth, auto-reload config), and optional web dashboard on Flask at localhost:5000.
Elements
• UI components (e.g., blue)
• Core services (e.g., green)
• Domain logic (e.g., orange)
• Data stores & templates (e.g., gray)
• External systems (e.g., red)