4 RECHARGER_RECHARGECOUNT=50
6 # expectation: inventory is in "key" mode.
7 # open inventory, position first.
8 #~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops"
9 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
10 ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 550 900 750 900 100 # swipe right -> select first
14 for key in `seq 1 1 $RECHARGER_KEYCOUNT` ; do
15 echo -n "key:$key ($(date -Isec)) -- "
18 for rr in `seq 1 1 $RECHARGER_RECHARGECOUNT` ; do
19 rr=$(printf "%02d" $rr)
20 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key
21 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen
25 mapfile -t scdata < <(~/Android/Sdk/platform-tools/adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' | convert png:- -crop '601x1+204+130' txt:- | awk 'NR==2;NR==202;NR==402;END{print}')
27 sc0=`echo ${scdata[0]} | cut -d, -f4`
28 sc1=`echo ${scdata[1]} | cut -d, -f4`
29 sc2=`echo ${scdata[2]} | cut -d, -f4`
30 sc3=`echo ${scdata[3]} | cut -d, -f4`
31 #echo -n "rr:$rr sc: $sc0 $sc1 $sc2 $sc3 -- "
33 if [[ $sc0 == "0" ]] && [[ $sc1 == "0" ]] && [[ $sc2 == "0" ]] && [[ $sc3 == "0" ]]; then
34 #echo "not rechargable. skipping."
36 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
40 # check if need to eat cube
41 if [[ $sc0 == "90" ]] && [[ $sc1 != "90" ]] && [[ $sc2 != "90" ]] && [[ $sc3 != "90" ]]; then
42 #echo -n "eating powercube + "
44 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops"
45 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
46 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "power cubes" (assuming "portal keys" is selected)
47 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
48 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on cube
49 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "use"
51 # restore previous position.
52 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops"
53 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
54 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "portal keys" (assuming "power cubes" is selected)
55 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key
56 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen
59 # finally recharge portal
62 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 250 1700 # click "recharge all"
63 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 850 1700 # click "done"
64 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
68 ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 840 900 350 900 1500 # swipe to next key
72 #~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # close inv