4 ## moves neutral or enemy to first capsule
9 RECHARGER_RECHARGECOUNT=50
10 INGRESS_SCREENSHOT_FILENAME="/tmp/ingress_auto_recharge.png"
12 # expectation: inventory is in "key" mode, first/starting key visible.
13 # open inventory, position first.
14 #~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
15 #~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 550 900 750 900 100 # swipe right -> select first
19 for key in `seq 1 1 $RECHARGER_KEYCOUNT` ; do
20 echo -n "key:$key ($(date -Isec)) -- "
23 for rr in `seq 1 1 $RECHARGER_RECHARGECOUNT` ; do
24 rr=$(printf "%02d" $rr)
25 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key
26 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen
30 ~/Android/Sdk/platform-tools/adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > $INGRESS_SCREENSHOT_FILENAME
31 xm0="$(convert png:$INGRESS_SCREENSHOT_FILENAME -crop '1x1+204+130' txt:- | awk 'NR==2{print}' | cut -d, -f4)"
32 xm1="$(convert png:$INGRESS_SCREENSHOT_FILENAME -crop '1x1+404+130' txt:- | awk 'NR==2{print}' | cut -d, -f4)"
33 xm2="$(convert png:$INGRESS_SCREENSHOT_FILENAME -crop '1x1+604+130' txt:- | awk 'NR==2{print}' | cut -d, -f4)"
34 xm3="$(convert png:$INGRESS_SCREENSHOT_FILENAME -crop '1x1+804+130' txt:- | awk 'NR==2{print}' | cut -d, -f4)"
36 faction="$(convert png:$INGRESS_SCREENSHOT_FILENAME -crop '1x1+36+620' txt:- | awk 'NR==2{print}' | cut -d, -f4)"
38 rm "$INGRESS_SCREENSHOT_FILENAME"
40 #echo -n "rr:$rr sc:$xm0.$xm1.$xm2.$xm3 fac:$faction -- "
42 if [[ $xm0 != "23130" ]] && [[ $faction == "54998" ]]; then
44 # move key to first capsule.
45 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
46 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
47 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1025 # click on "capsules" (assuming "portal keys" is selected)
48 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
49 ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 550 900 750 900 100 # swipe right -> select first
51 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on capsule
52 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1640 # click "load"
53 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # mark key
54 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 1800 # click "transfer"
55 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # close capsule
56 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick capsule
57 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
58 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1220 # click on "portal keys" (assuming "capsules" is selected)
59 export INGRESS_NO_NEXT_ITEM_SWIPE="true"
62 if [[ $xm0 != "23130" ]] && [[ $faction != "54998" ]] && [[ $faction != "8481" ]]; then
64 # move key to first capsule.
65 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
66 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
67 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1025 # click on "capsules" (assuming "portal keys" is selected)
68 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
69 ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 550 900 750 900 100 # swipe right -> select first
71 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on capsule
72 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1640 # click "load"
73 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # mark key
74 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 1800 # click "transfer"
75 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # close capsule
76 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick capsule
77 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
78 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1220 # click on "portal keys" (assuming "capsules" is selected)
79 export INGRESS_NO_NEXT_ITEM_SWIPE="true"
83 if [[ $xm0 == "0" ]] && [[ $xm1 == "0" ]] && [[ $xm2 == "0" ]] && [[ $xm3 == "0" ]]; then
84 #echo "not rechargable. skipping."
86 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
90 # check if need to eat cube
91 if [[ $xm0 == "23130" ]] && [[ $xm1 != "23130" ]] && [[ $xm2 != "23130" ]] && [[ $xm3 != "23130" ]]; then
92 #echo -n "eating powercube + "
94 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops"
95 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
96 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "power cubes" (assuming "portal keys" is selected)
97 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left
98 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on cube
99 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "use"
101 # restore previous position.
102 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops"
103 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory
104 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "portal keys" (assuming "power cubes" is selected)
105 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key
106 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen
109 # finally recharge portal
110 #echo "recharging..."
112 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 250 1700 # click "recharge all"
113 ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 850 1700 # click "done"
114 ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key
118 if [[ -z $INGRESS_NO_NEXT_ITEM_SWIPE ]] ; then
119 ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 840 900 350 900 1500 # swipe to next key
121 unset INGRESS_NO_NEXT_ITEM_SWIPE