view usebot.sh @ 273:f81c4f9d267f

make the travel time is sort by distance
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 01 Dec 2008 14:23:08 +0800
parents 34ebf346f5b9
children
line wrap: on
line source

#!/bin/bash
#Auther: billy3321
#Version: 0.1
#Interface for Eagle-Eye ikariam bot project
#for more information please visit
# https://www.assembla.com/wiki/show/eagle-eye

function seteagleeye() {
read -p "Enter your server ( s1/s2/s3/s4 ): " SER_NAME
read -p "Enter your account: " ACC_NAME
read -p "Enter your password: " PW_NAME
echo -e "package main;\n\n\$::server = \"${SER_NAME}.ikariam.tw\";\n\$::user = \"${ACC_NAME}\";\n\$::pass = \"${PW_NAME}\";\n\n1;" > ${HOME}/.eagleeye.pm
}

function chihchunloop() {
read -p "Please enter the coordinate you want to fight(ex: 39:49)" SITE
SITE_X=$(echo $SITE | cut -d : -f 1)
SITE_Y=$(echo $SITE | cut -d : -f 2)
while : ; do 
    perl agent.pl
     
    perl scan.pl
 
    let RAN_X=$RANDOM%100
    let RAN_Y=$RANDOM%100
    perl scan.pl $RAN_X $RAN_Y
      
    perl warfare.pl $SITE_X $SITE_Y
done
}

echo "Checking for Database..."
if test -f ikariam.sqlite;then
	echo "Find Database, continue..."
else
	echo "setting up database...."
	cat ikariam.sql | sqlite3 ikariam.sqlite
	echo "Database Setting finished. Continue Program..."
fi

echo "Checking for account information file..."
if test -f ${HOME}/.eagleeye.pm ; then
	echo "Find your account information file. Continue Program..."
else
	echo "Can't find your account information file. We will creat one"
	seteagleeye
	
fi

while true
do
	echo -e "Welcome to use eagle-eye ikariam bot. Please select the action you want to do.\n 1. Reset the account information file.\n 2. Reset the databse.\n 3. Scan around your island.\n 4. Run the bot.\n 5. List the sheeps(Please scan first).\n 6. Chihchun's loop, automatic scan and attack sheep.\n 0. Exit Program."
	
	read -p "What do you want to do now? Please enter the number:" ACT
	case $ACT in
	 "1")
	    seteagleeye
	    ;;
	 "2")
	    rm ikariam.sqlite
	    cat ikariam.sql | sqlite3 ikariam.sqlite
	    ;;
	 "3")
	    perl scan.pl
	    ;;
	 "4")
	    perl agent.pl
	    ;;
	 "5")
	    perl sheep.pl
	    ;;
	 "6")
	    chihchunloop
	    ;;
	 "0")
	    break
	    ;;
	 *)
	    echo "Please enter a number."
	    ;;
	 esac
done


#END