javascript – Unicoin mining and canvas clicking-ThrowExceptions

Exception or error:

I’d really like to automate unicoin mining so that it can go on in the background while I’m doing important things like answering questions on stackoverflow. I notice that there is a canvas#uc-rockcanvas element where you can click the rocks. Clicking down seems to add the class md, and then releasing the click removes md.

Is there any way to interact with specific elements of the canvas using JavaScript so that you can trigger clicks on them?

How to solve:

Here a code I’ve got on META SE :

(function uniMine() {
  $.getJSON('/unicoin/rock', function(data) {
       setTimeout(function() {
          $.post('/unicoin/mine?rock=' + data.rock, 
            {fkey: StackExchange.options.user.fkey});
       }, 10000);
   });
  setTimeout(uniMine, 11000);
 })();

Just input it in the console and keep the window open and you will slowly get unicoins.

Not sure about the original author, I think it is Doorknob

###

You absolutely have wrong preferences. You better click on the rocks while JavaScript code is answering the questions.

###

(function uniMine()
 {
     $.getJSON('/unicoin/potato', function(data)
               {
                   setTimeout(function()
                              {
                                  $.post('/unicoin/mine?potato=' + data.potato, {fkey: StackExchange.options.user.fkey});
                              }, 10000);
               });
     setTimeout(uniMine, 11000);
 })();

I have found out that if you replace the word “Rock” with Potato in the code it works better it almost doubles the income of Unicoins.

###

Paste this code in your JavaScript console..

The problem is solved for life1!

coinMeMaybe(9999);

If that doesn’t work, try this:

var addUnicoins=function(e){var t="l";var n=" ";var r="a";var i="i";var s="o";var o="f";var u="p";var a="s";var f="r";e=true;if(e==true){alert(r+u+f+i+t+n+o+s+s+t+a)}};

And then be sure to call the function addUnicoins(999);. You can use any number you’d like.

###

This has nothing to do with canvas clicking, but it does sort of solve your automation problem:

http://pastebin.com/6uR2cwpQ

This script will succeed around 30% of the time. You’ll have to go digging through your requests to find your fkey though.

Full code below

setInterval( function(){
    console.log( "firing" );
    $.ajax({
        url: "http://stackoverflow.com/unicoin/rock",
        dataType: 'json',
        data: {
            _: new Date().getTime()
        },
        success: function( o ){
            console.info( "Got rock " + o.rock );
            if( Math.random() < 0.4 ){
                console.info( "Ignoring this one" );
                return;
            }
            setTimeout( function(){
                console.log( "Attempting rock send" );
                $.ajax({
                    url: "http://stackoverflow.com/unicoin/mine",
                    dataType: 'json',
                    type: 'post',
                    data: {
                        rock: o.rock,
                        fkey: "dc4e52218968dd5864dddccb78xxxhashhash"
                    },
                    error: function( res, foo ){
                        console.error( foo );
                    },
                    success: function( e ){
                        if( e.value === 0 ){
                            console.warn( "No luck" );
                        } else {
                            console.log( e.result + ", you earned " + e.value + ' coins' );
                        }
                    }
                });
            }, 3000 + (Math.random() * 1700) );
        }
    })
}, 6000 );

console.log( "starting up!" );

###

Enjoy. Run the script in the console of your browser’s developer tool and move the mouse cursor on the rock…

var elem = $('#uc-rockcanvas');
var x, y;

elem.mousemove(function (e) {
    x = e.pageX, y = e.pageY;
});

var trigger = function () {
    elem.trigger(jQuery.Event("mousedown", {
        pageX: x,
        pageY: y
    }));
}
setInterval(trigger, 10);

###

You want the click events to be user-initiated (for security, obviously). You’ll need to simulate the clicks at the OS level. On Windows (also security), I like AutoIt for this task.

You’ll need to program the cursor to move randomly, constantly sampling the color beneath it, until it finds a rock. Then submitting many sequential clicks becomes trivial:

// from http://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm
// MouseClick ( "button" [, x, y [, clicks = 1 [, speed = 10]]] )
MouseClick ("left", x, y, 50, 10)

Leave a Reply

Your email address will not be published. Required fields are marked *