feat(games): add SCP:SL support (#715)

* feat(games): add scpsl initial impl

* feat: add name

* feat: add game entry, add note

* docs: add SSL to games_list.md

* fix: remove stray debug console log

* docs: update CHANGELOG.md
This commit is contained in:
CosminPerRam 2025-06-29 18:02:38 +03:00 committed by GitHub
parent bab3452047
commit f2dfb8134f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 73 additions and 1 deletions

View file

@ -73,11 +73,12 @@ import altvmp from './altvmp.js'
import vintagestorymaster from './vintagestorymaster.js'
import vintagestory from './vintagestory.js'
import sdtd from './sdtd.js'
import scpsl from './scpsl.js'
export {
armagetron, ase, asa, assettocorsa, battlefield, brokeprotocol, brokeprotocolmaster, buildandshoot, cs2d, discord, doom3, eco, epic, factorio, farmingsimulator, ffow,
fivem, gamespy1, gamespy2, gamespy3, geneshift, goldsrc, gtasao, hawakening, hawakeningmaster, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
minecraftbedrock, minecraftvanilla, minetest, mumble, mumbleping, nadeo, openttd, palworld, quake1, quake2, quake3, renegadex, renegadexmaster, renown, rfactor, ragemp, samp,
satisfactory, soldat, savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, toxikk, tribes1, tribes1master, unreal2, ut3, valve,
vcmp, ventrilo, warsow, eldewrito, beammpmaster, beammp, dayz, theisleevrima, xonotic, altvmp, vintagestorymaster, vintagestory, sdtd
vcmp, ventrilo, warsow, eldewrito, beammpmaster, beammp, dayz, theisleevrima, xonotic, altvmp, vintagestorymaster, vintagestory, sdtd, scpsl
}

54
protocols/scpsl.js Normal file
View file

@ -0,0 +1,54 @@
import Core from './core.js'
export default class scpsl extends Core {
constructor () {
super()
this.usedTcp = true
}
async run (state) {
const { accountId, apiKey, serverId } = this.options
const request = await this.request({
url: 'https://api.scpslgame.com/serverinfo.php',
responseType: 'json',
searchParams: {
id: accountId,
key: apiKey,
lo: true,
players: true,
list: true,
info: true,
pastebin: true,
version: true,
flags: true,
nicknames: true,
online: true
}
})
state.raw.request = request
if (!serverId) {
return
}
const servers = request?.Servers || []
if (!servers.length) {
throw new Error('No servers provided.')
}
const server = servers.find(server => server.ID.toString() === serverId)
if (!server) {
throw new Error('Couldn\'t find the given server id.')
}
state.version = server.Version
state.name = Buffer.from(server.Info, 'base64').toString()
const [numplayers, maxplayers] = server.Players.split('/').map(Number)
state.numplayers = numplayers
state.maxplayers = maxplayers
}
}