Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ venv.bak/

# own files
start.bat
config-local.ini
config-local.ini
test.py
16 changes: 16 additions & 0 deletions 720screencap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import cv2
from util.adb import Adb
from PIL import Image

# A short script to take screen captures to contribute to the 720p bot version
# Works with Memu by default, refer to update_screen in utils.py to make it work with Bluestacks
# The output should be a 1080p upscaled version of the 720p screenshot

Adb.service = '192.168.0.17:5555'
Adb.tcp = False
adb = Adb()
adb.exec_out('/storage/emulated/legacy/Download/ascreencap -f /storage/emulated/legacy/Download/screenshot.bmp')

screen = cv2.resize(cv2.imread("C:\\Users\\Michel14\\Downloads\\MEmu Download\\screenshot.bmp", 1),(1920,1080))

cv2.imwrite('screenshot.png', screen)
24 changes: 16 additions & 8 deletions ALAuto.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def run_combat_cycle(self):
self.print_stats_check = True
if result == 3:
# if morale is too low
Logger.log_warning("Ships morale is too low, entering standby mode for an hour.")
self.next_combat = datetime.now() + timedelta(hours=1)
Logger.log_warning("Ships morale is too low, entering standby mode for {} hour/s.".format(self.config.combat['low_mood_sleep_time']))
self.next_combat = datetime.now() + timedelta(hours=self.config.combat['low_mood_sleep_time'])
self.print_stats_check = False
if result == 4:
# if dock is full
Expand Down Expand Up @@ -194,17 +194,25 @@ def print_cycle_stats(self):

if adb.init():
Logger.log_msg('Successfully connected to the service with transport_id({}).'.format(Adb.transID))
output = Adb.exec_out('wm size').decode('utf-8').strip()

if not re.search('1920x1080|1080x1920', output):
Logger.log_error("Resolution is not 1920x1080, please change it.")
config.resolution = Adb.exec_out('wm size').decode('utf-8').strip()
Logger.log_debug('wm size request returned '+str(config.resolution))
# check supported resolution and setting asset path accordingly
if re.search('1920x1080|1080x1920', config.resolution):
Utils.assets = config.assets['server'] + '/1080'
elif re.search('1280x720|720x1280', config.resolution):
Utils.assets = config.assets['server'] + '/720'
else:
Logger.log_error("Resolution is not 1920x1080 nor 1280x720, please change it.")
sys.exit()

Utils.assets = config.assets['server']

else:
Logger.log_error('Unable to connect to the service.')
sys.exit()

#init required for screencap to work
Utils.screencapInit(config)


try:
while True:
Utils.update_screen()
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,29 @@ Check the [Wiki](https://github.com/Egoistically/ALAuto/wiki/Config.ini-and-Modu

This was made for my own usage, it is far from good and I'm very aware of it. I am posting this because it might be useful to someone, that's all.
If you'd like to contribute in any way make sure to open a [pull request](https://github.com/Egoistically/ALAuto/pulls) or an [issue](https://github.com/Egoistically/ALAuto/issues). If you'd like to contact us you can do so through our [Discord](https://discord.gg/vCFxDen).

## Fork Features

* Ascreencap shared folder support for Memu and BlueStacks, other emulators and phones can use the old adb screencap
* Ascreencap is installed automatically when first starting AlAuto
* preview 720p screen resolution support for EN version, note that some assets are missing(replaced by 1080p ones for the time being), list below:
```
Missing assets:
maps/E_A1 to SP5
research/12h, 30m
JP version assets
```
To contribute, you can add the missing assets to this repo. Use `720screencap.py` to get the right 720p screencap as the bot won't work with a regular screen capture.

### There are 2 new entries in the config.ini:
**Emulator**:
the name of the emulator, either `Memu` or `BlueStacks`
Leave this field empty for other emulators or phones, it will use the old adb screencap.

**SharedFolderpath**:
the complete path of memu or bluestacks shared folder, by default:
BlueStacks = `C:\ProgramData\BlueStacks\Engine\UserData\SharedFolder\`
Memu = `C:\Users\yourUsername\Downloads\MEmu Download\`



Binary file added ascreencap/arm64-v8a/ascreencap
Binary file not shown.
Binary file added ascreencap/armeabi-v7a/ascreencap
Binary file not shown.
Binary file added ascreencap/x86/ascreencap
Binary file not shown.
Binary file added ascreencap/x86_64/ascreencap
Binary file not shown.
File renamed without changes
Binary file added assets/EN/720/combat/alert_ammo_supplies.png
Binary file added assets/EN/720/combat/alert_failed_evade.png
Binary file added assets/EN/720/combat/alert_lock.png
Binary file added assets/EN/720/combat/alert_morale_low.png
Binary file added assets/EN/720/combat/alert_unable_battle.png
Binary file added assets/EN/720/combat/alert_unable_reach.png
Binary file added assets/EN/720/combat/auto_combat_off.png
Binary file added assets/EN/720/combat/button_confirm.png
Binary file added assets/EN/720/combat/button_evade.png
Binary file added assets/EN/720/combat/button_go.png
Binary file added assets/EN/720/combat/button_retreat.png
Binary file added assets/EN/720/combat/combat_pause.png
Binary file added assets/EN/720/combat/commander.png
Binary file added assets/EN/720/combat/defeat_close_button.png
Binary file added assets/EN/720/combat/fleet_ammo.png
Binary file added assets/EN/720/combat/fleet_arrow.png
Binary file added assets/EN/720/combat/fleet_lock.png
Binary file added assets/EN/720/combat/menu_combat_finished.png
Binary file added assets/EN/720/combat/menu_emergency.png
Binary file added assets/EN/720/combat/menu_fleet.png
Binary file added assets/EN/720/combat/menu_formation.png
Binary file added assets/EN/720/combat/menu_loading.png
Binary file added assets/EN/720/combat/menu_select_fleet.png
Binary file added assets/EN/720/combat/menu_touch2continue.png
Binary file added assets/EN/720/combat/question_mark.png
Binary file added assets/EN/720/commission/alert_available.png
Binary file added assets/EN/720/commission/alert_begun.png
Binary file added assets/EN/720/commission/alert_completed.png
Binary file added assets/EN/720/commission/alert_perfect.png
Binary file added assets/EN/720/commission/button_cancel.png
Binary file added assets/EN/720/commission/button_completed.png
Binary file added assets/EN/720/commission/button_go.png
Binary file added assets/EN/720/commission/button_ready.png
Binary file added assets/EN/720/commission/button_recommand.png
Binary file added assets/EN/720/commission/commission_status.png
Binary file added assets/EN/720/commission/commissions_full.png
Binary file added assets/EN/720/enemy/fleet_1_down.png
Binary file added assets/EN/720/enemy/fleet_1_up.png
Binary file added assets/EN/720/enemy/fleet_2_down.png
Binary file added assets/EN/720/enemy/fleet_2_up.png
Binary file added assets/EN/720/enemy/fleet_3_down.png
Binary file added assets/EN/720/enemy/fleet_3_up.png
Binary file added assets/EN/720/enemy/fleet_boss.png
Binary file added assets/EN/720/enemy/fleet_level.png
Binary file added assets/EN/720/enemy/fleet_level_mask.png
Binary file added assets/EN/720/enhancement/alert_enhanced.png
Binary file added assets/EN/720/enhancement/alert_no_items.png
Binary file added assets/EN/720/enhancement/button_favorite.png
Binary file added assets/EN/720/enhancement/menu_details.png
Binary file added assets/EN/720/enhancement/menu_enhance.png
Binary file added assets/EN/720/enhancement/menu_level.png
Binary file added assets/EN/720/enhancement/menu_retrofit.png
Binary file added assets/EN/720/headquarters/academy_alert.png
Binary file added assets/EN/720/headquarters/affinity_point.png
Binary file added assets/EN/720/headquarters/cat_lodge_alert.png
Binary file added assets/EN/720/headquarters/dorm_alert.png
Binary file added assets/EN/720/headquarters/dorm_sign.png
Binary file added assets/EN/720/headquarters/dorm_token.png
Binary file added assets/EN/720/headquarters/give_food_button.png
Binary file added assets/EN/720/headquarters/hq_alert.png
Binary file added assets/EN/720/headquarters/skill_exp_gain.png
Binary file added assets/EN/720/headquarters/supplies_bar_empty.png
Empty file.
Empty file.
Binary file added assets/EN/720/headquarters/tactical_class.png
Binary file added assets/EN/720/maps/map_1-1.png
Binary file added assets/EN/720/maps/map_1-2.png
Binary file added assets/EN/720/maps/map_1-3.png
Binary file added assets/EN/720/maps/map_1-4.png
Binary file added assets/EN/720/maps/map_10-1.png
Binary file added assets/EN/720/maps/map_10-2.png
Binary file added assets/EN/720/maps/map_10-3.png
Binary file added assets/EN/720/maps/map_10-4.png
Loading