diff --git a/lib/games.js b/lib/games.js index 253f599..cc1d853 100644 --- a/lib/games.js +++ b/lib/games.js @@ -2092,7 +2092,7 @@ export const games = { name: 'Palworld', release_year: 2024, options: { - port: 8211, + port: 8212, protocol: 'palworld' } }, diff --git a/protocols/palworld.js b/protocols/palworld.js index 0e9f21f..f417cba 100644 --- a/protocols/palworld.js +++ b/protocols/palworld.js @@ -1,20 +1,15 @@ -import Epic from './epic.js' - -export default class palworld extends Epic { - constructor () { - super() - - // OAuth2 credentials extracted from Palworld files. - this.clientId = 'xyza78916PZ5DF0fAahu4tnrKKyFpqRE' - this.clientSecret = 'j0NapLEPm3R3EOrlQiM8cRLKq3Rt02ZVVwT0SkZstSg' - this.deploymentId = '0a18471f93d448e2a1f60e47e03d3413' - this.authByExternalToken = true - } +import Core from './core.js' +export default class palworld extends Core { async run (state) { - await super.run(state) - state.name = state.raw.attributes.NAME_s - state.numplayers = state.raw.attributes.PLAYERS_l - state.version = state.raw.attributes.VERSION_S + const url = `http://${this.options.host}:${this.options.port}/v1/api/info` + const headers = { + Authorization: `Basic ${Buffer.from(`${this.options.username}:${this.options.password}`).toString('base64')}`, + Accept: 'application/json' + } + + const response = await this.request({ url, headers, method: 'GET' }) + + console.log(response) } }