How hgjazhgj/fgo-py works
Main Components
• Entry Points: The main script (fgo.py) serves as the primary launcher. It dispatches to either the GUI (fgoGui.py, fgoMainWindow.py) or the CLI (fgoCli.py) interfaces.
• User Interfaces:
– Graphical Interface (built on Qt6): fgoGui.py, fgoMainWindow.py, and associated UI files (.ui).
– Command Line Interface: fgoCli.py.
• Core Business Logic: Several modules in the FGO-py package manage game automation; these include:
– Battle automation and scheduling (fgoFarming.py, fgoSchedule.py, fgoRunOnce.py).
– Team configuration and parsing (fgoTeamupParser.py, fgoTeamup.ini, fgoTeamupDialog.py).
– Game mechanics helpers such as fgoFuse.py, fgoOcr.py, fgoReishift.py.
– Device management (fgoDevice.py) that handles connection and commands (including specialized connection shortcuts noted in the README).
– Kernel module (fgoKernel.py) that likely orchestrates lower-level operations.
• Configuration and Localization:
– fgoConfig.py for runtime settings stored in JSON.
– Internationalization resources (fgoI18n.[lang].qm/ts files) that allow multi-language support.
• Assets and Resource Management:
– The fgoImage directory holds a large number of graphical assets (for servants, classes, maps, etc.), which are used by the automation UI and logic.
• Utility & Logging:
– fgoLogging.py and the fgoLog folder help track operations.
– fgoMetadata.py, which likely contains data extraction/processing for in-game elements.
• Web Components:
– fgoWebServer.py and fgoWebUI indicate that a web interface exists for remote monitoring/control.
• Deployment Support:
– The deploy/ subdirectories provide Docker setups and automation scripts for environments like AidLux and AzurLaneAutoScript.
Establish Relationships and Data Flows
• Both interfaces feed commands to the central launcher (fgo.py), which in turn routes commands to the core business logic.
• The business logic interacts with:
– The device connection layer (fgoDevice.py) to send ADB commands or capture screenshots (aided by fgoImageListener.py).
– The configuration management (fgoConfig.py) for runtime settings and stored preferences.
– The scheduling module (fgoSchedule.py) to manage and queue automated tasks (like automatic missions and team setups).
• Image assets (from fgoImage) and localization files serve as static resources, referenced by both UI and automation logic.
• Logging (fgoLogging.py and fgoLog/) provide continuous feedback from the background operations.
• Optionally, include an external services layer for deployment (Docker, AidLux, and others) that show environment-specific configuration impacting the core engine.
• Built-in “helper” functions for connection strings (e.g., specific shortcuts for BlueStacks) which reside in the device connection modules.
Architectural Patterns
• Separation of Concerns: Clearly separate the UI layer (GUI/CLI), the business logic/core automation engine, and the device/operating system integration layer.
• Modular Design: Each component (e.g., team formation, battle management, image recognition) is developed as an independent module that interconnects through well-defined interfaces.
• Extensibility: The use of external configuration (fgoConfig.json, teamup.ini) and asset directories points to an architecture that encourages user customization without changing the core code.