npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jka-core

v0.6.3

Published

Library for working with Jedi Academy servers

Downloads

100

Readme

JKA Core

Library for working with Jedi Academy servers

Install

npm i jka-core

To do:

  • [x] getstatus raw request
  • [x] getstatus typed request
  • [x] rcon status request
  • [x] removeColorCodes to clean string form ^0-9 color codes
  • [ ] rcon getting cvar values
  • [ ] rcon getting clientuser information
  • [ ] getInfo request
  • [ ] ... any ideas? Write me in Discord: trayhardplay or you can create an issue here

Current features

What you can do right now:

  1. You can make UDP requests and get the JSON formatted raw response with getStatusRaw(server: string, timeout?: number)
const response = await getStatusRaw('rujka.ru:29070') // or '37.230.210.176:29070'

response = {
  cvars: {
    sv_hostname: 'RU^1JKA^0|^1T^7ls^1Red',
    sv_maxclients: '32',
    mapname: 'mp/duel1',
    timelimit: '3',
    fraglimit: '1',
    duel_fraglimit: '10',
    g_gametype: 'DUEL',
    g_debugmelee: '0',
    g_maxGameClients: '6',
    sv_privateClients: '0',
    gamename: 'basejka',
    version: 'JAmp: v1.0.1.1 linux-i386 Nov 10 2003',
    g_forcepowerdisable: '163837',
    g_weapondisable: '524279',
    g_duelWeaponDisable: '524279',
    g_jediVmerc: '0',
    g_siegeTeam1: 'none',
    g_siegeTeam2: 'none',
    g_siegeTeamSwitch: '1',
    g_siegeRespawn: '20',
    g_stepslidefix: '1',
    g_saberwalldamagescale: '0.4',
    g_forceregentime: '200',
    bg_fighteraltcontrol: '0',
    sv_allowDownload: '0',
    sv_floodProtect: '1',
    sv_maxPing: '0',
    sv_minPing: '0',
    sv_maxRate: '25000',
    g_needpass: '1',
    g_forceBasedTeams: '0',
    g_maxForceRank: '7',
    g_saberLocking: '0',
    g_privateDuel: '0',
    capturelimit: '0',
    dmflags: '0',
    g_maxHolocronCarry: '3',
    protocol: '26',
    bot_minplayers: '0',
    g_noSpecMove: '0',
    g_allowNPC: '1',
    g_showDuelHealths: '0'
  },
  clients: [ { score: '0', ping: '12', name: '[AFK]^2� ^1RU^7JKA^1.Airlines' } ]
}
  1. You can use getStatusSmart(server: string, timeout?: number) which is same getstatus request but with some post-processing:
const response = await getStatusSmart('rujka.ru:29070') // or '37.230.210.176:29070'

response === {
    cvars: {
    sv_hostname: 'RU^1JKA^0|^1T^7ls^1Red',
    mapname: 'mp/duel1',
    g_gametype: 'DUEL',
    g_siegeTeam1: 'none',
    g_siegeTeam2: 'none',
    gamename: 'basejka',
    sv_maxclients: 32,
    timelimit: 3,
    fraglimit: 1,
    duel_fraglimit: 10,
    g_maxGameClients: 6,
    g_siegeRespawn: 20,
    g_forceregentime: 200,
    sv_maxPing: 0,
    sv_minPing: 0,
    sv_maxRate: 25000,
    g_maxForceRank: 7,
    capturelimit: 0,
    dmflags: 0,
    g_maxHolocronCarry: 3,
    protocol: 26,
    sv_privateClients: 0,
    bot_minplayers: 0,
    g_saberwalldamagescale: 0.4,
    g_debugmelee: false,
    g_jediVmerc: false,
    g_siegeTeamSwitch: true,
    g_stepslidefix: true,
    sv_allowDownload: false,
    sv_floodProtect: true,
    g_needpass: true,
    g_forceBasedTeams: false,
    g_privateDuel: false,
    g_noSpecMove: false,
    g_allowNPC: true,
    g_showDuelHealths: false,
    g_forcepowerdisable: Bitfield { _bits: [Array], _keys: [Array] },
    g_weapondisable: Bitfield { _bits: [Array], _keys: [Array] },
    g_duelWeaponDisable: Bitfield { _bits: [Array], _keys: [Array] }
  },
  clients: [
    {
      name: '[AFK]^2� ^1RU^7JKA^1.Airlines',
      ping: 11,
      score: 0,
      isBot: false
    }
  ]
}
  1. rconStatus(server: string, rconpassword: string, timeout?: number) allows you to get information from your server using rconPassword
const response = await rconStatus('rujka.ru:29070', 'dummyRconPassword')

response === {
  type: 'YBEPROXY',
  hostname: 'RUJKA|TlsGreen',
  ip: '37.230.210.176',
  port: '29071',
  os: 'Linux',
  version: '1.0.1.0',
  protocol: 26,
  gamename: 'base',
  map: 'mp/ffa2',
  gametype: 'DUEL',
  players: [
    {
      id: 0,
      name: 'padawan',
      address: '1.1.1.1:29070',
      isBot: false,
      ping: 20,
      score: 0,
      rate: 25000
    }  
  ]
}
  1. Class Bitfield which allows you to easily work with bitfield values, print them with specified descriptions and change that values as you need:
// Let's define keys for our bitfield
const WEAPON_DISABLE_VALUES = [
  'NO_WEAPON',
  'STUN_BATON',
  'MELEE',
  'SABER',
  'BRYAR_PISTOL',
  'BLASTER',
  'DISRUPTOR',
  'BOWCASTER',
  'REPEATER',
  'DEMP2',
  'FLECHETTE',
  'ROCKET_LAUNCHER',
  'THERMAL',
  'TRIP_MINE',
  'DET_PACK',
  'CONCUSSION',
  'BRYAR_OLD',
  'EMPLACED_GUN',
  'TURRET',
]

const gWeaponDisable = new Bitfield(
  524279, // decimal value which you can get from the server
  WEAPON_DISABLE_VALUES.length, // number of entities to control with this bitfield
  WEAPON_DISABLE_VALUES, // keys which would be printed in output list
)

// gWeaponDisable.decimal:
524279

// gWeaponDisable.binary:
'1111111111111110111'

// gWeaponDisable.list:
{
  TURRET: true,
  EMPLACED_GUN: true,
  BRYAR_OLD: true,
  CONCUSSION: true,
  DET_PACK: true,
  TRIP_MINE: true,
  THERMAL: true,
  ROCKET_LAUNCHER: true,
  FLECHETTE: true,
  DEMP2: true,
  REPEATER: true,
  BOWCASTER: true,
  DISRUPTOR: true,
  BLASTER: true,
  BRYAR_PISTOL: true,
  SABER: false,
  MELEE: true,
  STUN_BATON: true,
  NO_WEAPON: true
}

// gWeaponDisable.get('BLASTER'):
true

// gWeaponDisable.set('BLASTER', false):
true // means the value has been successfully set, otherwise it would be false

// gWeaponDisable.get('RANDOM TEXT'):
null
  1. removeColorCodes(str: string) will clean all the ^0-9 color codes from any string
const userWithoutColorCodes = removeColorCodes('^^^7P^1a^6^7^8d^9a ^0w^2a^2^3^4n'); // returns '^^Pada wan'