ts-triton
v1.0.8
Published
A typescript client for the unpublished API for Neptune's Pride II: Triton (https://np.ironhelmet.com/)
Downloads
3
Readme
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 successgetGame(gameId: string)
- returns aTritonGame
object to interact with the game that has that IDgetServer()
- returns aTritonServer
object to interact with the player details
TritonServer(client: TritonClient)
getPlayer()
- returns the player informationgetOpenGames()
- returns the open game information
TritonGame(client: TritonClient, gameId: string)
getFullUniverse()
- returns game universe informationgetIntel()
- returns intel statisticsgetUnreadCount()
- returns the amount of unread messagesgetPlayerAchievements()
- returns the player achievement informationgetDiplomacyMessages(count: number, offset: number = 0)
- returns the player's diplomacy messagesgetEventMessages(count: number, offset: number = 0)
- returns the player's event messagesreadMessage(messageKey: string)
- marks a message as readbuyEconomy(star: string, price: number)
- upgrade the economy on a planetbuyIndustry(star: string, price: number)
- upgrade the industry on a planetbuyScience(star: string, price: number)
- upgrade the science on a planetgiveShipOrder(shipId: number, orders: ShipOrder[])
- give orders to ship carriersgetStarsInDistance(starId: number): Star[]
- Get the stars in travel distance of another star for yougetDistanceBetweenStars(startStarId: number, endStarId: number)
- Get the distance between two starsfindPathToStar(startStarId: number, endStarId: number, allowedToCrossOtherPlayers: boolean = false, otherPlayerWeightMultiplied: number = 2)
- Find a path of stars from one star to another