Options
All
  • Public
  • Public/Protected
  • All
Menu

nrelay

Index

Type aliases

MapTile

MapTile: GroundTileData & object

A ground tile with some additional info.

ObjectEventListener

ObjectEventListener: function

An event listener for events emitted by the ObjectTracker.

Type declaration

    • (obj: ObjectData, client: Client): void
    • Parameters

      • obj: ObjectData
      • client: Client

      Returns void

PetEventListener

PetEventListener: function

An event listener for events emitted by the PetTracker.

Type declaration

PlayerEventListener

PlayerEventListener: function

An event listener for events emitted by the PlayerTracker.

Type declaration

Type

Type: object

A type which can be created using new syntax.

example

function create(type: Type): T { return new type(); }

Type declaration

Variables

Const ACCOUNT_INFO_REGEX

ACCOUNT_INFO_REGEX: RegExp = /<Chars nextCharId="(\d+)" maxNumChars="(\d+)">(?:<Char id="(\d+)">)*/

Const ACCOUNT_IN_USE

ACCOUNT_IN_USE: "ACCOUNT_IN_USE" = "ACCOUNT_IN_USE"

The name given to all AccountInUseErrors.

Const ACCOUNT_IN_USE_REGEX

ACCOUNT_IN_USE_REGEX: RegExp = /Account in use \((\d+) seconds? until timeout\)/

Const ACC_IN_USE

ACC_IN_USE: RegExp = /Account in use \((\d+) seconds? until timeout\)/

Const ASSET_ENDPOINT

ASSET_ENDPOINT: "https://static.drips.pw/rotmg/production" = "https://static.drips.pw/rotmg/production"

The endpoint used to retreive the latest resources.

Const CLIENT_DL_ENDPOINT

CLIENT_DL_ENDPOINT: "https://www.realmofthemadgod.com/AssembleeGameClient{{version}}.swf" = "https://www.realmofthemadgod.com/AssembleeGameClient{{version}}.swf"

The endpoint used to retrieve the latest client. {{version}} needs to be replaced with the current version before use.

example

const downloadPath = CLIENT_DL_ENDPOINT.replace('{{version}}', currentVersion);

Const CLIENT_VERSION_ENDPOINT

CLIENT_VERSION_ENDPOINT: "https://www.realmofthemadgod.com/version.txt" = "https://www.realmofthemadgod.com/version.txt"

The endpoint used to check the version of the latest client.

Const DEFAULT_PORT

DEFAULT_PORT: 5680 = 5680

Const EMAIL_REPLACE_REGEX

EMAIL_REPLACE_REGEX: RegExp = /.+?(.+?)(?:@|\+\d+).+?(.+?)\./

A regular expression which matches the local part and domain of an email address.

Const ERROR_REGEX

ERROR_REGEX: RegExp = /<Error\/?>(.+)<\/?Error>/

Const GITHUB_CONTENT_ENDPOINT

GITHUB_CONTENT_ENDPOINT: "https://api.github.com/repos/thomas-crane/nrelay/contents" = "https://api.github.com/repos/thomas-crane/nrelay/contents"

The endpoint used to retreive file contents from the main nrelay repository.

Const MAX_ATTACK_FREQ

MAX_ATTACK_FREQ: 0.008 = 0.008

Const MAX_ATTACK_MULT

MAX_ATTACK_MULT: 2 = 2

Const MAX_MOVE_SPEED

MAX_MOVE_SPEED: 0.0096 = 0.0096

Const MIN_ATTACK_FREQ

MIN_ATTACK_FREQ: 0.0015 = 0.0015

Const MIN_ATTACK_MULT

MIN_ATTACK_MULT: 0.5 = 0.5

Const MIN_MOVE_SPEED

MIN_MOVE_SPEED: 0.004 = 0.004

Const MIN_TIME

MIN_TIME: 2000 = 2000

Const PLUGIN_REGEX

PLUGIN_REGEX: RegExp = /\.js$/

Const PUBLIC_KEY

PUBLIC_KEY: string = '-----BEGIN PUBLIC KEY-----\n' +'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCKFctVrhfF3m2Kes0FBL/JFeO' +'cmNg9eJz8k/hQy1kadD+XFUpluRqa//Uxp2s9W2qE0EoUCu59ugcf/p7lGuL99Uo' +'SGmQEynkBvZct+/M40L0E0rZ4BVgzLOJmIbXMp0J4PnPcb6VLZvxazGcmSfjauC7' +'F3yWYqUbZd/HCBtawwIDAQAB\n' +'-----END PUBLIC KEY-----'

Const SERVER_ENDPOINT

SERVER_ENDPOINT: "https://realmofthemadgodhrd.appspot.com/char/list" = "https://realmofthemadgodhrd.appspot.com/char/list"

The endpoint used to retreive the list of servers and the character information about an account.

Const SERVER_REGEX

SERVER_REGEX: RegExp = /<Server><Name>(\w+)<\/Name><DNS>(\d+\.\d+\.\d+\.\d+)<\/DNS>/g

Const VALID_PACKET_HOOKS

VALID_PACKET_HOOKS: string[] = Object.keys(incomingPackets)

A list of all packet types that are valid for a packet hook.

Const hooks

hooks: Array<HookInfo<any>> = []

Const libraries

libraries: Array<LoadedLib<any>> = []

Const schedules

schedules: Map<any, any> = new Map()

Functions

Library

  • Indicates that the decorated class is a Library which may contain packet hooks.

    Parameters

    Returns ClassDecorator

PacketHook

  • PacketHook(): MethodDecorator
  • Indicates that the decorated method should be called when it's packet type is received by a client.

    Returns MethodDecorator

censorGuid

  • censorGuid(guid: string): string
  • Replaces the local part and domain of an email address with asterisks. This is generally used to avoid leaking information through log files.

    Parameters

    • guid: string

      The guid to censor.

    Returns string

createConnection

  • createConnection(host: string, port: number, proxy?: Proxy): Promise<Socket>
  • Creates a connection to the specified host and port, optionally through a provided proxy. Returns a promise which is resolved when the connection has been established.

    Parameters

    • host: string

      The host to connect to.

    • port: number

      The port to connect to.

    • Optional proxy: Proxy

      An optional proxy to use when connecting.

    Returns Promise<Socket>

delay

  • delay(ms: number): Promise<void>
  • Returns a promise which resolves after ms milliseconds.

    Parameters

    • ms: number

      The number of milliseconds to wait.

    Returns Promise<void>

encrypt

  • encrypt(msg: string): string
  • Encrypts the text with a hard-coded public key.

    Parameters

    • msg: string

      The text to encrypt.

    Returns string

getDefaultPlayerData

  • Returns a PlayerData object with default properties.

    deprecated

    Prefer const data = {} as PlayerData; to create new PlayerData objects.

    Returns PlayerData

getDescription

  • getDescription(target: object, key: string | symbol, params: string[]): string

getHooks

getLibs

getTime

  • getTime(): string

getWaitTime

  • getWaitTime(host: string): number
  • Generates a suitable amount of time to wait before initiating a connection to ensure the game server is not overloaded. Connecting too quickly can result in connections being rejected.

    Parameters

    • host: string

      The host to get the wait time for.

    Returns number

hasEffect

  • Determines whether or not the given condition value has the effect bit set.

    example

    const isDazed = hasEffect(this.condition, ConditionEffect.DAZED);

    Parameters

    • condition: number

      The condition stat to check.

    • effect: ConditionEffect

      The effect to determine if the condition value has or not.

    Returns boolean

insideSquare

  • insideSquare<T>(point: T, squarePoint: T, squareSize: number): boolean
  • Checks whether or not the point falls inside of a square of size squareSize with its center at squarePoint.

    Type parameters

    • T: Point

    Parameters

    • point: T

      The point to check.

    • squarePoint: T

      The square which the point might be inside of.

    • squareSize: number

      The size of the square.

    Returns boolean

pad

  • pad(str: string, paddingLength: number): string
  • Returns a string which is at least paddingLength characters long, which contains the original str and spaces to fill the remaining space if there is any.

    Parameters

    • str: string

      The string to pad.

    • paddingLength: number

      The number of spaces to add.

    Returns string

parseAccountInfo

parseServers

  • Parses the server list XML into a dictionary of servers keyed by server name.

    Parameters

    • xml: string

      The XML to parse.

    Returns ServerList

processObject

  • Processes the data and returns the resulting PlayerData object.

    Parameters

    • data: ObjectData

      The data to process.

    Returns PlayerData

processObjectStatus

  • Processes the data and returns the result. If currentData is provided, it will be used as a starting point for the returned PlayerData.

    Parameters

    • data: ObjectStatusData

      The data to process.

    • Optional currentData: PlayerData

      The existing PlayerData.

    Returns PlayerData

processStatData

  • Process a list of stats and returns the result. If currentData is provided, it will be used as a starting point for the returned PlayerData.

    Parameters

    • stats: StatData[]

      The stats to process.

    • Optional currentData: PlayerData

      The existing PlayerData.

    Returns PlayerData

Object literals

Const REQUEST_HEADERS

REQUEST_HEADERS: object

The HTTP headers to include in each request.

Accept

Accept: string = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"

Accept-Encoding

Accept-Encoding: string = "gzip, deflate"

Cache-Control

Cache-Control: string = "max-age=0"

Connection

Connection: string = "keep-alive"

User-Agent

User-Agent: string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"

Const environment

environment: object

Configuration settings which affect how nrelay behaves.

debug

debug: boolean = false

Whether or not to provide a higher detail of logging.

loadPlugins

loadPlugins: boolean = true

Whether or not to load plugins from the default path.

log

log: boolean = true

Whether or not to enable the FileLogger (save logs to a file).

Generated using TypeDoc