New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

grepolis

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grepolis

Grepolis Data Utility for NodeJS

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

npm npm bundle size GitHub repo size Lines of code

Grepolis Data for NodeJS

This library provides a simple layer between Grepolis's world data files and your NodeJS project. The purpose is to provide a quick and minimal library that turns the CSV (and some JSON) data into objects that can easily be worked with in Javascript.

This library is intentionally created with zero external runtime dependencies.

Installation

npm i grepolis

Usage

Every function in the Grepolis library is named after the file which it reads (list below) to make things simple for developers working with the library. Each function returns a Promise containing the data that was read. In most cases this data is a really large array of objects. Every endpoint requires a server variable which is just an object that contains the language and world number as seen in the example code.

As of 0.2.0 the functions have been divided between World and Statistics modules which can be imported individually with named imports or can be referenced via a single require as shown below. Here is the new structure of the library:

- World
  - units
  - researches
  - buildings

- Statistics
  - towns
  - islands
  - conquers
  - players
  - playersKills
  - playersKillsAttack
  - playersKillsDefend
  - alliances
  - alliancesKills
  - alliancesKillsAttack
  - alliancesKillsDefend

Here is an example of reading towns data:

const Grepolis = require('grepolis');

/*
 * Read all towns data from en110 (Leontini)
 */
const server = { lang: 'en', world: '45' };
Grepolis.Statistics.towns(server).then((data) => {
  // data = array of towns
  // this is a huge object list
  console.log('Town Data: ', data);
});

Sample Data

Town

{
	"id": "4775",
	"playerId": "2182242",
	"name": "cash+money",
	"islandX": "496",
	"islandY": "448",
	"numberOnIsland": "5",
	"points": "12090"
}

Island

{
	"id": "117977",
	"x": "5",
	"y": "17",
	"islandType": "40",
	"availableTowns": "20",
	"resourcePlus": "wood",
	"resourceMinus": "stone"
}

Player

{
	"id": "259495",
	"name": "Thaylas",
	"allianceId": "",
	"points": "0",
	"rank": "3100",
	"towns": "0"
}

Alliance

{
	"id": "124",
	"name": "Terra+Nostrum",
	"points": "6681",
	"towns": "1",
	"members": "1",
	"rank": "146"
}

Conquer

{
	"townId": "248",
	"time": "1537879813",
	"newPlayerId": "5037454",
	"oldPlayerId": "",
	"newAllyId": "28",
	"oldAllyId": "",
	"points": "4656"
}

Kills (player, alliance)

{
	"rank": "278",
	"id": "1847",
	"points": "18"
}

Keywords

grepolis

FAQs

Package last updated on 17 Aug 2021

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