From 288a44a385ab5279ff1a6c19d877e708fdfb707a Mon Sep 17 00:00:00 2001 From: Someone Date: Tue, 27 Sep 2016 01:13:36 +0200 Subject: [PATCH] added ingress adb helpers. --- ingress_item_recycle.sh | 15 +++++++++ ingress_recharge_keys.sh | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100755 ingress_item_recycle.sh create mode 100755 ingress_recharge_keys.sh diff --git a/ingress_item_recycle.sh b/ingress_item_recycle.sh new file mode 100755 index 0000000..903e1f1 --- /dev/null +++ b/ingress_item_recycle.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +RECYCLE_ITEMCOUNT=$1 + +# expectation: inventory is in most safe mode, first recycle-item selected. +# repeat for all items +for item in `seq 1 1 $RECYCLE_ITEMCOUNT` ; do + echo "recycling item: $item" + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click item + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 1850 # click "recycle" + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 650 1850 # click "confirm" + #~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # skip animation + sleep 1 +done + diff --git a/ingress_recharge_keys.sh b/ingress_recharge_keys.sh new file mode 100755 index 0000000..7c6b6c5 --- /dev/null +++ b/ingress_recharge_keys.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +RECHARGER_KEYCOUNT=$1 +RECHARGER_RECHARGECOUNT=50 + +# expectation: inventory is in "key" mode. +# open inventory, position first. +#~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops" +~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left +~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 550 900 750 900 100 # swipe right -> select first +sleep 1 + +# repeat for all keys +for key in `seq 1 1 $RECHARGER_KEYCOUNT` ; do + echo -n "key:$key ($(date -Isec)) -- " + + # recharge run + for rr in `seq 1 1 $RECHARGER_RECHARGECOUNT` ; do + rr=$(printf "%02d" $rr) + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen + + sleep 0.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}') + + sc0=`echo ${scdata[0]} | cut -d, -f4` + sc1=`echo ${scdata[1]} | cut -d, -f4` + sc2=`echo ${scdata[2]} | cut -d, -f4` + sc3=`echo ${scdata[3]} | cut -d, -f4` + #echo -n "rr:$rr sc: $sc0 $sc1 $sc2 $sc3 -- " + + if [[ $sc0 == "0" ]] && [[ $sc1 == "0" ]] && [[ $sc2 == "0" ]] && [[ $sc3 == "0" ]]; then + #echo "not rechargable. skipping." + echo "nop." + ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key + break + fi + + # check if need to eat cube + if [[ $sc0 == "90" ]] && [[ $sc1 != "90" ]] && [[ $sc2 != "90" ]] && [[ $sc3 != "90" ]]; then + #echo -n "eating powercube + " + echo -n "epc " + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops" + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "power cubes" (assuming "portal keys" is selected) + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 51 1580 # click item slider left + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on cube + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "use" + + # restore previous position. + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 950 150 # click "ops" + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1700 # click on category slider in inventory + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 300 1300 # click on "portal keys" (assuming "power cubes" is selected) + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 550 900 # click on key + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 200 1840 # click "recharge" -> open recharge screen + fi + + # finally recharge portal + #echo "recharging..." + echo -n "r$rr " + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 250 1700 # click "recharge all" + ~/Android/Sdk/platform-tools/adb shell input touchscreen tap 850 1700 # click "done" + ~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # unclick key + done + + # move to next key + ~/Android/Sdk/platform-tools/adb shell input touchscreen swipe 840 900 350 900 1500 # swipe to next key +done + +# DONE: close inv +#~/Android/Sdk/platform-tools/adb shell input keyevent KEYCODE_BACK # close inv + -- 2.43.0