Created
December 1, 2012 04:23
-
-
Save ljepson/4180536 to your computer and use it in GitHub Desktop.
GodvilleGame.com Autobot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var godville = { | |
delay: 3000, | |
init: function() { | |
$('body').append('<aside id="autobot">'); | |
$('#autobot').append('<p>Select an option from below to start botting</p>'); | |
$('#autobot').append('<input type="radio" id="auto_encourage" name="autobot"><label for="auto_encourage">Automatically encourage</label>'); | |
$('#autobot').append('<input type="radio" id="auto_punish" name="autobot"><label for="auto_punish">Automatically punish</label>'); | |
$('#autobot').append('<button>Stop autoing</button>'); | |
$('#autobot').css({ | |
background: 'rgba(255,255,255,.45)', | |
width: '330px', | |
padding: '15px 0 15px 20px', | |
border: '1px solid #CCC', | |
'border-radius': '10px', | |
'box-sizing': 'border-box', | |
'font-size': '12px', | |
position: 'absolute', | |
top: '40px', | |
right: '10px' | |
}); | |
$('#autobot input[type="radio"],#autobot label').css({float: 'left', margin: '3px 0'}); | |
$('#autobot input[type="radio"]').css({clear: 'left', 'margin-right': '5px'}).change(function() { | |
var selection = $(this).prop('id'); | |
if(godville.interval) godville.stop(true); | |
godville.run(selection); | |
}); | |
$('#autobot button').hide().css({margin: '15px 0 0', float: 'left', clear: 'both'}).click(godville.stop); | |
}, | |
interval: '', | |
run: function(selection) { | |
var godpower = Number($('.gp_val').text().replace(/%/,'')), | |
action; | |
if(selection === 'auto_punish') { | |
action = $('.enc_link'); | |
} else { | |
action = $('.pun_link'); | |
} | |
godville.interval = setInterval(function() { | |
if(godpower > 25) { | |
action.click(); | |
} else { | |
$('#autobot p').html('You don\'t have enough Godpower.<br>Checking again in '+ (godville.delay / 1000) +' seconds.'); | |
} | |
},godville.delay); | |
$('#autobot button').show(); | |
}, | |
stop: function(instant) { | |
if(godville.interval) { | |
clearInterval(godville.interval); | |
godville.interval = ''; | |
} | |
if(!instant) { | |
$('#autobot p').empty().text('Bot has been stopped.').css('color','red'); | |
setTimeout(function() { | |
$('#autobot p').fadeOut(1000,function() { | |
$(this).text('Select an option from below to start botting').css('color','#555').show(); | |
}); | |
},5000); | |
$('#autobot input[type="radio"]').prop('checked',false); | |
$('#autobot button').hide(); | |
} | |
} | |
}; | |
godville.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment