Austinb / GameQ

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

Terraria Support #86

Closed Ruok2bu closed 11 years ago

Ruok2bu commented 11 years ago

Can you add Terraria support?

I did some research into the query protocol and found an incredibly detailed whitepaper.

Feast your eyes on this:

http://seancode.com/terrafirma/net.html

Austinb commented 11 years ago

This looks like it will take some time to break down and look into. From what I have seen there doesnt appear to be a "standard" server query mechanism so I am not sure. Ref: http://www.terrariaonline.com/threads/querying-a-server-for-statistics.31433/

Ruok2bu commented 11 years ago

There's an admin tool plugin for Terraria that includes query support.

Here's a link to a PHP script that has the code for querying the server.

http://tshock.co/xf/index.php?threads/rest-tshock-server-status-image.430/

gil-- commented 11 years ago

The actual protocol for tshock: https://tshock.atlassian.net/wiki/display/TSHOCKPLUGINS/REST+API+Endpoints#RESTAPIEndpoints-/status

KostyaEsmukov commented 11 years ago

So, let me summarize what do we have for now. Terraria doesn't have server browser, you have to type IP in order to join server. As said before, it doesn't has any way to query it like other servers. I found only one online terraria servers list which supports monitoring - it is http://terrarianet.com This site sends simple packet: "\x0d\x00\x00\x00\x19\x2e\x2e\x2e\x2e/playing". According to the protocol description referenced above it is a chat command. Vanilla server sends comma-separated list of players and generates warning, because it receives chat message from non-connected "player". Tshock servers recognize this packet as "terraria net scanbot" and send current and maximum number of players with comma-separated list of players. It is also possible to get server name by sending "\x01\x00\x00\x00\x06". That's all we can do to get information directly from server. Tshock (as I figured out it is something like craftbukkit but for terraria) provides REST API which lets us get all information about server what we can ever need using simple HTTP request in JSON. This is the best solution to our problem. The link should look like this: "/v2/server/status?players=true&rules=true". In two-three days I'll commit Tshock protocol to my library.