Coder Social home page Coder Social logo

azurlane-auto's Introduction

azurlane-auto

ALAuto is an Azur Lane automation tool based on kcauto. The tool is written in Python 3 and uses OpenCV for image detection and ADB for input

Features

  • Combat Module — Automate Combat
  • Commission Module — Automate Commissions
  • Mission Module — Automatic mission management
  • Retire Module — Automatic retirement of common and rare ships

Requirements

  • ADB debugging enabled phone or emulator with 1280x720 resolution

Installation and Usage

  1. Install Python 3.x
  2. Clone or download the azurelane-auto repository
  3. Install the required packages via pip3 with the command pip3 install -r requirements.txt
  4. Run azurlane-auto using the command python3 azurlane-auto.py

Updating

The preferred method of keeping azurlane-auto up to date is via git. This requires you have a working git installation, have cloned the azurlane-auto repository, and are running azurlane-auto off of said clone.

If you do have git and cloned the azurlane-auto repository, use one of the following command to update to the latest release (master version) of azurlane-auto:

  • git pull origin master or git pull

If you do not have git or a clone of the azurlane-auto repository, head to the releases page and download the latest tagged version. Overwrite your local azurlane-auto installation with the contents of the new release, taking care to first back up or not overwrite your config file. Note that your config file may need updating to be compatible with new releases.

License

azurlane-auto is WTFPL licensed, as found in the LICENSE file.

azurlane-auto's People

Contributors

perryhuynh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azurlane-auto's Issues

Script crashes when trying to swipe the screen to look around for enemies

Environment details

  • azurlane-auto version (version on first line of CHANGELOG.md): 0.1.0

Issue variability

Consistent

Issue

Script crashes when trying to swipe the screen to look around for enemies

Log

Traceback (most recent call last):
  File "azurlane-auto.py", line 97, in <module>
    script.run_combat_cycle()
  File "azurlane-auto.py", line 41, in run_combat_cycle
    if self.modules['combat'].combat_logic_wrapper():
  File "D:\azurlane-auto\modules\combat.py", line 69, in combat_logic_wrapper
    if self.clear_trash():
  File "D:\azurlane-auto\modules\combat.py", line 252, in clear_trash
    enemy_coord = self.get_closest_enemy()
  File "D:\azurlane-auto\modules\combat.py", line 161, in get_closest_enemy
    Util.swipe(640, 360 - y_dist * multiplier,
NameError: name 'Util' is not defined

Crash when starting script

  • azurlane-auto version (version on first line of CHANGELOG.md): 0.1.1

Issue variability

Consistent

Issue

Script crashes upon starting

Log

Traceback (most recent call last):
  File "azurlane-auto.py", line 98, in <module>
    script.run_mission_cycle()
  File "azurlane-auto.py", line 54, in run_mission_cycle
    if self.modules['mission']:
KeyError: 'mission'

Not clicking 'Go' once map is selected, phone with adb debugging.

Tried using the combat module on my phone with adb debugging enabled.

First, it didn't properly tap on 'Attack' because of the resolution, changed it to 720x1280 and solved that issue. After that, it properly taps on the 6-1 map but it gets stuck when having to tap on the second 'Go', on the fleet screen.

Tried restarting 3 times, one of them didn't tap on the second go, the other two times it didn't even click on the first one.

The console doesn't detect the issue and acts like it properly entered the map.

[2018-12-25 19:04:22] Navigating to map.
[2018-12-25 19:04:42] Alternate clearing fleet enabled, switching to 2nd fleet to clear trash

The second line happens 10s after entering the second go screen, it taps outside and closes the box.

My config.ini (ignore the KillsNeeded part, I intended to use it on 10-4 at first):

[Commissions]
Enabled: True

[Combat]
Enabled: True
Map: 6-1
KillsNeeded: 6
Hard: False
Formation:
AltClearFleet: True
BossFleet: True

[Missions]
Enabled: False

Tried disabling AltClearFleet and BossFleet just in case, still doesn't work and does exactly the same (which I kinda expected, since those settings only affect once it has entered the map).

Development Checklist

Todo:

  • Clean up Commission code and enable the module
  • Link Retirement Module with Combat Module
  • Fix edge cases where enemy is under the add coins/gem/oil/emergency repair buttons
  • Add page navigation for combat page to select specified map

Can't find specified file

Environment details

0.1.1

Issue variability

Consistent

Issue

Running the command : python3 azurlane-auto.py always ends with FileNotFoundError: [WinError 2]

azur

Log

C:\Users\imaik\Downloads\Azur Lane\azurlane-auto-master>py -3 azurlane-auto.py
�[94m[2019-01-03 06:29:48] Initializing config module�[0m
�[94m[2019-01-03 06:29:48] Validating config�[0m
�[94m[2019-01-03 06:29:48] Starting azurlane-auto!�[0m
Traceback (most recent call last):
  File "azurlane-auto.py", line 91, in <module>
    Adb.init()
  File "C:\Users\imaik\Downloads\Azur Lane\azurlane-auto-master\util\adb.py", line 10, in init
    cls.kill_server()
  File "C:\Users\imaik\Downloads\Azur Lane\azurlane-auto-master\util\adb.py", line 25, in kill_server
    subprocess.call(cmd)
  File "C:\Users\imaik\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\imaik\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\imaik\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

ADB commands used doesn't support Android 5 or below

Environment details

  • azurlane-auto version (version on first line of CHANGELOG.md): 0.1.1

Issue variability

Consistent

Issue

There are some adb command that doesn't support older device e.g. Android 5 or below. This cause the logic to take screenshot in emulator/device returning error thus creating error on opencv.imdecode. I'm using Nox emulator to create this bug. Nox emulator use Android 4.

Log

�[94m[2019-01-27 08:48:26] Initializing config module�[0m
�[94m[2019-01-27 08:48:26] Validating config�[0m
�[94m[2019-01-27 08:48:26] Starting azurlane-auto!�[0m
already connected to 127.0.0.1:62001
�[94m[2019-01-27 08:48:26] Navigating to map.�[0m
error: closed
Traceback (most recent call last):
  File "azurlane-auto.py", line 96, in <module>
    script.run_combat_cycle()
  File "azurlane-auto.py", line 41, in run_combat_cycle
    if self.modules['combat'].combat_logic_wrapper():
  File "D:\Downloads\azurlane-auto\azurlane-auto-master\modules\combat.py", line 57, in combat_logic_wrapper
    Utils.wait_and_touch('map_{}'.format(self.sortie_map), 5, 0.85)
  File "D:\Downloads\azurlane-auto\azurlane-auto-master\util\utils.py", line 196, in wait_and_touch
    if cls.find_and_touch(image, similarity):
  File "D:\Downloads\azurlane-auto\azurlane-auto-master\util\utils.py", line 173, in find_and_touch
    region = cls.find(image, similarity)
  File "D:\Downloads\azurlane-auto\azurlane-auto-master\util\utils.py", line 92, in find
    screen = cls.update_screen()
  File "D:\Downloads\azurlane-auto\azurlane-auto-master\util\utils.py", line 77, in update_screen
    Adb.exec_out('screencap -p'), dtype=numpy.uint8), 0)
cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:750: error: (-215:Assertion failed) !buf.empty() && buf.isContinuous() in function 'cv::imdecode_'

Attribute Error

Environment details

0.1.1

Issue variability

Persistent

Issue

image

Log

�[94m[2019-01-03 17:02:22] Initializing config module�[0m
�[94m[2019-01-03 17:02:22] Validating config�[0m
�[94m[2019-01-03 17:02:22] Starting azurlane-auto!�[0m
error: protocol fault (couldn't read status): Connection reset by peer
�[94m[2019-01-03 17:02:23] Navigating to map.�[0m
* daemon not running; starting now at tcp:5037
* daemon started successfully
Traceback (most recent call last):
  File "azurlane-auto.py", line 96, in <module>
    script.run_combat_cycle()
  File "azurlane-auto.py", line 41, in run_combat_cycle
    if self.modules['combat'].combat_logic_wrapper():
  File "C:\Users\Darryl\Downloads\Azur Lane\azurlane-auto-master\modules\combat.py", line 57, in combat_logic_wrapper
    Utils.wait_and_touch('map_{}'.format(self.sortie_map), 5, 0.85)
  File "C:\Users\Darryl\Downloads\Azur Lane\azurlane-auto-master\util\utils.py", line 196, in wait_and_touch
    if cls.find_and_touch(image, similarity):
  File "C:\Users\Darryl\Downloads\Azur Lane\azurlane-auto-master\util\utils.py", line 173, in find_and_touch
    region = cls.find(image, similarity)
  File "C:\Users\Darryl\Downloads\Azur Lane\azurlane-auto-master\util\utils.py", line 94, in find
    width, height = template.shape[::-1]
AttributeError: 'NoneType' object has no attribute 'shape'

Config

[Commissions]
Enabled: False

[Combat]
Enabled: True
Map: 1-1
KillsNeeded: 1
Hard: False
Formation:
AltClearFleet: False
BossFleet: False

[Missions]
Enabled: False

Cant start clearing 3-4 map

Hello!

config.ini:
[Commissions]
Enabled: False

[Combat]
Enabled: True
Map: 3-4
KillsNeeded: 4
Hard: False
Formation:
AltClearFleet: False
BossFleet: True

[Missions]
Enabled: False

Cloned from here: https://github.com/perryhuynh/azurlane-auto/tree/feature/7-combat-fixes

Here's what I'm getting:

�[94m[2019-04-28 20:29:56] Initializing config module�[0m
�[94m[2019-04-28 20:29:56] Validating config�[0m
�[94m[2019-04-28 20:29:56] Starting azurlane-auto!�[0m
�[94m[2019-04-28 20:30:00] Navigating to map.�[0m
Traceback (most recent call last):
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\azurlane-auto.py", line 96, in <module>
    script.run_combat_cycle()
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\azurlane-auto.py", line 41, in run_combat_cycle
    if self.modules['combat'].combat_logic_wrapper():
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\modules\combat.py", line 57, in combat_logic_wrapper
    Utils.wait_and_touch('map_{}'.format(self.sortie_map), 5, 0.85)
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\util\utils.py", line 196, in wait_and_touch
    if cls.find_and_touch(image, similarity):
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\util\utils.py", line 173, in find_and_touch
    region = cls.find(image, similarity)
  File "C:\Users\user\Desktop\Minimal ADB and Fastboot\util\utils.py", line 94, in find
    width, height = template.shape[::-1]
AttributeError: 'NoneType' object has no attribute 'shape'

Maybe I need to add map-3 pics in assests folder?

General issues with combat

Environment details

  • azurlane-auto version (version on first line of CHANGELOG.md): 0.1.1

Issue variability

Intermittent

Issue

Wait time between switching fleets needs to be increased as it will sometimes fail to register the click. The boss asset used for finding the boss needs to be changed as well as starting with a higher similarity value and slowly decrement if the boss cannot be found

Crimson Echoes Event

Due to the way enemy path finding/navigation currently works, Crimson Echoes event will most likely not be supported due to the limited spaces in which you can move in 1 turn.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.