[TC] Gaming Forums
[TC] Gaming API : General Discussion - Printable Version

+- [TC] Gaming Forums (https://forum.city-driving.co.uk)
+-- Forum: General Information (/forumdisplay.php?fid=1)
+--- Forum: General Discussions (/forumdisplay.php?fid=4)
+---- Forum: Developer Forum (/forumdisplay.php?fid=221)
+---- Thread: [TC] Gaming API : General Discussion (/showthread.php?tid=27254)

Pages: 1 2


[TC] Gaming API : General Discussion - Pete - 2017-08-28 22:20

[Image: tc-gaming-api.png]

General Discussion



Use this thread for any discussions related to our API.

For specific questions, please open a new thread.


RE: [TC] Gaming API : General Discussion - Kyle - 2017-08-28 23:07

Link needs to be added Smile


RE: [TC] Gaming API : General Discussion - Pete - 2017-08-28 23:09

Chuck will add that in the morning. Thanks.

Also, I merged your pull request and also spotted another error but the GitBook servers are having trouble so the build is taking a while. Those changes should be live soon.


RE: [TC] Gaming API : General Discussion - Kyle - 2017-08-29 07:23

Dunno if it's my end, but I can't seem to see the updated version of the stats API page? Still showing the old href :/


RE: [TC] Gaming API : General Discussion - Chuck - 2017-08-29 08:33

The API might be slightly behind due to the very recent updates. That'll be solved very soon.


RE: [TC] Gaming API : General Discussion - Pete - 2017-08-29 11:06

(2017-08-29 07:23)Jack Wrote:  Dunno if it's my end, but I can't seem to see the updated version of the stats API page? Still showing the old href :/
(2017-08-28 23:09)Pete Wrote:  Also, I merged your pull request and also spotted another error but the GitBook servers are having trouble so the build is taking a while. Those changes should be live soon.

The updates are there now.


RE: [TC] Gaming API : General Discussion - Pete - 2017-09-09 17:52

The new roleplay stats have been added to the citydriving/profile/get API.


RE: [TC] Gaming API : General Discussion - Pete - 2018-12-23 21:24

API updated after recent InSim update (v4.3).

API Now also includes endpoint for the current Gumball table, see: https://apidocs.tc-gaming.co.uk/apis/citydriving-statistics-api/statistics-api#gumball


RE: [TC] Gaming API : General Discussion - Pete - 2018-12-26 13:42

API updated after recent InSim update (v4.31).

/citydriving/profile/get

Removed:

Code:
hasRadarWarner
hasLocator
hasWinch

Added:

Code:
&properties=0|1
&upgrades=0|1

/citydriving/carinfo

Added:

Code:
&upgrades=0|1

/citydriving/market

Added:

Code:
&upgrades=0|1



RE: [TC] Gaming API : General Discussion - Kyle - 2018-12-26 14:24

Since TC World reports if the user is banned and days remaining, is it possible to get this implemented to the API?


RE: [TC] Gaming API : General Discussion - kxait - 2018-12-29 22:23

Here's a proof of concept for an application that works both with InSim and the [TC] API. It shows how much money one has earned/lost during the session.

[Image: 5lStmt4.png]

Since the API only allows 720 request per hour, it pulls the data every 10 seconds.


RE: [TC] Gaming API : General Discussion - Pete - 2018-12-29 22:47

Nice one. Got any ideas for other InSim apps in mind?


RE: [TC] Gaming API : General Discussion - Adorable - 2018-12-29 22:58

(2018-12-29 22:47)Pete Wrote:  Nice one. Got any ideas for other InSim apps in mind?

Since you're interested in a Node / ReactJS Project, you can build an InSim Application and make it look attractive with Electron.

Post session stats would be awesome, for example, money gains / loss, where did the money go? which cars you drove most during the session? has your average speed gotten better in comparison with previous sessions? Market integration, real time view of online players, 0-60 times, a server login queue, a chat and many more. there is potential.

That would make for a nice application for TC'ers to use, and a good practice for ES6.

There are some npm packages you could look into to serialize data into byte arrays so that they could be transmitted to LFS, examples: https://www.npmjs.com/package/c-struct



@kxait - I read somewhere that you're looking for a way to lookup number of players connected to a host, you could get that information from here: https://www.lfsworld.net/hoststatus/?h=[TC]%20CityDriving%20One&onlycontent


RE: [TC] Gaming API : General Discussion - kxait - 2018-12-30 18:40

Here's another, bit more simple. [TC] serverlist
[Image: oRzJndZ.png]

@Adorable - I used the [TC] API cause I'm too lazy for parsing HTML lol


RE: [TC] Gaming API : General Discussion - eVo - 2018-12-30 21:34

Well, as I'm programming a bit, maybe I'll try to learn Node / ReactJS language, and create something, if I'm good at it Wink. (currently, I'm learning ncurses language, which is apart from InSim / [TC] API)


RE: [TC] Gaming API : General Discussion - Adorable - 2018-12-30 22:46

(2018-12-30 18:40)kxait Wrote:  @Adorable - I used the [TC] API cause I'm too lazy for parsing HTML lol

You can do it in 1 line actually, here's my approach so that you could spare more API requests, also I think this is the fastest source.

https://www.lfsworld.net/hoststatus/?h=hostname
Code:
int players = Convert.ToInt32(Regex.Split(Regex.Split(response, "Conns</div><div class=\"Field2\">")[1], " / 40")[0]);

Your interfaces are awesome, I like how you're keeping things similar to what Chuck/Elmo are building!



In the meanwhile, I've been fiddling with Node, here's what I've been up to, it's a start:




RE: [TC] Gaming API : General Discussion - Pete - 2018-12-30 23:46

Cool!

Instead of posting screenshots, you could post GitHub Gists instead. The support multiple files these days: https://gist.github.com

I'd like to try writing an InSim app with Node, but I'm not sure I'd even bother writing an Electron interface. I'd probably just do some CLI.

Creating your socket connection half way down your code made me shudder though!

Also, why did you decide to use cppmsg-dynamic over c-struct?


RE: [TC] Gaming API : General Discussion - Adorable - 2018-12-31 00:23

I've found that the cppmsg-dynamic module could match everything that c-struct is capable of, and do more, like support out of the box for nested structures (example the CompCar struct inside IS_MCI, a struct inside a struct).

It also supports more data types (double, float, arrays...).

Good luck with your project!

€: if only LFS used something like Google's protobuf Rolleyes


RE: [TC] Gaming API : General Discussion - kxait - 2020-01-06 19:38

(2018-12-30 23:46)Pete Wrote:  snip
Quoted for attention
I've a problem with the API. I was very frustrated to find that the API only returns total money for given user, not cash and balance separately. Either change it back, or change the API docs which led me on: https://apidocs.tc-gaming.co.uk/apis/citydriving-statistics-api/user-profile-api#get-a-user-profile


RE: [TC] Gaming API : General Discussion - Sadie - 2020-01-06 21:28

(2020-01-06 19:38)kxait Wrote:  
(2018-12-30 23:46)Pete Wrote:  snip
Quoted for attention
I've a problem with the API. I was very frustrated to find that the API only returns total money for given user, not cash and balance separately. Either change it back, or change the API docs which led me on: https://apidocs.tc-gaming.co.uk/apis/citydriving-statistics-api/user-profile-api#get-a-user-profile

This is purposely done after !steal was implemented to avoid people creating programs that automatically notifies about AFK players with larger amounts of cash on them.