mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
Move to ES6 module (#357)
* Redo imports and exports for lib * Redo imports and exports for bim * Redo imports and exports for games * Remove remaining module.exports * Use export default in lib * Use export default in protocols * Fix import in genreadme.js * Make package module and solve __dirname * Fix minecraft protocol imports * Fix imports on games and make binary runnable * Renamed protocol class exports to lowercase * Export promises class as default * Update README.md to use imports instead of require * Update CHANGELOG to mention the changes. * Remove Valve unused imports * Fix iconv import
This commit is contained in:
parent
b4f6e7fab6
commit
ad9adff06c
64 changed files with 249 additions and 323 deletions
|
@ -1,6 +1,8 @@
|
|||
|
||||
### To Be Released...
|
||||
* Replaced usage of deprecated `substr` with `substring`.
|
||||
* Moved the library a `module`.
|
||||
* CLI: Resolved incorrect error message when querying with a non-existent protocol name.
|
||||
|
||||
### 4.1.0
|
||||
* Replace `compressjs` dependency by `seek-bzip` to solve some possible import issues.
|
||||
|
|
|
@ -11,13 +11,14 @@ Support is available on the [GameDig Discord](https://discord.gg/NVCMn3tnxH) (fo
|
|||
See the [GAMES_LIST.md](GAMES_LIST.md) file for the currently supported titles, not yet supported ones and notes about some of them.
|
||||
|
||||
## Usage from Node.js
|
||||
|
||||
Install...
|
||||
```shell
|
||||
npm install gamedig
|
||||
```
|
||||
... then use!
|
||||
```js
|
||||
import GameDig from 'gamedig';
|
||||
|
||||
```javascript
|
||||
const GameDig = require('gamedig');
|
||||
GameDig.query({
|
||||
type: 'minecraft',
|
||||
host: 'mc.example.com'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const Minimist = require('minimist');
|
||||
const GameDig = require('..');
|
||||
import Minimist from 'minimist';
|
||||
import GameDig from './../lib/index.js';
|
||||
|
||||
const argv = Minimist(process.argv.slice(2), {
|
||||
boolean: ['pretty','debug','givenPortOnly','requestRules'],
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs'),
|
||||
GameResolver = require('../lib/GameResolver'),
|
||||
gameResolver = new GameResolver();
|
||||
import * as fs from 'fs';
|
||||
import GameResolver from "../lib/GameResolver";
|
||||
|
||||
const gameResolver = new GameResolver();
|
||||
|
||||
const generated = gameResolver.printReadme();
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const dns = require('dns'),
|
||||
Logger = require('./Logger'),
|
||||
util = require('util'),
|
||||
dnsLookupAsync = util.promisify(dns.lookup),
|
||||
dnsResolveAsync = util.promisify(dns.resolve),
|
||||
punycode = require('punycode');
|
||||
import * as dns from 'dns';
|
||||
import * as punycode from "punycode";
|
||||
import { promisify } from "util";
|
||||
|
||||
class DnsResolver {
|
||||
const dnsLookupAsync = promisify(dns.lookup);
|
||||
const dnsResolveAsync = promisify(dns.resolve);
|
||||
|
||||
export default class DnsResolver {
|
||||
/**
|
||||
* @param {Logger} logger
|
||||
*/
|
||||
|
@ -76,5 +76,3 @@ class DnsResolver {
|
|||
return {address: address};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DnsResolver;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const Path = require('path'),
|
||||
fs = require('fs');
|
||||
import * as path from 'path';
|
||||
import { fileURLToPath } from "url";
|
||||
import * as fs from 'fs';
|
||||
|
||||
class GameResolver {
|
||||
export default class GameResolver {
|
||||
constructor() {
|
||||
const loaded = this._readGames();
|
||||
this.gamesByKey = loaded.gamesByKey;
|
||||
|
@ -56,7 +57,9 @@ class GameResolver {
|
|||
}
|
||||
|
||||
_readGames() {
|
||||
const gamesFile = Path.normalize(__dirname+'/../games.txt');
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const gamesFile = path.normalize(__dirname+'/../games.txt');
|
||||
const lines = fs.readFileSync(gamesFile,'utf8').split('\n');
|
||||
|
||||
const gamesByKey = new Map();
|
||||
|
@ -117,5 +120,3 @@ class GameResolver {
|
|||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GameResolver;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
const dgram = require('dgram');
|
||||
const HexUtil = require('./HexUtil');
|
||||
const Logger = require('./Logger');
|
||||
const util = require('util');
|
||||
|
||||
class GlobalUdpSocket {
|
||||
import { createSocket } from "dgram";
|
||||
import { debugDump } from "./HexUtil.js";
|
||||
import { promisify } from "util";
|
||||
import Logger from "./Logger.js";
|
||||
|
||||
export default class GlobalUdpSocket {
|
||||
constructor({port}) {
|
||||
this.socket = null;
|
||||
this.callbacks = new Set();
|
||||
|
@ -14,7 +15,7 @@ class GlobalUdpSocket {
|
|||
|
||||
async _getSocket() {
|
||||
if (!this.socket) {
|
||||
const udpSocket = dgram.createSocket({
|
||||
const udpSocket = createSocket({
|
||||
type: 'udp4',
|
||||
reuseAddr: true
|
||||
});
|
||||
|
@ -24,7 +25,7 @@ class GlobalUdpSocket {
|
|||
const fromPort = rinfo.port;
|
||||
this.logger.debug(log => {
|
||||
log(fromAddress + ':' + fromPort + " <--UDP(" + this.port + ")");
|
||||
log(HexUtil.debugDump(buffer));
|
||||
log(debugDump(buffer));
|
||||
});
|
||||
for (const callback of this.callbacks) {
|
||||
callback(fromAddress, fromPort, buffer);
|
||||
|
@ -33,7 +34,7 @@ class GlobalUdpSocket {
|
|||
udpSocket.on('error', e => {
|
||||
this.logger.debug("UDP ERROR:", e);
|
||||
});
|
||||
await util.promisify(udpSocket.bind).bind(udpSocket)(this.port);
|
||||
await promisify(udpSocket.bind).bind(udpSocket)(this.port);
|
||||
this.port = udpSocket.address().port;
|
||||
this.socket = udpSocket;
|
||||
}
|
||||
|
@ -46,11 +47,11 @@ class GlobalUdpSocket {
|
|||
if (debug) {
|
||||
this.logger._print(log => {
|
||||
log(address + ':' + port + " UDP(" + this.port + ")-->");
|
||||
log(HexUtil.debugDump(buffer));
|
||||
log(debugDump(buffer));
|
||||
});
|
||||
}
|
||||
|
||||
await util.promisify(socket.send).bind(socket)(buffer,0,buffer.length,port,address);
|
||||
await promisify(socket.send).bind(socket)(buffer,0,buffer.length,port,address);
|
||||
}
|
||||
|
||||
addCallback(callback, debug) {
|
||||
|
@ -66,5 +67,3 @@ class GlobalUdpSocket {
|
|||
this.logger.debugEnabled = this.debuggingCallbacks.size > 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GlobalUdpSocket;
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
class HexUtil {
|
||||
/** @param {Buffer} buffer */
|
||||
static debugDump(buffer) {
|
||||
let hexLine = '';
|
||||
let chrLine = '';
|
||||
let out = '';
|
||||
out += "Buffer length: " + buffer.length + " bytes\n";
|
||||
for(let i = 0; i < buffer.length; i++) {
|
||||
const sliced = buffer.slice(i,i+1);
|
||||
hexLine += sliced.toString('hex')+' ';
|
||||
let chr = sliced.toString();
|
||||
if(chr < ' ' || chr > '~') chr = ' ';
|
||||
chrLine += chr+' ';
|
||||
if(hexLine.length > 60 || i === buffer.length - 1) {
|
||||
out += hexLine + '\n';
|
||||
out += chrLine + '\n';
|
||||
hexLine = chrLine = '';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HexUtil;
|
||||
/** @param {Buffer} buffer */
|
||||
export const debugDump = (buffer) => {
|
||||
let hexLine = '';
|
||||
let chrLine = '';
|
||||
let out = '';
|
||||
out += "Buffer length: " + buffer.length + " bytes\n";
|
||||
for(let i = 0; i < buffer.length; i++) {
|
||||
const sliced = buffer.slice(i,i+1);
|
||||
hexLine += sliced.toString('hex')+' ';
|
||||
let chr = sliced.toString();
|
||||
if(chr < ' ' || chr > '~') chr = ' ';
|
||||
chrLine += chr+' ';
|
||||
if(hexLine.length > 60 || i === buffer.length - 1) {
|
||||
out += hexLine + '\n';
|
||||
out += chrLine + '\n';
|
||||
hexLine = chrLine = '';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const HexUtil = require('./HexUtil');
|
||||
import {debugDump} from './HexUtil.js';
|
||||
|
||||
class Logger {
|
||||
export default class Logger {
|
||||
constructor() {
|
||||
this.debugEnabled = false;
|
||||
this.prefix = '';
|
||||
|
@ -31,7 +31,7 @@ class Logger {
|
|||
if (arg instanceof Error) {
|
||||
out.push(arg.stack);
|
||||
} else if (arg instanceof Buffer) {
|
||||
out.push(HexUtil.debugDump(arg));
|
||||
out.push(debugDump(arg));
|
||||
} else if (typeof arg == 'function') {
|
||||
const result = arg.call(undefined, (...args) => this._print(...args));
|
||||
if (result !== undefined) out.push(...this._convertArgsToStrings(result));
|
||||
|
@ -42,5 +42,3 @@ class Logger {
|
|||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Logger;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Promises {
|
||||
export default class Promises {
|
||||
static createTimeout(timeoutMs, timeoutMsg) {
|
||||
let cancel = null;
|
||||
const wrapped = new Promise((res, rej) => {
|
||||
|
@ -16,5 +16,3 @@ class Promises {
|
|||
return wrapped;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Promises;
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
const Path = require('path'),
|
||||
fs = require('fs'),
|
||||
Core = require('../protocols/core');
|
||||
import * as Protocols from '../protocols/index.js'
|
||||
|
||||
class ProtocolResolver {
|
||||
constructor() {
|
||||
this.protocolDir = Path.normalize(__dirname+'/../protocols');
|
||||
}
|
||||
export const getProtocol = (protocolId) => {
|
||||
if(!(protocolId in Protocols))
|
||||
throw Error('Protocol definition file missing: ' + protocolId);
|
||||
|
||||
/**
|
||||
* @returns Core
|
||||
*/
|
||||
create(protocolId) {
|
||||
protocolId = Path.basename(protocolId);
|
||||
const path = this.protocolDir+'/'+protocolId;
|
||||
if(!fs.existsSync(path+'.js')) throw Error('Protocol definition file missing: '+type);
|
||||
const protocol = require(path);
|
||||
return new protocol();
|
||||
}
|
||||
return new Protocols[protocolId];
|
||||
}
|
||||
|
||||
module.exports = ProtocolResolver;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const GameResolver = require('./GameResolver'),
|
||||
ProtocolResolver = require('./ProtocolResolver'),
|
||||
GlobalUdpSocket = require('./GlobalUdpSocket');
|
||||
import GameResolver from "./GameResolver.js";
|
||||
import {getProtocol} from './ProtocolResolver.js';
|
||||
import GlobalUdpSocket from "./GlobalUdpSocket.js";
|
||||
|
||||
const defaultOptions = {
|
||||
socketTimeout: 2000,
|
||||
|
@ -9,13 +9,12 @@ const defaultOptions = {
|
|||
ipFamily: 0
|
||||
};
|
||||
|
||||
class QueryRunner {
|
||||
export default class QueryRunner {
|
||||
constructor(runnerOpts = {}) {
|
||||
this.udpSocket = new GlobalUdpSocket({
|
||||
port: runnerOpts.listenUdpPort
|
||||
});
|
||||
this.gameResolver = new GameResolver();
|
||||
this.protocolResolver = new ProtocolResolver();
|
||||
}
|
||||
|
||||
async run(userOptions) {
|
||||
|
@ -90,11 +89,9 @@ class QueryRunner {
|
|||
}
|
||||
|
||||
async _attempt(options) {
|
||||
const core = this.protocolResolver.create(options.protocol);
|
||||
const core = getProtocol(options.protocol);
|
||||
core.options = options;
|
||||
core.udpSocket = this.udpSocket;
|
||||
return await core.runOnceSafe();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = QueryRunner;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class Player {
|
||||
|
||||
export class Player {
|
||||
name = '';
|
||||
raw = {};
|
||||
|
||||
|
@ -13,7 +14,7 @@ class Player {
|
|||
}
|
||||
}
|
||||
|
||||
class Players extends Array {
|
||||
export class Players extends Array {
|
||||
setNum(num) {
|
||||
// If the server specified some ridiculous number of players (billions), we don't want to
|
||||
// run out of ram allocating these objects.
|
||||
|
@ -29,7 +30,7 @@ class Players extends Array {
|
|||
}
|
||||
}
|
||||
|
||||
class Results {
|
||||
export class Results {
|
||||
name = '';
|
||||
map = '';
|
||||
password = false;
|
||||
|
@ -40,5 +41,3 @@ class Results {
|
|||
players = new Players();
|
||||
bots = new Players();
|
||||
}
|
||||
|
||||
module.exports = Results;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const QueryRunner = require('./QueryRunner');
|
||||
import QueryRunner from './QueryRunner.js';
|
||||
|
||||
let singleton = null;
|
||||
|
||||
class Gamedig {
|
||||
export default class Gamedig {
|
||||
constructor(runnerOpts) {
|
||||
this.queryRunner = new QueryRunner(runnerOpts);
|
||||
}
|
||||
|
@ -22,5 +22,3 @@ class Gamedig {
|
|||
return await Gamedig.getInstance().query(...args);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Gamedig;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const Iconv = require('iconv-lite'),
|
||||
Long = require('long'),
|
||||
Core = require('../protocols/core'),
|
||||
Buffer = require('buffer'),
|
||||
Varint = require('varint');
|
||||
import Iconv from "iconv-lite";
|
||||
import Long from 'long';
|
||||
import {Buffer} from "buffer";
|
||||
import Varint from 'varint';
|
||||
|
||||
function readUInt64BE(buffer,offset) {
|
||||
const high = buffer.readUInt32BE(offset);
|
||||
|
@ -15,7 +14,7 @@ function readUInt64LE(buffer,offset) {
|
|||
return new Long(low,high,true);
|
||||
}
|
||||
|
||||
class Reader {
|
||||
export default class Reader {
|
||||
/**
|
||||
* @param {Core} query
|
||||
* @param {Buffer} buffer
|
||||
|
@ -171,5 +170,3 @@ class Reader {
|
|||
return this.i >= this.buffer.length;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Reader;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"csgo",
|
||||
"minecraft"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"author": "GameDig Contributors",
|
||||
"version": "4.1.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Armagetron extends Core {
|
||||
export default class armagetron extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -61,5 +61,3 @@ class Armagetron extends Core {
|
|||
return str.replace(/0x[0-9a-f]{6}/g,'');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Armagetron;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Ase extends Core {
|
||||
export default class ase extends Core {
|
||||
async run(state) {
|
||||
const buffer = await this.udpSend('s',(buffer) => {
|
||||
const reader = this.reader(buffer);
|
||||
|
@ -43,5 +43,3 @@ class Ase extends Core {
|
|||
return reader.pascalString(1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ase;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class AssettoCorsa extends Core {
|
||||
export default class assettocorsa extends Core {
|
||||
async run(state) {
|
||||
const serverInfo = await this.request({
|
||||
url: `http://${this.options.address}:${this.options.port}/INFO`,
|
||||
|
@ -14,7 +14,7 @@ class AssettoCorsa extends Core {
|
|||
if (!serverInfo || !carInfo || !carInfo.Cars) {
|
||||
throw new Error('Query not successful');
|
||||
}
|
||||
|
||||
|
||||
state.maxplayers = serverInfo.maxclients;
|
||||
state.name = serverInfo.name;
|
||||
state.map = serverInfo.track;
|
||||
|
@ -36,5 +36,3 @@ class AssettoCorsa extends Core {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AssettoCorsa;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Battlefield extends Core {
|
||||
export default class battlefield extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -159,5 +159,3 @@ class Battlefield extends Core {
|
|||
return params;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Battlefield;
|
|
@ -1,7 +1,7 @@
|
|||
const Core = require('./core'),
|
||||
cheerio = require('cheerio');
|
||||
import Core from './core.js';
|
||||
import * as cheerio from "cheerio";
|
||||
|
||||
class BuildAndShoot extends Core {
|
||||
export default class buildandshoot extends Core {
|
||||
async run(state) {
|
||||
const body = await this.request({
|
||||
url: 'http://'+this.options.address+':'+this.options.port+'/',
|
||||
|
@ -53,5 +53,3 @@ class BuildAndShoot extends Core {
|
|||
*/
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BuildAndShoot;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
const EventEmitter = require('events').EventEmitter;
|
||||
const net = require('net');
|
||||
const Reader = require('../lib/reader');
|
||||
const HexUtil = require('../lib/HexUtil');
|
||||
const Promises = require('../lib/Promises');
|
||||
const Logger = require('../lib/Logger');
|
||||
const DnsResolver = require('../lib/DnsResolver');
|
||||
const Results = require('../lib/Results');
|
||||
import {EventEmitter} from "events";
|
||||
import * as net from "net";
|
||||
import Reader from "../lib/reader.js";
|
||||
import {debugDump} from '../lib/HexUtil.js';
|
||||
import Logger from "../lib/Logger.js";
|
||||
import DnsResolver from "../lib/DnsResolver.js";
|
||||
import {Results} from "../lib/Results.js";
|
||||
import Promises from "../lib/Promises.js";
|
||||
|
||||
let uid = 0;
|
||||
|
||||
class Core extends EventEmitter {
|
||||
export default class Core extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'utf8';
|
||||
|
@ -178,7 +178,7 @@ class Core extends EventEmitter {
|
|||
const writeHook = socket.write;
|
||||
socket.write = (...args) => {
|
||||
log(address+':'+port+" TCP-->");
|
||||
log(HexUtil.debugDump(args[0]));
|
||||
log(debugDump(args[0]));
|
||||
writeHook.apply(socket,args);
|
||||
};
|
||||
socket.on('error', e => log('TCP Error:', e));
|
||||
|
@ -352,5 +352,3 @@ class Core extends EventEmitter {
|
|||
this.logger.debug(...args);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Core;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Cs2d extends Core {
|
||||
export default class cs2d extends Core {
|
||||
async run(state) {
|
||||
{
|
||||
const reader = await this.sendQuery(
|
||||
|
@ -69,5 +69,3 @@ class Cs2d extends Core {
|
|||
return reader.pascalString(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Cs2d;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Discord extends Core {
|
||||
export default class discord extends Core {
|
||||
async run(state) {
|
||||
const guildId = this.options.guildId;
|
||||
if (typeof guildId !== 'string') {
|
||||
|
@ -27,5 +27,3 @@ class Discord extends Core {
|
|||
state.raw = json;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Discord;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Doom3 extends Core {
|
||||
export default class doom3 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -147,5 +147,3 @@ class Doom3 extends Core {
|
|||
return str.replace(/\^(X.{6}|.)/g,'');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Doom3;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Valve = require('./valve');
|
||||
import valve from './valve.js';
|
||||
|
||||
class Ffow extends Valve {
|
||||
export default class ffow extends valve {
|
||||
constructor() {
|
||||
super();
|
||||
this.byteorder = 'be';
|
||||
|
@ -35,5 +35,3 @@ class Ffow extends Valve {
|
|||
state.raw.timeleft = reader.uint(2);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ffow;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Quake2 = require('./quake2');
|
||||
import quake2 from './quake2.js';
|
||||
|
||||
class FiveM extends Quake2 {
|
||||
export default class fivem extends quake2 {
|
||||
constructor() {
|
||||
super();
|
||||
this.sendHeader = 'getinfo xxx';
|
||||
|
@ -31,5 +31,3 @@ class FiveM extends Quake2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FiveM;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
const stringKeys = new Set([
|
||||
'website',
|
||||
|
@ -29,7 +29,7 @@ function normalizeEntry([key,value]) {
|
|||
return [key,value];
|
||||
}
|
||||
|
||||
class Gamespy1 extends Core {
|
||||
export default class gamespy1 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -177,5 +177,3 @@ class Gamespy1 extends Core {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Gamespy1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Gamespy2 extends Core {
|
||||
export default class gamespy2 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -138,5 +138,3 @@ class Gamespy2 extends Core {
|
|||
return units;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Gamespy2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Gamespy3 extends Core {
|
||||
export default class gamespy3 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.sessionId = 1;
|
||||
|
@ -194,5 +194,3 @@ class Gamespy3 extends Core {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Gamespy3;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class GeneShift extends Core {
|
||||
export default class geneshift extends Core {
|
||||
async run(state) {
|
||||
await this.tcpPing();
|
||||
|
||||
|
@ -44,5 +44,3 @@ class GeneShift extends Core {
|
|||
state.raw.version = found[19];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GeneShift;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
const Valve = require('./valve');
|
||||
import valve from './valve.js';
|
||||
|
||||
class GoldSrc extends Valve {
|
||||
export default class goldsrc extends valve {
|
||||
constructor() {
|
||||
super();
|
||||
this.goldsrcInfo = true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GoldSrc;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Quake1 = require('./quake1');
|
||||
import quake1 from './quake1.js';
|
||||
|
||||
class Hexen2 extends Quake1 {
|
||||
export default class hexen2 extends quake1 {
|
||||
constructor() {
|
||||
super();
|
||||
this.sendHeader = '\xFFstatus\x0a';
|
||||
|
@ -11,5 +11,3 @@ class Hexen2 extends Quake1 {
|
|||
state.gamePort = this.options.port - 50;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Hexen2;
|
||||
|
|
52
protocols/index.js
Normal file
52
protocols/index.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
import armagetron from "./armagetron.js";
|
||||
import ase from "./ase.js";
|
||||
import assettocorsa from "./assettocorsa.js";
|
||||
import battlefield from "./battlefield.js";
|
||||
import buildandshoot from "./buildandshoot.js";
|
||||
import cs2d from "./cs2d.js";
|
||||
import discord from "./discord.js";
|
||||
import doom3 from "./doom3.js";
|
||||
import ffow from "./ffow.js";
|
||||
import fivem from "./fivem.js";
|
||||
import gamespy1 from "./gamespy1.js";
|
||||
import gamespy2 from "./gamespy2.js";
|
||||
import gamespy3 from "./gamespy3.js";
|
||||
import geneshift from "./geneshift.js";
|
||||
import goldsrc from "./goldsrc.js";
|
||||
import hexen2 from "./hexen2.js";
|
||||
import jc2mp from "./jc2mp.js";
|
||||
import kspdmp from "./kspdmp.js";
|
||||
import mafia2mp from "./mafia2mp.js";
|
||||
import mafia2online from "./mafia2online.js";
|
||||
import minecraft from "./minecraft.js";
|
||||
import minecraftbedrock from "./minecraftbedrock.js";
|
||||
import minecraftvanilla from "./minecraftvanilla.js";
|
||||
import mumble from "./mumble.js";
|
||||
import mumbleping from "./mumbleping.js";
|
||||
import nadeo from "./nadeo.js";
|
||||
import openttd from "./openttd.js";
|
||||
import quake1 from "./quake1.js";
|
||||
import quake2 from "./quake2.js";
|
||||
import quake3 from "./quake3.js";
|
||||
import rfactor from "./rfactor.js";
|
||||
import samp from "./samp.js";
|
||||
import savage2 from "./savage2.js";
|
||||
import starmade from "./starmade.js";
|
||||
import starsiege from "./starsiege.js";
|
||||
import teamspeak2 from "./teamspeak2.js";
|
||||
import teamspeak3 from "./teamspeak3.js";
|
||||
import terraria from "./terraria.js";
|
||||
import tribes1 from "./tribes1.js";
|
||||
import tribes1master from "./tribes1master.js";
|
||||
import unreal2 from "./unreal2.js";
|
||||
import ut3 from "./ut3.js";
|
||||
import valve from "./valve.js";
|
||||
import vcmp from "./vcmp.js";
|
||||
import ventrilo from "./ventrilo.js";
|
||||
import warsow from "./warsow.js";
|
||||
|
||||
export { armagetron, ase, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, ffow, fivem, gamespy1,
|
||||
gamespy2, gamespy3, geneshift, goldsrc, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
|
||||
minecraftbedrock, minecraftvanilla, mumble, mumbleping, nadeo, openttd, quake1, quake2, quake3, rfactor, samp,
|
||||
savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, tribes1, tribes1master, unreal2, ut3, valve,
|
||||
vcmp, ventrilo, warsow }
|
|
@ -1,8 +1,8 @@
|
|||
const Gamespy3 = require('./gamespy3');
|
||||
import gamespy3 from './gamespy3.js';
|
||||
|
||||
// supposedly, gamespy3 is the "official" query protocol for jcmp,
|
||||
// but it's broken (requires useOnlySingleSplit), and may not include some player names
|
||||
class Jc2mp extends Gamespy3 {
|
||||
export default class jc2mp extends gamespy3 {
|
||||
constructor() {
|
||||
super();
|
||||
this.useOnlySingleSplit = true;
|
||||
|
@ -16,5 +16,3 @@ class Jc2mp extends Gamespy3 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Jc2mp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Kspdmp extends Core {
|
||||
export default class kspdmp extends Core {
|
||||
async run(state) {
|
||||
const json = await this.request({
|
||||
url: 'http://'+this.options.address+':'+this.options.port,
|
||||
|
@ -25,5 +25,3 @@ class Kspdmp extends Core {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Kspdmp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Mafia2Multiplayer extends Core {
|
||||
export default class mafia2mp extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -39,5 +39,3 @@ class Mafia2Multiplayer extends Core {
|
|||
return reader.pascalString(1,-1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Mafia2Multiplayer;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
const Mafia2Multiplayer = require('./mafia2mp');
|
||||
import mafia2mp from './mafia2mp.js';
|
||||
|
||||
class Mafia2Online extends Mafia2Multiplayer {
|
||||
export default class mafia2online extends mafia2mp {
|
||||
constructor() {
|
||||
super();
|
||||
this.header = 'M2Online';
|
||||
this.isMafia2Online = true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Mafia2Online;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const Core = require('./core');
|
||||
const MinecraftVanilla = require('./minecraftvanilla');
|
||||
const MinecraftBedrock = require('./minecraftbedrock');
|
||||
const Gamespy3 = require('./gamespy3');
|
||||
const Results = require('../lib/Results');
|
||||
import Core from './core.js';
|
||||
import minecraftbedrock from "./minecraftbedrock.js";
|
||||
import minecraftvanilla from "./minecraftvanilla.js";
|
||||
import Gamespy3 from "./gamespy3.js";
|
||||
import {Results} from "../lib/Results.js";
|
||||
|
||||
/*
|
||||
Vanilla servers respond to minecraftvanilla only
|
||||
|
@ -12,7 +12,7 @@ Some bedrock servers respond to minecraftbedrock only
|
|||
Unsure if any bedrock servers respond to gamespy3 and minecraftbedrock
|
||||
*/
|
||||
|
||||
class Minecraft extends Core {
|
||||
export default class minecraft extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.srvRecord = "_minecraft._tcp";
|
||||
|
@ -21,7 +21,7 @@ class Minecraft extends Core {
|
|||
/** @type {Promise<Results>[]} */
|
||||
const promises = [];
|
||||
|
||||
const vanillaResolver = new MinecraftVanilla();
|
||||
const vanillaResolver = new minecraftvanilla();
|
||||
vanillaResolver.options = this.options;
|
||||
vanillaResolver.udpSocket = this.udpSocket;
|
||||
promises.push((async () => {
|
||||
|
@ -38,7 +38,7 @@ class Minecraft extends Core {
|
|||
try { return await gamespyResolver.runOnceSafe(); } catch(e) {}
|
||||
})());
|
||||
|
||||
const bedrockResolver = new MinecraftBedrock();
|
||||
const bedrockResolver = new minecraftbedrock();
|
||||
bedrockResolver.options = this.options;
|
||||
bedrockResolver.udpSocket = this.udpSocket;
|
||||
promises.push((async () => {
|
||||
|
@ -97,5 +97,3 @@ class Minecraft extends Core {
|
|||
state.name = state.name.replace(/\u00A7./g, '');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Minecraft;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class MinecraftBedrock extends Core {
|
||||
export default class minecraftbedrock extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.byteorder = 'be';
|
||||
|
@ -68,9 +68,5 @@ class MinecraftBedrock extends Core {
|
|||
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = MinecraftBedrock;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Core = require('./core'),
|
||||
Varint = require('varint');
|
||||
import Core from './core.js';
|
||||
import Varint from "varint";
|
||||
|
||||
class MinecraftVanilla extends Core {
|
||||
export default class minecraftvanilla extends Core {
|
||||
async run(state) {
|
||||
const portBuf = Buffer.alloc(2);
|
||||
portBuf.writeUInt16BE(this.options.port,0);
|
||||
|
@ -78,5 +78,3 @@ class MinecraftVanilla extends Core {
|
|||
]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MinecraftVanilla;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Mumble extends Core {
|
||||
export default class mumble extends Core {
|
||||
async run(state) {
|
||||
const json = await this.withTcp(async socket => {
|
||||
return await this.tcpSend(socket, 'json', (buffer) => {
|
||||
|
@ -37,5 +37,3 @@ class Mumble extends Core {
|
|||
return str.replace(/<.*>/g,'');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Mumble;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class MumblePing extends Core {
|
||||
export default class mumbleping extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.byteorder = 'be';
|
||||
|
@ -22,5 +22,3 @@ class MumblePing extends Core {
|
|||
state.raw.allowedbandwidth = reader.uint(4);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MumblePing;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const gbxremote = require('gbxremote'),
|
||||
Core = require('./core'),
|
||||
Promises = require('../lib/Promises');
|
||||
import Core from './core.js';
|
||||
import Promises from "../lib/Promises.js";
|
||||
import * as gbxremote from 'gbxremote';
|
||||
|
||||
class Nadeo extends Core {
|
||||
export default class nadeo extends Core {
|
||||
async run(state) {
|
||||
await this.withClient(async client => {
|
||||
const start = Date.now();
|
||||
|
@ -82,7 +82,4 @@ class Nadeo extends Core {
|
|||
stripColors(str) {
|
||||
return str.replace(/\$([0-9a-f]{3}|[a-z])/gi,'');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Nadeo;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class OpenTtd extends Core {
|
||||
export default class openttd extends Core {
|
||||
async run(state) {
|
||||
{
|
||||
const [reader, version] = await this.query(0, 1, 1, 4);
|
||||
|
@ -125,5 +125,3 @@ class OpenTtd extends Core {
|
|||
return arr[num];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OpenTtd;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
const Quake2 = require('./quake2');
|
||||
import quake2 from './quake2.js';
|
||||
|
||||
class Quake1 extends Quake2 {
|
||||
export default class quake1 extends quake2 {
|
||||
constructor() {
|
||||
super();
|
||||
this.responseHeader = 'n';
|
||||
this.isQuake1 = true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Quake1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Quake2 extends Core {
|
||||
export default class quake2 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -84,5 +84,3 @@ class Quake2 extends Core {
|
|||
if('hostname' in state.raw) state.name = state.raw.hostname;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Quake2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Quake2 = require('./quake2');
|
||||
import quake2 from './quake2.js';
|
||||
|
||||
class Quake3 extends Quake2 {
|
||||
export default class quake3 extends quake2 {
|
||||
constructor() {
|
||||
super();
|
||||
this.sendHeader = 'getstatus';
|
||||
|
@ -20,5 +20,3 @@ class Quake3 extends Quake2 {
|
|||
return str.replace(/\^(X.{6}|.)/g,'');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Quake3;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Rfactor extends Core {
|
||||
export default class rfactor extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
//this.byteorder = 'be';
|
||||
|
@ -72,5 +72,3 @@ class Rfactor extends Core {
|
|||
return this.reader(consumed).string();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Rfactor;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Samp extends Core {
|
||||
export default class samp extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'win1252';
|
||||
|
@ -105,5 +105,3 @@ class Samp extends Core {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Samp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Savage2 extends Core {
|
||||
export default class savage2 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
@ -27,5 +27,3 @@ class Savage2 extends Core {
|
|||
return str.replace(/\^./g,'');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Savage2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Starmade extends Core {
|
||||
export default class starmade extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -65,5 +65,3 @@ class Starmade extends Core {
|
|||
if(typeof data[6] === 'number') state.maxplayers = data[6];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Starmade;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Tribes1 = require('./tribes1');
|
||||
import tribes1 from "./tribes1.js";
|
||||
|
||||
class Starsiege extends Tribes1 {
|
||||
export default class starsiege extends tribes1 {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -8,5 +8,3 @@ class Starsiege extends Tribes1 {
|
|||
this.responseByte = 0x73;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Starsiege;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Teamspeak2 extends Core {
|
||||
export default class teamspeak2 extends Core {
|
||||
async run(state) {
|
||||
const queryPort = this.options.teamspeakQueryPort || 51234;
|
||||
|
||||
|
@ -68,5 +68,3 @@ class Teamspeak2 extends Core {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Teamspeak2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Teamspeak3 extends Core {
|
||||
export default class teamspeak3 extends Core {
|
||||
async run(state) {
|
||||
const queryPort = this.options.teamspeakQueryPort || 10011;
|
||||
|
||||
|
@ -64,5 +64,3 @@ class Teamspeak3 extends Core {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Teamspeak3;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Terraria extends Core {
|
||||
export default class terraria extends Core {
|
||||
async run(state) {
|
||||
const json = await this.request({
|
||||
url: 'http://'+this.options.address+':'+this.options.port+'/v2/server/status',
|
||||
|
@ -22,5 +22,3 @@ class Terraria extends Core {
|
|||
state.raw.numplayers = json.playercount;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Terraria;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Tribes1 extends Core {
|
||||
export default class tribes1 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -148,5 +148,3 @@ class Tribes1 extends Core {
|
|||
return reader.pascalString(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Tribes1;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
/** Unsupported -- use at your own risk!! */
|
||||
|
||||
class Tribes1Master extends Core {
|
||||
export default class tribes1master extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -77,5 +77,3 @@ class Tribes1Master extends Core {
|
|||
return reader.pascalString(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Tribes1Master;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Unreal2 extends Core {
|
||||
export default class unreal2 extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.encoding = 'latin1';
|
||||
|
@ -148,5 +148,3 @@ class Unreal2 extends Core {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Unreal2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Gamespy3 = require('./gamespy3');
|
||||
import gamespy3 from './gamespy3.js';
|
||||
|
||||
class Ut3 extends Gamespy3 {
|
||||
export default class ut3 extends gamespy3 {
|
||||
async run(state) {
|
||||
await super.run(state);
|
||||
|
||||
|
@ -43,5 +43,3 @@ class Ut3 extends Gamespy3 {
|
|||
if('map' in state.raw) state.map = state.raw.map;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ut3;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
const Bzip2 = require('seek-bzip');
|
||||
const Core = require('./core');
|
||||
const Results = require('../lib/Results');
|
||||
const Reader = require('../lib/reader');
|
||||
import Bzip2 from 'seek-bzip';
|
||||
import Core from './core.js';
|
||||
|
||||
const AppId = {
|
||||
Squad: 393380,
|
||||
|
@ -16,7 +14,7 @@ const AppId = {
|
|||
Source_SDK_Base_2006: 215
|
||||
};
|
||||
|
||||
class Valve extends Core {
|
||||
export default class valve extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
@ -606,5 +604,3 @@ class Valve extends Core {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Valve;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Samp = require('./samp');
|
||||
import samp from './samp.js';
|
||||
|
||||
class Vcmp extends Samp {
|
||||
export default class vcmp extends samp {
|
||||
constructor() {
|
||||
super();
|
||||
this.magicHeader = 'VCMP';
|
||||
|
@ -8,5 +8,3 @@ class Vcmp extends Samp {
|
|||
this.isVcmp = true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Vcmp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Core = require('./core');
|
||||
import Core from './core.js';
|
||||
|
||||
class Ventrilo extends Core {
|
||||
export default class ventrilo extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.byteorder = 'be';
|
||||
|
@ -233,5 +233,3 @@ const crc_table = [
|
|||
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
|
||||
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
|
||||
];
|
||||
|
||||
module.exports = Ventrilo;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Quake3 = require('./quake3');
|
||||
import quake3 from './quake3.js';
|
||||
|
||||
class Warsow extends Quake3 {
|
||||
export default class warsow extends quake3 {
|
||||
async run(state) {
|
||||
await super.run(state);
|
||||
if(state.players) {
|
||||
|
@ -11,5 +11,3 @@ class Warsow extends Quake3 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Warsow;
|
||||
|
|
Loading…
Reference in a new issue