FANDOM


There are several ways to get info from the game.

The one is via Console.

The other is via WebSocket.

Examples Edit

There have been already examples of using several methods to enhance usability.

The links with some code examples:

You might a well look through the code used in Userscripts (first link), which might help you a bit.

Ways to work with information Edit

Here are the ways.

Console Edit

1) In battle

redis = new Meteor.RedisCollection('redis');
JSON.parse(redis.matching('*').fetch()[0].value)

(maybe there are some other RedisCollection s?)

2) Not in battle

Meteor.connection._mongo_livedata_collections. ...

For example,

Meteor.connection._mongo_livedata_collections.items.find().fetch())

Instead of Items there are some other useful things (might give you from exact time the crafting ends + what you craft/inscript + experience you get per crafting / farming / mining anything).

Use copy(Meteor.connection._mongo_livedata_collections.items.find().fetch())) to copy the contents to the clipboard!

WebSocket Edit

The question is whether everything can be retrieved in a way mentioned before?

Anyway, listening to the WebSocket might help.

Here is the code to start tracking WebSocket (thx, Aes Sedai)!

// ==UserScript==
// @name         Meteor Monitor
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  description
// @author       You
// @match        http*://*.eternitytower.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if (Meteor.isClient) {

        window.logger = {
            active: true
        };

        // log sent messages
        var _send = Meteor.connection._send;
        Meteor.connection._send = function (obj) {
            if (window.logger.active) console.log("send", obj);
            _send.call(this, obj);
        };

        // log received messages
        Meteor.connection._stream.on('message', function (message) {
            if (window.logger.active) console.log("receive", JSON.parse(message));
        });
    }
})();

It is used for TamperMonkey. But you can just paste the whole function() to console, and it will work! It will be pasting via console.log() all the messages.

How to stop that stream?

Write in console:

window.logger.active = false

Question is

Can we, for example, paste it not to console.log, but ... to push everything we logging to an array instead?

...