Merge pull request #40 from whoamikyo/master

Update: Easy Install updated to V2
This commit is contained in:
LmeSzinc 2020-06-19 00:30:19 +08:00 committed by GitHub
commit 8edd3534a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 179 additions and 87 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ config/*.ini
dev_tools/debug_tools dev_tools/debug_tools
.idea .idea
/screenshots /screenshots
/python
# Created by .ignore support plugin (hsz.mobi) # Created by .ignore support plugin (hsz.mobi)

View File

@ -1,82 +0,0 @@
@echo off
:: Initial message
echo ====================================================
echo Easy install for ALAS
echo Install Python 3.7.6 x64, ADB, GIT, CHOCOLATEY
echo ====================================================
echo ....................................................
echo By whoamikyo
echo ====================================================
::
echo.
:: request admin previleges, if no admin previleges
net session >nul 2>&1
if NOT %errorLevel% == 0 (
powershell start -verb runas '%0' am_admin & exit /b
)
set PATH=%PATH%;C:\Python37\;C:\Python37\Scripts\;%PROGRAMDATA%\chocolatey\lib\adb\tools\platform-tools\;%PROGRAMFILES%\Git\cmd;%PROGRAMDATA%\chocolatey\bin
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
echo.
echo Starting Installation
:: Installing chocolatey
echo Downloading chocolatey
PowerShell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
call refreshenv
:: Using Environment variables for program files
:: Uninstalling/removing the platform tools older version, if they exists and killing instances of adb if they are running
echo Uninstalling older version
adb kill-server > nul 2>&1
rmdir /Q /S "%PROGRAMDATA%\chocolatey\lib\adb\tools\platform-tools" > nul 2>&1
echo installing ADB
choco install adb --force -y
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
echo installing python
choco install python --version=3.7.6 -dfvym
call refreshenv
call python --version
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
echo installing git
choco install git --force -y
call refreshenv
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
echo Cloning repository
pushd %~dp0
git clone https://github.com/LmeSzinc/AzurLaneAutoScript.git
popd
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
:: killing adb server
call adb kill-server > nul 2>&1
pushd %~dp0
echo creating Virtual Environment
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
call python -m venv .\AzurLaneAutoScript\venvalas
echo activating Virtual Environment
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
call .\AzurLaneAutoScript\venvalas\Scripts\activate
echo installing requirements
pip install -r .\AzurLaneAutoScript\requirements.txt
popd
:: Installation done
echo.
echo.
echo Hurray!! Installation Complete, Now you can proceed
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
echo.
echo press any key to exit
pause > NUL

125
Easy_Install-V2.bat Normal file
View File

@ -0,0 +1,125 @@
@echo off
pushd "%~dp0"
echo.
echo :: Checking For Administrator Elevation...
echo.
timeout /t 1 /nobreak > NUL
openfiles > NUL 2>&1
if %errorlevel%==0 (
echo Elevation found! Proceeding...
) else (
echo :: You are NOT running as Administrator
echo.
echo Right-click and select ^'Run as Administrator^' and try again.
echo Press any key to exit...
pause > NUL
exit
)
set PATH=%PATH%;%PROGRAMDATA%\chocolatey\lib\adb\tools\platform-tools\;%PROGRAMFILES%\Git\cmd;%PROGRAMDATA%\chocolatey\bin
goto menu
:menu
cls
echo.
echo :: Easy install for ALAS
echo.
echo This script will install Python 3.7.6 + requirements.txt + ADB + GIT + CHOCOLATEY
echo.
echo :: By whoamikyo
echo.
echo 1. Essentials programs
echo 2. Clone repository
echo 3. Python 3.7.6 + requirements.txt
echo.
echo Install in order
echo.
echo :: Type a 'number' and press ENTER
echo :: Type 'exit' to quit
echo.
set /P menu=
if %menu%==1 GOTO programs
if %menu%==2 GOTO clone
if %menu%==3 GOTO python
if %menu%==exit GOTO EOF
else (
cls
echo.
echo :: Incorrect Input Entered
echo.
echo Please type a 'number' or 'exit'
echo Press any key to retrn to the menu...
echo.
pause > NUL
goto menu
)
:programs
cls
echo.
echo :: Checking For Internet Connection...
echo.
timeout /t 2 /nobreak > NUL
ping -n 1 archlinux.org -w 20000 >nul
if %errorlevel% == 0 (
echo Internet Connection Found! Proceeding...
) else (
echo :: You are NOT connected to the Internet
echo.
echo Please enable your Networking adapter and connect to try again.
echo Press any key to retry...
pause > NUL
goto packages
)
cls
echo.
echo :: Installing Packages...
echo.
timeout /t 1 /nobreak > NUL
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
@powershell -NoProfile -ExecutionPolicy Bypass -Command "choco install -y --force --allow-empty-checksums adb git"
goto menu
:python
cls
echo.
echo :: Installing Python 3.7.6 + requirements.txt
echo.
echo.
set ROOT=%~dp0AzurLaneAutoScript
set FILE_URL="https://gitlab.com/whoamikyo/alas-venv/-/raw/master/python.zip"
set FILE_DEST=%ROOT%\pythonpackage.zip
if not exist %ROOT% (
mkdir %ROOT%
)
if not exist "%FILE_DEST%" (
echo Downloading with powershell: %FILE_URL% to %FILE_DEST%
powershell.exe -command "$webclient = New-Object System.Net.WebClient; $url = \"%FILE_URL%\"; $file = \"%FILE_DEST%\"; $webclient.DownloadFile($url,$file);"
echo Expanding with powershell to: %ROOT%
powershell -command "$shell_app=new-object -com shell.application; $zip_file = $shell_app.namespace(\"%FILE_DEST%\"); $destination = $shell_app.namespace(\"%ROOT%\"); $destination.Copyhere($zip_file.items())"
) else (
echo "pythonpackage.zip already downloaded, delete to re-download"
)
goto menu
:clone
echo Cloning repository
git clone https://github.com/LmeSzinc/AzurLaneAutoScript.git
:: timout
PowerShell -Command "Start-Sleep -s 10" > nul 2>&1
:: killing adb server
call adb kill-server > nul 2>&1
goto menu

View File

@ -1,14 +1,62 @@
@echo off @echo off
echo Start batch on %CD% call adb kill-server > nul 2>&1
call .\venvalas\scripts\activate.bat
REM Change to your emulator port REM Change to your emulator port
::adb connect 127.0.0.1:5565 adb connect 127.0.0.1:5565
echo initializing uiautomator2
python -m uiautomator2 init python -m uiautomator2 init
Py alas_en.pyw
PAUSE :: timout
PowerShell -Command "Start-Sleep -s 3" > nul 2>&1
goto alas
:alas
cls
echo.
echo :: Alas run
echo.
echo Choose your server
echo.
echo 1. EN
echo 2. CN
echo 3. JP
echo.
echo :: Type a 'number' and press ENTER
echo :: Type 'exit' to quit
echo.
set /P menu=
if %menu%==1 GOTO en
if %menu%==2 GOTO cn
if %menu%==3 GOTO jp
if %menu%==exit GOTO EOF
else (
cls
echo.
echo :: Incorrect Input Entered
echo.
echo Please type a 'number' or 'exit'
echo Press any key to retry to the menu...
echo.
pause > NUL
goto alas
)
:en
%~dp0python/python.exe alas_en.pyw
goto alas
:cn
%~dp0python/python.exe alas_cn.pyw
goto alas
:jp
%~dp0python/python.exe alas_jp.pyw
goto alas