Skip to content

Instantly share code, notes, and snippets.

@jarekb84
Created October 31, 2013 00:53
Show Gist options
  • Select an option

  • Save jarekb84/7242839 to your computer and use it in GitHub Desktop.

Select an option

Save jarekb84/7242839 to your computer and use it in GitHub Desktop.
Sells junk items automatically on the js game http://goldenminer.org Comment out the items you don't want sold, or add a new item to the array for items missing.
(function(){
//For todays date;
Date.prototype.today = function(){
return this.getFullYear() + "/" + (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate()
};
//For the time now
Date.prototype.timeNow = function(){
return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
};
var junkItems = [
['itemtype100','Tiny Ruby'],
['itemtype101','Small Ruby'],
['itemtype102','Big Ruby'],
['itemtype110','Tiny Diamond'],
['itemtype111','Small Diamond'],
['itemtype112','Big Diamond'],
['itemtype120','Tiny Amethyst'],
['itemtype121','Small Amethyst'],
//['itemtype122','Big Amethyst'],
['itemtype130','Tiny Sapphire'],
['itemtype131','Small Sapphire'],
['itemtype132','Big Sapphire'],
['itemtype140','Tiny Starstone'],
['itemtype141','Small Starstone'],
['itemtype142','Big Starstone']
]
function sellJunk(){
junkItems.every(function(item) {
var stash = document.getElementsByClassName('content box ui-sortable')[0],
found = stash.getElementsByClassName(item[0])[0];
if (found) {
var sellAction = found.getElementsByClassName('sell')[0];
sellAction.click();
var soldTime = new Date();
console.log(item[1] + " sold " + soldTime.today() + " @ " + soldTime.timeNow() );
return false;
}
return true;
});
}
var sellJunkInterval = setInterval(sellJunk, 1000);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment