1.0.8 • Published 3 years ago

ts-triton v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

ts-triton

A typescript client for the unpublished API for Neptune's Pride II: Triton (https://np.ironhelmet.com/)

The base mechanics were adapted from phpTriton and then built on top of, like adding the capability of giving carriers orders.

Usage

You can initialize the client, authenticate, and get a game like the following:

import {TritonClient} from "ts-triton";

const client = new TritonClient('alias', 'password');
if (await client.authenticate()) {
    const game = client.getGame('game id');
}

From there you can use the functions inside the game object to interact with the game, such as getting data and sending orders.

Classes

TritonClient(alias: string, password: string, version: number = 7)

  • authenticate() - authenticates the player credentials, return true on success
  • getGame(gameId: string) - returns a TritonGame object to interact with the game that has that ID
  • getServer() - returns a TritonServer object to interact with the player details

TritonServer(client: TritonClient)

  • getPlayer() - returns the player information
  • getOpenGames() - returns the open game information

TritonGame(client: TritonClient, gameId: string)

  • getFullUniverse() - returns game universe information
  • getIntel() - returns intel statistics
  • getUnreadCount() - returns the amount of unread messages
  • getPlayerAchievements() - returns the player achievement information
  • getDiplomacyMessages(count: number, offset: number = 0) - returns the player's diplomacy messages
  • getEventMessages(count: number, offset: number = 0) - returns the player's event messages
  • readMessage(messageKey: string) - marks a message as read
  • buyEconomy(star: string, price: number) - upgrade the economy on a planet
  • buyIndustry(star: string, price: number) - upgrade the industry on a planet
  • buyScience(star: string, price: number) - upgrade the science on a planet
  • giveShipOrder(shipId: number, orders: ShipOrder[]) - give orders to ship carriers
  • getStarsInDistance(starId: number): Star[] - Get the stars in travel distance of another star for you
  • getDistanceBetweenStars(startStarId: number, endStarId: number) - Get the distance between two stars
  • findPathToStar(startStarId: number, endStarId: number, allowedToCrossOtherPlayers: boolean = false, otherPlayerWeightMultiplied: number = 2) - Find a path of stars from one star to another
1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.2-beta.1

3 years ago

1.0.2-beta.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago