Skip to content

Instantly share code, notes, and snippets.

@sorgo
Forked from fuchsi/ingress_item_drop.sh
Last active December 19, 2015 23:58
Show Gist options
  • Save sorgo/6037684 to your computer and use it in GitHub Desktop.
Save sorgo/6037684 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Ingress Item Drop
#
# Display Koordinaten x/y (Galaxy S III)
#
# OPS: 640x110
# Item: 400x600
# Drop: 360x1200
# Recycle: 580x1200
#
# Usage Function :P
usage() {
echo "Usage: $0 drop|recycle <count>"
exit 1
}
# Item Drop
drop() {
while [ $x -lt $to_drop ]; do
RUNNING="$(ps -P | grep nianticproject | awk '{print $6}')"
if [$RUNNING == 'fg']; then
input tap 640 110
input tap 400 600
input tap 360 1200
fi
(( x++ )); done
}
# Item Recycle
#
# Needed an own function because recycle doesn't return to the main screen
recycle() {
input tap 640 110
while [ $x -lt $to_drop ]; do
RUNNING="$(ps -P | grep nianticproject | awk '{print $6}')"
if [$RUNNING == 'fg']; then
input tap 400 600
input tap 580 1200
fi
(( 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