gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
612 stars 145 forks source link

Core - Strip colors universally across all engines, and add an option to disable #204

Closed miguelsotobaez closed 10 months ago

miguelsotobaez commented 3 years ago

Only appear colors code like ^1 ^2 in Bot but not in players.

I really like if we can see color codes in player name too.

maxplayers: '32', players: [ { frags: 0, ping: 23, name: "»A'den Skirata«" } ], bots: [ { frags: 0, ping: 0, name: '^0SL^1.^0DrachaT' } ],

mmorrisontx commented 3 years ago

Seems unlikely if the protocol isn't returning it already. Strange that it's showing for bots only. If you run the query with debug: true, does the response data contain any of the color codes? If not, there's not much we can do about it.

miguelsotobaez commented 3 years ago

@mmorrisontx I found the issue, the problem is in the file quake3.js in protocols folder.

image

There is a string replace with some regexp to delete color format before the results.

I think I'm going to fork this repository and working for a fix. Maybe some parameter to allow or disallow color formats. Or Maybe there's another better and clean solution for this.

I'm working on this because I'm working on a Ranking ELO Site for Jedi Academy based on Q3 Engine https://skirata.pro/#/japlus

Regards

mmorrisontx commented 3 years ago

Ah, I didn't realize this was one of the protocols where we strip color codes. Seems like a bug that we treat players and bots differently :)

podrivo commented 10 months ago

This seems something specific to Quake and has no other issues around this subject. Also, removing colors extra char from the object seems the correct approach. I guess this is safe to close.