Closed guilhermewerner closed 10 months ago
Or do something like this, check the possible attributes that contain the server name:
const namesToCheck = ['CUSTOMSERVERNAME_s', 'NAME_s', 'SERVERNAME_s']
const nonEmptyName = namesToCheck
.map(attribute => desiredServer.attributes[attribute])
.find(name => name !== undefined && name !== null)
state.name = nonEmptyName
Testing on the previous server:
{
"name": "Official Evrima - NA 6",
// ...
}
As just mentioned in #497, seeing that there are 3 fields to choose from, it would be better to make this per game, as to avoid having game-specific logic in the protocol files (like this name field (could also apply to other fields!)). If these responses come in an unstable form (lets say X responds with name on B and Y on P but sometimes it could be swapped, then this could be in the protocol file (with the solution being what you've written)).
What is this feature about? Add support for The Isle Evrima game using the EOS protocol
Additional context/references We were able to obtain the credentials to perform the query on The Isle Evrima servers, which is a variation of the legacy game.
I did some tests on random public servers like this:
IP: 50.18.155.230 Port: 7777
However, there are still some problems, such as the server name, which does not use the same attribute as ASA
CUSTOMSERVERNAME_s
or PalworldNAME_s
#497.Given the variation from game to game, perhaps it would be better to pass this part of obtaining the correct attributes to the protocol for each game, where the base protocol returns the raw response to the game then populates the stable values.