Skip to content

Comments

Fix MacOS issue with opening logs#627

Open
davidliaos wants to merge 8 commits intopyclashbot:masterfrom
davidliaos:master
Open

Fix MacOS issue with opening logs#627
davidliaos wants to merge 8 commits intopyclashbot:masterfrom
davidliaos:master

Conversation

@davidliaos
Copy link

No description provided.

Add a new battle strategy option that allows the bot to spam cards at
bridge coordinates for efficient crown farming while maintaining
intelligent card selection and elixir management.

Features:
- New UI checkbox 'Bridge spam' mutually exclusive with 'Random plays'
- Intelligent card selection using existing logic
- Dynamic elixir management via BattleStrategy
- Automatic side detection (left/right bridge)
- Bridge coordinates based on hog card grouping patterns
- Full integration into 1v1 and 2v2 battle modes

Implementation details:
- Add BRIDGE_SPAM_USER_TOGGLE enum field
- Add bridge spam job configuration
- Implement _bridge_spam_fight_loop() with same card/elixir logic as
  normal fights but always plays at bridge coordinates
- Integrate into do_fight_state() and do_2v2_fight_state()
- Add mutual exclusivity logic between random plays and bridge spam
- Fix ttkbootstrap theme TclError handling in _apply_theme()

The bridge spam strategy uses coordinates:
- Left bridge: [(77, 281), (113, 283), (154, 283)]
- Right bridge: [(257, 283), (300, 283), (353, 283)]

This allows for efficient crown farming while maintaining the bot's
intelligent gameplay mechanics.
@davidliaos davidliaos marked this pull request as draft January 13, 2026 06:20
@davidliaos davidliaos marked this pull request as ready for review January 13, 2026 06:21
Resolved merge conflict in ui.py by keeping updated comment for theme
error handling.
Add robust boot check in BlueStacks restart() method to ensure Android
is fully loaded before attempting to check for Clash Royale installation.

The check verifies:
- sys.boot_completed property is set to '1'
- pm list packages command succeeds and returns output
- Critical system packages are present (systemui, launcher, settings)

This prevents false 'app not installed' errors that occur when Android
is still booting and package manager queries return incomplete results.

Fixes issue where bot checks for Clash Royale before BlueStacks finishes
loading, causing premature 'not installed' errors.
Remove all bridge spam related code as the feature doesn't work as intended.

Changes reverted:
- Removed BRIDGE_SPAM_USER_TOGGLE from enums
- Removed bridge spam JobConfig from config
- Removed bridge spam from job dictionary
- Removed bridge_spam_flag logic from states
- Removed bridge_spam_mode parameter from fight functions
- Removed _bridge_spam_fight_loop function
- Removed bridge spam checkbox from UI
- Removed mutual exclusivity logic between random plays and bridge spam
Add comprehensive debug statements to investigate why log folder is empty:
- Track log directory and file paths during initialization
- Verify log file creation and existence checks
- Monitor logging.info() calls and file writes
- List files in log folder when opening
- Track file size and content after writes

These debug statements will help identify:
- Whether log_dir path is correct
- Whether log files are being created
- Whether logging.info() is actually writing to files
- Whether there are permission or path issues
The debug output showed that logging.basicConfig() was not creating a FileHandler
because logging was already configured (had a StreamHandler to stderr).

Fix:
- Clear existing handlers before calling basicConfig()
- Use force=True to ensure reconfiguration
- Add debug statements to verify FileHandler creation

This ensures file logging works even if logging was configured earlier
by another module or import.
Remove all [DEBUG] print statements that were added for troubleshooting.
The logging fix is working correctly - logs are now being written to files.

Kept the functional fix:
- Clear existing handlers before basicConfig()
- Use force=True to ensure reconfiguration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant