Socket
Socket
Sign inDemoInstall

grepolis-js

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grepolis-js

Grepolis api for node.js


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 29 Jul 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc