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.

Revisions

  1. jarekb84 created this gist Oct 31, 2013.
    53 changes: 53 additions & 0 deletions goldenminerJunkSeller.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    (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);
    }());