🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

grepolis-js

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grepolis-js

Grepolis api for node.js

1.3.10
latest
npm
Version published
Weekly downloads
16
-68.63%
Maintainers
1
Weekly downloads
 
Created
Source

Require

var grepojs = require("grepolis-js");

Load Alliance Data $id, $name, $points, $towns, $members, $rank

grepojs.loadAllianceData(function () {
    grepojs.data.each("SELECT points, name FROM alliances", function (err, row) {
        console.log(row.points + ": " + row.name);
    });
});

Load Player Data $id, $name, $alliance_id, $points, $rank, $towns

grepojs.loadPlayerData(function () {
    grepojs.data.each("SELECT points, name FROM players WHERE rank < 15", function (err, row) {
        console.log(row.points + ": " + row.name);
    });
});

Load Island Data $id, $x, $y, $island_type, $available_towns, $good, $bad

grepojs.loadIslandData(function () {
    grepojs.data.each("SELECT id, x, y FROM islands", function (err, row) {
        console.log(row.id + ": " + row.x + "," + row.y);
    });
});

Load Town Data $id, $player_id, $name, $island_x, $island_y, $number_on_island, $points

grepojs.loadTownData(function () {
    grepojs.data.each("SELECT player_id, name FROM towns", function (err, row) {
        console.log(row.player_id + ": " + row.name);
    });
});

You can nest the load functions

grepojs.loadPlayerData(function () {
    grepojs.loadTownData(function () {
        grepojs.data.each("SELECT player_id, name FROM towns", function (err, row) {
            grepojs.data.each("SELECT name FROM players WHERE id = " + row.player_id, function (err2, row2) {
                console.log(row2.name + ": " + row.name);
            })
        });
    });
});

You can also use grepojs.data outside of the load_data function call backs, as long as the data you want to read has already been loaded.

Load all data from the set data url

This will run he start function after all of the data has been loaded into the grepojs.data object.

function start() {
    console.log("Done Loading");
}
grepojs.load(start);

Change Data URL

grepojs.WorldDataUrl = "https://us71.grepolis.com/data/";

Keywords

grepolis

FAQs

Package last updated on 29 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts