cscorley / killer-queen

A Django app for Killer Queen league registration, team mixing, and (manual) stat tracking
2 stars 0 forks source link

Use websockets to start cab in tournament mode #51

Open cscorley opened 6 years ago

cscorley commented 6 years ago

On connect, it may need some validation. The tournament mode starts with this message: ![k[connect],v[{"name":"1","isGameMachine":false}]]!

Responds with: ![k[connected],v[9]]!

The value in the response seems to vary.


Login verifies over plain-text (lol)

![k[adminlogin],v[beegame]]!

Response: ![k[loginevent],v[1]]!


It will then ping status every 5 seconds (this is likely not needed): ![k[im alive],v[1]]!


Getting current tournament status

![k[get],v[tournamentstatus]]!

Response: ![k[tournamentstatus],v[0,1]]!


Starts a round robin

![k[tstart],v[{"format":"r","name":"testatest","location":"test","teams":["test1","test2"],"bestOf":"1,1,1","swissround":1,"warmup":"60"}]]!

It should respond with the game state: ![k[bracket],v[{"tournament_name":"testatest","tournament_location":"test","format":"r","concluded":false,"stream_url":"","brackets":[{"bracket_type":"r","rounds":[{"round_num":0,"sets":[{"id":1,"best_of":1,"on_machine_name":"","start_time":"","teams":[{"name":"test1","score":0},{"name":"test2","score":0}],"victory_types":[],"match_data_id":[]}]}]}],"standings":[{"name":"test1","point":0,"win":0,"loss":0},{"name":"test2","point":0,"win":0,"loss":0}]}]]!

and also a start status:

![k[tstart],v[{"start":"True","format":"r","tournamentname":"testatest","message":"Can not connect to Database, bracket will only be locally saved."}]]!


Different formats:

{r:"round robin", w:"swiss", d:"double elimination", s:"single elimination", m:"manual"};

Manual sends this: ![k[tstart],v[{"format":"m","name":"manualtesting","location":"","teams":["team 1","team 2","team 3"],"bestOf":"1,1,1","swissround":2,"warmup":"60"}]]!


This ends tournament: ![k[restarttourney],v[]]!

It should respond with: ![k[restarttourney],v[r,testatest,test,1,1,1,test1,test2]]!


Disconnect messages are sent as well:

![k[Disconnect],v[]]!

cscorley commented 6 years ago

"swissround":2 seems to be determined by either the number of swiss rounds in swiss, or the number of teams - 1 in other modes. Not sure if this has any real use outside of swiss...

cscorley commented 6 years ago

![k[loginevent],v[1]]! value is 1 if a tournament has started and we have something to display, 0 otherwise if no tournament is started