Skip to content

Instantly share code, notes, and snippets.

@fuchsi
Last active December 18, 2015 09:48
Show Gist options
  • Save fuchsi/5763478 to your computer and use it in GitHub Desktop.
Save fuchsi/5763478 to your computer and use it in GitHub Desktop.
Ingress Item Drop and Recycle Script
#!/bin/bash
#
# Ingress Item Drop
#
# display coordinates x/y (Nexus 5)
#
# OPS: 970x170
# Item: 550x770
# Drop: 700x1700
# Recycle: 930x1700
#
# Usage Function :P
usage() {
echo "Usage: $0 drop|recycle <count>"
exit 1
}
pos_ops="970 170"
pos_item="550 770"
pos_drop="700 1700"
pos_recycle="930 1700"
# Item Drop
drop() {
while [ $x -lt $to_drop ]; do
input tap $pos_ops
sleep 0.2
input tap $pos_item
sleep 0.2
input tap $pos_drop
sleep 0.4
echo "dropped $x of $to_drop"
(( x++ )); done
}
# Item Recycle
#
# Needed an own function because recycle doesn't return to the main screen
recycle() {
input tap $pos_ops
while [ $x -lt $to_drop ]; do
input tap $pos_item
sleep 0.5
input tap $pos_recycle
sleep 1
echo "recycled $x of $to_drop"
(( x++ )); done
}
if [ $USER != "root" ]; then
echo "you need root to execute this script!"
exit
fi
if [ $# -lt 2 ]; then
usage
fi
# Drop Mode. recycle or drop
mode=${1-"drop"}
# Number of items to drop
to_drop=$2
# Counter
x=0
if [ $to_drop -lt 1 ]; then
usage
fi
if [ $mode == "drop" ]; then
drop
elif [ $mode == "recycle" ]; then
recycle
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment