Austinb / GameQ

A PHP Gameserver Status Query Library
https://austinb.github.io/GameQ/
GNU Lesser General Public License v3.0
404 stars 137 forks source link

support for Excessive Plus #491

Closed byman64 closed 2 years ago

byman64 commented 5 years ago

I created a monitor with your nice class and I am not able to read Team_Red and Team_Blue from clanV server. It is an Excessive Plus server.

I hope someone can help me

thx

uilson commented 5 years ago

My guess is that the problem is not related to gameq.. as you are not using it, but using a custom class. or are you using it?

anyway. they don't send the necessary variables in the request to tell you what players belong to what team. That variables being : "players_blue" and "players_red"

So you need to use their class to list their server..

Edit:

after a quick look ate their spider.class.php:

they send the information in the variable "info":

[Info] => ] 1 2 3 1 1 2 1 6 PL DE NL ES FR DE PS ] ht ] ] ] ] ]

And is decoded in that file (spider.class.php) in this part:

                  // parse Excessive Plus compressed info

if ( isset($cvars['info']) && ($matches = explode("\t", $cvars['info']['value'])) ) { $i = 0;

            // map info
            $cvars['map_time']['value'] = $this->unpack_int($matches[$i++]);
            $cvars['map_status']['value'] = $this->unpack_int($matches[$i++]);

            // team info
            if ( $cvars['g_gametype']['value'] >= 3 ) {
                $match = explode(' ', $matches[$i++]);

                $cvars['score_red']['value'] = $this->unpack_int($match[0]);
                $cvars['score_blue']['value'] = $this->unpack_int($match[1]);
            }

            // player team + flags
            $info_flags = explode(' ', $matches[$i++]);
            @array_pop($info_flags);

            foreach ( (array)$info_flags as $id => $info_flag ) {
                $info_flag = $this->unpack_int($info_flag);

                $info_team = $info_flag & ~(4 | 8 | 16 | 32);
                $info_flag -= $info_team;

                $players[$id]['team'] = $info_team;
                $players[$id]['flags'] = $info_flag;
            }

            // player tld
            $info_tlds = explode(' ', $matches[$i++]);
            @array_pop($info_tlds);

            foreach ( (array)$info_tlds as $id => $info_tld ) {
                $players[$id]['tld'] = strtolower($info_tld);
            }

            // player time
            $info_times = explode(' ', $matches[$i++]);
            @array_pop($info_times);

            foreach ( (array)$info_times as $id => $info_time ) {
                $players[$id]['time'] = $this->unpack_int($info_time);
            }

            // unset the cvar, it does not contain any "human readable" information
            unset($cvars['info']);
        }
byman64 commented 5 years ago

Thx for your quick reply, I was reading jsut now the spider class.

You are right, it's not a gameQ issue, they use that info with packed data.

Maybe gameQ would be include the decode of variables if mod is excessive?

I am going to try to include part of spider class on my monitor.

Thanks a lot your help, real useful.

grazie mille

Austinb commented 5 years ago

The base of the querying appears to be a simple udp request for getstatus like Quake2. Looks like the exact same query payload.

if ( $fp = @fsockopen('udp://'. $host, $port, $errno, $errstr, $timeout / 1000) ) {
            stream_set_timeout($fp, 0, $timeout * 1000);

            fwrite($fp, "\xFF\xFF\xFF\xFFgetstatus\n");
...

You may be able to use the Quake2.php protocol class as a starting point you could even try running the server query using the quake2 protocol designation and see if it works or chokes on the responses. Make sure you turn on debugging so you can see the errors returned otherwise it will just return and empty response as if the server is offline. If you get it to work feel free to make a pull request as a new class and it can be merged into the base library.

If you have a server that you can query using the spider class please post that info, or you can send it to me private, and I can take a quick stab when I have a few minutes free. Due for another round of updates on this library anyway so updates will be coming up in the next few days (hopefully).

byman64 commented 5 years ago

The base of the querying appears to be a simple udp request for getstatus like Quake2. Looks like the exact same query payload.

if ( $fp = @fsockopen('udp://'. $host, $port, $errno, $errstr, $timeout / 1000) ) {
          stream_set_timeout($fp, 0, $timeout * 1000);

          fwrite($fp, "\xFF\xFF\xFF\xFFgetstatus\n");
...

You may be able to use the Quake2.php protocol class as a starting point you could even try running the server query using the quake2 protocol designation and see if it works or chokes on the responses. Make sure you turn on debugging so you can see the errors returned otherwise it will just return and empty response as if the server is offline. If you get it to work feel free to make a pull request as a new class and it can be merged into the base library.

If you have a server that you can query using the spider class please post that info, or you can send it to me private, and I can take a quick stab when I have a few minutes free. Due for another round of updates on this library anyway so updates will be coming up in the next few days (hopefully).

Let me say, uilson reply is correct.

I am making some test just now using the Quake3 protocol and trying to decode the "info" variable received also from gameQ,

Well, I am using part of spider.class.php, same puplished from uilson + the full copy as of method-function unpack_int().

I am already able to get team data from info var ;-) I am just using vs code + debug.

Now I only need to adapt the and add the team data to the players array returned from gameQ.

What we can do to manage the team data with gameQ? OSP OSP write the players team info in the main array, something like this one [Players_Blue] => 1 2 5 [Players_Red] => 3 4 6 [Score_Blue] => 1 [Score_Red] => 0 [Score_Time] => 18:28 note: 1 2 5 and 3 4 6 are not the players ID but the players array index + 1 So if players[0] is a blue team, and players[4] is red and so on

EXCESSIVE Decode the info var using part of spider.class decoding the info var

For both mod OSP and EXCESSIVE we should write in the result array with the same way at players array level.

I hope is clear what I mean This sample page show in the 2nd an OSP server TDM freeze and in the 3rd column an Excessive Plus server. please take a look.

what do you think?

Austinb commented 5 years ago

I am not fully understanding why the one server you are trying to get information from 195.201.140.129:27960 has a different return data than other servers on that same list such as quakeum.com:5555. The quakeum.com:5555 server returns the team scores as well as which players are on which team and does not use the Info field to pass more data which you have to jump through more hoops to decipher. Are these two servers running different mods?

byman64 commented 5 years ago

Yes, 1 server is OSP mod and 1 excessive plus (info var to be decode)…

QooL Spirit Antonino Migliore

Da: Austin Bischoff Inviato: martedì 17 settembre 2019 01:59 A: Austinb/GameQ Cc: byman64; Author Oggetto: Re: [Austinb/GameQ] support for Excessive Plus (#491)

I am not fully understanding why the one server you are trying to get information from 195.201.140.129:27960 has a different return data than other servers on that same list such as quakeum.com:5555. The quakeum.com:5555 server returns the team scores as well as which players are on which team and does not use the Info field to pass more data which you have to jump through more hoops to decipher. Are these two servers running different mods? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

byman64 commented 5 years ago

Finally my monitor can decode Info var to read team data from Freeze Excessive Plus.

I used part of spider.class.php

There are others server with no info for team or with wrong :-(

Clanv server works fine...it is excessive freeze server. https://www.quakearea.com/mon thx to all