feat: add vintage story support (#606)

* feat: add vintage story support

* remove debug console.log
This commit is contained in:
CosminPerRam 2024-08-13 11:56:28 +03:00 committed by GitHub
parent 72893df2b3
commit dcd12d0360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 60 additions and 6 deletions

View file

@ -1,6 +1,7 @@
## To Be Released... ## To Be Released...
## 5.X.Y ## 5.X.Y
* Added Vintage Story support via the master server (#606)
## 4.3.2 ## 4.3.2
* Locked dependencies versions * Locked dependencies versions

View file

@ -137,9 +137,9 @@
| globaloperations | Global Operations | | | globaloperations | Global Operations | |
| goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) | | goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) |
| groundbreach | Ground Breach | [Valve Protocol](#valve) | | groundbreach | Ground Breach | [Valve Protocol](#valve) |
| gta5am | Grand Theft Auto V - alt:V Multiplayer | [Notes](#gta5am) |
| gta5f | Grand Theft Auto V - FiveM | | | gta5f | Grand Theft Auto V - FiveM | |
| gta5r | Grand Theft Auto V - RAGE MP | [Notes](#gta5r) | | gta5r | Grand Theft Auto V - RageMP | [Notes](#gta5r) |
| gta5am | Grand Theft Auto V - alt:V Multiplayer | [Notes](#gta5am) |
| gtasam | Grand Theft Auto: San Andreas Multiplayer | | | gtasam | Grand Theft Auto: San Andreas Multiplayer | |
| gtasamta | Grand Theft Auto: San Andreas - Multi Theft Auto | | | gtasamta | Grand Theft Auto: San Andreas - Multi Theft Auto | |
| gtasao | Grand Theft Auto: San Andreas OpenMP | | | gtasao | Grand Theft Auto: San Andreas OpenMP | |
@ -258,7 +258,7 @@
| serioussam2 | Serious Sam 2 | | | serioussam2 | Serious Sam 2 | |
| shatteredhorizon | Shattered Horizon | [Valve Protocol](#valve) | | shatteredhorizon | Shattered Horizon | [Valve Protocol](#valve) |
| shogo | Shogo | | | shogo | Shogo | |
| shootmania | Shootmania | [Notes](#nadeo-shootmania--trackmania--etc) | | shootmania | Shootmania | [Notes](#nadeo) |
| sin | SiN | | | sin | SiN | |
| sinepisodes | SiN Episodes | [Valve Protocol](#valve) | | sinepisodes | SiN Episodes | [Valve Protocol](#valve) |
| sof | Soldier of Fortune | | | sof | Soldier of Fortune | |
@ -309,8 +309,8 @@
| toh | Take On Helicopters | | | toh | Take On Helicopters | |
| tonolf | The Operative: No One Lives Forever | | | tonolf | The Operative: No One Lives Forever | |
| towerunite | Tower Unite | [Valve Protocol](#valve) | | towerunite | Tower Unite | [Valve Protocol](#valve) |
| trackmania2 | Trackmania 2 | [Notes](#nadeo-shootmania--trackmania--etc) | | trackmania2 | Trackmania 2 | [Notes](#nadeo) |
| trackmaniaforever | Trackmania Forever | [Notes](#nadeo-shootmania--trackmania--etc) | | trackmaniaforever | Trackmania Forever | [Notes](#nadeo) |
| tremulous | Tremulous | | | tremulous | Tremulous | |
| tribesvengeance | Tribes: Vengeance | | | tribesvengeance | Tribes: Vengeance | |
| tron20 | Tron 2.0 | | | tron20 | Tron 2.0 | |
@ -331,6 +331,7 @@
| ventrilo | Ventrilo | | | ventrilo | Ventrilo | |
| vietcong | Vietcong | | | vietcong | Vietcong | |
| vietcong2 | Vietcong 2 | | | vietcong2 | Vietcong 2 | |
| vintagestory | Vintage Story | |
| vrising | V Rising | [Valve Protocol](#valve) | | vrising | V Rising | [Valve Protocol](#valve) |
| warfork | Warfork | | | warfork | Warfork | |
| warsow | Warsow | | | warsow | Warsow | |

View file

@ -3214,6 +3214,14 @@ export const games = {
old_id: 'vs' old_id: 'vs'
} }
}, },
vintagestory: {
name: 'Vintage Story',
release_year: 2016,
options: {
port: 42420,
protocol: 'vintagestory'
}
},
warsow: { warsow: {
name: 'Warsow', name: 'Warsow',
release_year: 2012, release_year: 2012,

View file

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

24
protocols/vintagestory.js Normal file
View file

@ -0,0 +1,24 @@
import Core from './core.js'
import vintagestorymaster from './vintagestorymaster.js'
export default class vintagestory extends Core {
async run (state) {
const master = new vintagestorymaster()
master.options = this.options
const masterState = await master.runOnceSafe()
const servers = masterState.raw.servers
const server = servers.find(s => s.serverIP === `${this.options.address}:${this.options.port}`)
if (!server) {
throw new Error('Server not found in the master list')
}
state.name = server.serverName
state.password = server.hasPassword
state.numplayers = parseInt(server.players)
state.maxplayers = parseInt(server.maxPlayers)
state.version = server.gameVersion
state.raw = server
}
}

View file

@ -0,0 +1,17 @@
import Core from './core.js'
export default class vintagestorymaster extends Core {
constructor () {
super()
this.usedTcp = true
}
async run (state) {
const response = await this.request({
url: 'https://masterserver.vintagestory.at/api/v1/servers/list',
responseType: 'json'
})
state.raw.servers = response?.data || []
}
}