Due to different version of python(2.7) and jypthon(2.5) are using. The whole process can be separated into two parts:
- A Monkeyrunner script to automate the game to getcha
- A python script to process the result generated from Monkeyrunner.
./aapt d badging ~/monkeyscript/apk/cf.apk
Example:
launchable-activity: name='jp.wonderplanet.Yggdrasil.BULL' label='Crash Fever' icon=''
convert info.png -crop $wx$h+$x+$y converted.png
./monkeyrunner ~/monkeyscript/MonkeyMain.py ${Config name}
*: Target config file must be in the same directory sa MonkeyMain.py
Auto-control the game to pass tutorials and get the first getcha. And able to start the process from beginning without downloading the game data again.
Add custom project path to monkeyrunner:
import sys
sys.path.append('/Users/makkit/monkeyscript')
# Start import.
import MonkeyKing...
The script of this part should able to generate:
- Getcha result screen
- User profile data (if possible)
- Recovery code screen(Optional)
- Other information like getcha character identity(Optional)
- Boot nox player.
adb connect 127.0.0.1:62001
# useadb disconnect
to disconnect.- then
waitForConnection()
can get access to nox player. - Use
MonkeyDevice
to control the simulator.
/data/app/
Another script should be able to read information from screenshots generated in simulator.
Advanced:
- Write result and upload screenshot to server db.
OCR tips:
- Crop the image smaller that contains the significant text.
- Use REGEXP to get final result from text.
from PIL import Image
import pytesseract
Image.open('/Users/makkit/monkeyscript/dummy/cap.png')
pytesseract.image_to_string(image, lang='eng')
-- ### Task 1: (nice) 1. Run a game 2. Go to target screen(Preset) 3. Take snapshot 4. Output log 5. Shut down game
### Task 2: (nice)
1. Create files in a game package
2. Use script to remove these files
3. backup some files
- Run a game
- Get first getcha
- Take snapshot
- Output log
- Reset game
- Check if reset ok
- Run repeat first getcha of a game for one day
- Check performance
--
function needed:
- Load many images(screen cap image)
- Easy switch images(show/hide)
- add tap point on image(export to x,y point id)
--
Script can be transformed into config like programmable code.
Format example:
wait-screen gacha-screen 50 5 . . .
Description:
- First param: command inside ACTION_MAP dict
- Second and so on: params of the action
.
can be used if no param needed
Usage:
- Define list of MonkeyKingScript instead of define list of action dict in config. Script file will be transformed and appended into config object one by one in array order.
- example:
'COORDINATE_FILES': ['script/coord.mks', 'script/main-flow.mks'],
'SCRIPT_FILES': ['script/part1.mks', 'script/part2.mks'],
'SCREEN_FILES': ['script/main-flow-screen.mks', 'script/flow-2.mks'],
-
? All script file name will also be a
checkpoint
variable. So script can use jump to jump to content of a mks. -
checkpoint
defined are shared among all scripts.
- Gacha function
- Every member can only do one gacha every n minutes.
- One gacha have 5~10 accounts
- Stat showing the gacha pool (~100 account left, 1% SR, 99% R)
Win setup adb:
https://developer.android.com/studio/index.html
scroll down to get only SDK: "Get just the command line tools" unzip and move to a better directory, eg C:\adt cmd cd C:\adt\tools\bin sdkmanager "build-tools;26.0.1" sdkmanager "platform-tools" create framework folder under /tools copy platform-tools to framework copy lib to framework OK