Little Alchemy

Little Alchemy

README

Little Alchemy is a chemical game in the category puzzle and brain offered in the Google Chrome WebStore where you can mix elements to create others, at the beginning you have only four basic elements in your library (water, fire, earth, air), but you can mix them and create a lot more (combine them simply by dragging and dropping on each other). At this moment when I’m writing this article the game offer 360 elements in the offline version and 390 elements if you have Pokki installed on your computer.

Unfortunately Pokki doesn’t support Linux operating systems, so after some hours enjoying this game I became upset because I couldn’t get the last thirty candy like elements like Willy Wonka, then I decided to investigate the code of the game to find a way to crack it and get all the elements without install any other software. Some people have videos on Internet explaining How to hack Little Alchemy but only offer a way to Copy and Paste the Javascript code to display all the elements, this method only works if the game is not updated, so if the developers increase the amount of elements for the game, those videos will not work anymore.

Little Alchemy

How it works

The functionality of the game Little Alchemy consists basically in four files, the first of them called names.json contains the list of elements available for the game, the second called base.json includes the logic of the chemical mix between elements to create the others, the third file is the manifest.json which contains the permissions to download the images representing each elements and the file alchemy.js where the logic of the game is controlled.

When you drag one element in the laboratory of the game and drop it over other element, the game search for an alchemy mixture in the library base.json and if the mixture is found, it append an Array containing the identifier of the two parent elements and the current Timestamp into a variable called history using the engine localStorage.setItem() of HTML5.

You can check your current state pressing the keys CTRL + Shift + J in Google Chrome and writing this code in the console and pressing Intro: localStorage.getItem('history');

The code bellow encoded in Base64 has a Ruby script which after the execution in a terminal it prints the Array with all the elements updated at the time of the execution and the Javascript code necessary to display all the elements available (including the elements available in the version of the game offered by Pokki); just Copy and Paste all the code generated for the script and paste it in the Google Chrome console (it automatically will reload the page so you can see the elements after execute the code).

Little Alchemy

Code

jQuery(function($){
    var base_json = 'http://littlealchemy.com/base/base.json';
    var game = { parents: [], date: [] };

    $.getJSON( base_json, function(data){
        $.each( data['base'], function(k, elements){
            if ( elements.length && elements[0] !== false ) {
                var timestamp = new Date().getTime();
                var alchemy = elements[0];

                game.parents.push([
                    parseInt(alchemy[0]),
                    parseInt(alchemy[1])
                ]);
                game.date.push(timestamp);
            }
        } );

        localStorage.setItem( 'history', JSON.stringify(game) );
        location.reload();
    } );
});
Do you have a project idea? Let's make it together!