Ghost Trappers - Simple Autohunt

Easy and simple autohunt script for the Ghost Trappers Facebook Game

Mint 2014.06.24.. Lásd a legutóbbi verzió

// ==UserScript==
// @name           Ghost Trappers - Simple Autohunt
// @author         GTDevsSuck
// @namespace      Original versions by Jaryl & iispyderii
// @version        2.00
// @description    Easy and simple autohunt script for the Ghost Trappers Facebook Game
// @include        http*://www.ghost-trappers.com/fb/*
// @include        http*://gt-1.diviad.com/fb/*
// @exclude        http*://www.ghost-trappers.com/fb/live_feed*
// @exclude        http*://gt-1.diviad.com/fb/live_feed*
// @exclude        http*://www.ghost-trappers.com/fb/donate.php*
// @exclude        http*://gt-1.diviad.com/fb/donate.php*
// @history        2.00 ::: Revamped code, faster hunts, better titles, doesn't run on donate page.
// @history        2.00 ::: Maintenance page refresh. Monster notification. Hunting animation.
// @history        1.40 ::: Fixed FB autohunt
// @history        1.30 ::: Reduced low bait count
// @history        1.22 ::: Fixed white page refresh error
// @history        1.21 ::: Stops when bait is less than 10
// @history        1.12 ::: Pointer to captcha box
// @history        1.10 ::: Included notif when Captcha
// @history        1.01 ::: Excluded livefeed page
// @history        1.00 ::: Edited from FB - Ghost Trappers Smart Autohunt V2 ::: Made Very Easy
// ==/UserScript==


// ****** Extended Description ******
// 
// Welcome to the new and fun way to play Ghost Trappers!
// 
// This script is a simple and easy to use Ghost Trappers auto-hunter.
// 
// Works on Chrome, Firefox, Comodo Dragon and Chromium web browsers. No configuration needed, just enable the script and you will catch ghosts like never before!!!
// 
// If you care for your fellow ghost trappers, then rate and share this script. Everyone needs to play GT like the top 100+ do. Take care: Only share with people you truly trust and never admit to using it if confronted. Use an anonymous source if needed.
// 
// New in version 2:
// Monster encounter notifier. When you encounter a monster on the next hunt, you get an alert.
// Revamped code, faster hunts!
// Does not run on "donate" pages.
// Maintenance page refreshes every 20 seconds.
// Goes back to camp automatically after captcha input.
// Slight change to titles, added animation.
// 
// This Script has been greatly modified from the very popular autohunt script: 
// FB - Ghost Trappers Smart Autohunt V2 [by iispyderii & Jaryl].
// 
// Changes made to the original script:
// Added a Captcha notifier.
// Fixed hover over icon dropdown menus on Chrome and Comodo.
// Changed the title of tabs to more short "Hunting in ..." and "Captcha".
// Does not hunt from Live-feed page so you can use the LF script linked below.
// Refreshes every 20 seconds on maintenance page.
// Autocaptcha disabled (it was not working all the time, so you do not get caught).
// Removed useless/not working content: Monster assist, Daily Clicks, and Menu/Settings details at the top of every page.
// Fixed animation program on Chrome.
// 
// Don't get caught!!! Take precautions:
// Use this script adequately and you should be fine. SO do NOT be hunting 24 hours straight and DO take short "breaks".
// Keep one page open when using this script, many pages will try to hunt many times. [Might lead to excess hunts and stuck monsters].
// Do not screenshot showing the tab title - VERY important.
// 
// Goodies: 
// Here is a really good script for auto livefeed assist: 
// http://userscripts.org:8080/scripts/show/153781
// 
// And this is the best script for Mousehunt hunting: 
// http://userscripts.org:8080/scripts/show/78731
// 
// * Update: 
// Chrome's latest update does not allow scripts to be loaded manually if they are not from the Google App Store, to fix that you will need to install Tampermonkey from the Google App Store. With Tampermonkey enabled, you can click install on this page to install the script.
// 
// Alternatively, you can install scripts the old way in Comodo Dragon, which is another good browser based on Chromium (as is Chrome).
// 
// Keywords: 
// ghost trappers autohunt ghosttrappers auto hunt ghosts ghost trapper trappers auto hunt autohunt autobot auto bot botter smart autohunt simple ah ghost monster livefeed monsters live feed captcha entry automatic hunting ghost trappers auto hunting ghosts javascript script tampermonkey greasemonkey easy
// 
// ****** End Extended Description ******

var titlePlaceHolder = "";

if (document.body.innerHTML.match(/currently doing maintenance and will be back in a few minutes/))
{
	titlePlaceHolder = "Maintenance - Refreshing in 20 seconds";
    window.setTimeout(function() {window.location.href = "http://www.ghost-trappers.com/fb/camp.php";}, 20000);
}
else if (document.body.innerHTML.match(/code has been entered correctly/)) 
{
    titlePlaceHolder = "Returning to Camp";
    window.setTimeout(function() {window.location.href = "http://www.ghost-trappers.com/fb/camp.php";}, 1500);
}
else if (document.getElementsByName("captcha_id")[0])
{
	titlePlaceHolder = "Captcha" ;
	document.getElementsByName('captcha_entered_text')[0].focus();
    setTimeout(function() {alert("Captcha has arrived!");}, 8500);
}
else
{
	var link = document.getElementById('topHuntActive').firstElementChild.href;
    var drinkCount = document.getElementById('profile_whisky_quantity').textContent;
    
    if (drinkCount <= 6)
    {
        titlePlaceHolder = "REFILL! Low Potions";
        setTimeout(function() {alert("Yikes, you are short on bait!");}, 12500);
	}
	else if (link != -1)
	{
        var minutesid, secondsid;
        
		if (document.getElementById('topHuntSeconds') != null)
		{
			minutesid = document.getElementById('topHuntMinutes').innerHTML;
			secondsid = document.getElementById('topHuntSeconds').innerHTML;
		} 
		else if (document.getElementById('topHuntMinutes') === null)
		{
			minutesid = 0;
			secondsid = 0;
		}
			
		var minutes = parseInt(minutesid, 10);
		var seconds = parseInt(secondsid, 10);
		var timeoutvalue = (minutes * 60 + seconds) * 1000 + 300;
        
		if (document.getElementsByClassName('logText')[0])
		{
            var checkMonster = document.getElementsByClassName('logText')[0].innerHTML;
		    if (checkMonster.match(/This ghost monster is too strong for you alone/))
			{
    			setTimeout(function(){alert("You got a monster, you might want to send it to live feed (or remove it "
                                           + "with irrelevance).\n\nGood luck!");}, 1500);
			}
        }

		if (minutes <= 0 && seconds <= 0)
		{
			document.location = link;
            titlePlaceHolder = "Hunting Now!";
		}
		else
		{
			setTimeout(function() {document.location = link;}, timeoutvalue);
		}
	}
	else
	{
		titlePlaceHolder = "Something's up, Refreshing in 5 minutes";
		setTimeout(function() {document.location = 'http://www.ghost-trappers.com/fb/camp.php';}, 300000);
    }
}
UpdateTitle();



function UpdateTitle()
{
	if (titlePlaceHolder == "")
    {
        var minutesid, secondsid, mins, secs, r954, r952;
        
		if (document.getElementById('topHuntMinutes') != null)
		{
			minutesid = document.getElementById('topHuntMinutes').innerHTML;
			secondsid = document.getElementById('topHuntSeconds').innerHTML;
		} 
		else if (document.getElementById('topHuntMinutes') === null)
		{
			minutesid = '0';
			secondsid = '0';
		}
		
        mins = parseInt(minutesid, 10);
		secs = parseInt(secondsid, 10);
		
		if (mins < 10)
		{mins = "0" + mins;}
		if (secs < 10)
		{secs = "0" + secs;}
        
        if (mins === "00" && secs === "00")
        {document.title = "Hunting Now!";}
		else
        {document.title = "Hunting in " + mins + ':' + secs;}
        
        if (mins === '00' && secondsid % 60 === 29) {document.title = document.title + " " + " (, 00)"}
        else if (mins === '00' && secondsid % 60 === 28) {document.title = document.title + " " + "   (, 00)"}
        else if (mins === '00' && secondsid % 60 === 27) {document.title = document.title + " " + " (, 00)"}
        else if (mins === '00' && secondsid % 60 === 26) {document.title = document.title + " " + "   (, 00)"}
        else if (mins === '00' && secondsid % 60 === 25) {document.title = document.title + " " + " (, 00)"}
        else if (mins === '00' && secondsid % 60 === 24) {document.title = document.title + " " + "   (, 00)"}
        else if (mins === '00' && secondsid % 60 === 23) {document.title = document.title + " " + " (, 00)"}
        else if (mins === '00' && secondsid % 60 === 22) {document.title = document.title + " " + "   (, 00)"}
        else if (mins === '00' && secondsid % 60 === 21) {document.title = document.title + " " + " (, 00)"}
        else if (mins === '00' && secondsid % 60 === 20) {document.title = document.title + " " + " (00 , )"}
        else if (mins === '00' && secondsid % 60 === 19) {document.title = document.title + " " + "  :::>"}
        else if (mins === '00' && secondsid % 60 === 18) {document.title = document.title + " " + "  ]:::::>"}
        else if (mins === '00' && secondsid % 60 === 17) {document.title = document.title + " " + "  =[]::::::>"}
        else if (mins === '00' && secondsid % 60 === 16) {document.title = document.title + " " + " o==[]::::"}
        else if (mins === '00' && secondsid % 60 === 15) {document.title = document.title + " " + "  v(' .' )v"}
        else if (mins === '00' && secondsid % 60 === 14) {document.title = document.title + " " + "  v( ‘.’ )v"}
        else if (mins === '00' && secondsid % 60 === 13) {document.title = document.title + " " + "  v( ‘o’ )v"}
        else if (mins === '00' && secondsid % 60 === 12) {document.title = document.title + " " + "  (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 11) {document.title = document.title + " " + "    (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 10) {document.title = document.title + " " + "      (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 9) {document.title = document.title + " " + "  ::>    (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 8) {document.title = document.title + " " + "  :::>    (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 7) {document.title = document.title + " " + "  ::>    (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 6) {document.title = document.title + " " + "  ::>  (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 5) {document.title = document.title + " " + "  ::> (>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 4) {document.title = document.title + " " + "  ::>(>‘o’)>"}
        else if (mins === '00' && secondsid % 60 === 3) {document.title = document.title + " " + "  ( つ﹏╰)"}
        else if (mins === '00' && secondsid % 60 === 2) {document.title = document.title + " " + "  ( つ﹏╰)"}
        else if (mins === '00' && secondsid % 60 === 1) {document.title = document.title + " " + "  ( つ﹏╰) <Take my loot)"}
	}
	else
	{
		document.title = titlePlaceHolder;
	}
	setTimeout(UpdateTitle, 1000);
}