-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINTERFACE
92 lines (74 loc) · 4.38 KB
/
INTERFACE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
This file describes the interface messages between we-bridge server and client.
These messages are sent from server to user by means of Google App Engine Channel API. Each messages describes some change in application state be it new player taking place at the table or declearer claiming certain deal result. Messages are JSON objects. Each message contains 2 fields: 'type' and 'data'. 'type' is string, while 'data' is object.
Messages :
01. Type: 'table.add'
Description: Table was added to the table list in the hall
Data: 'tid':string - table id
'N':string - user id of user sitting on North
'E':string - user id of user sitting on East
'S':string - user id of user sitting on South
'W':string - user id of user sitting on West
'kibcount':numerical - number of kibitzers at this table
02. Type: 'table.remove'
Description: Table was removed from table list in the hall
Data: 'tid':string - table id
03. Type: 'player.sit'
Description: Player took place at some table
Data: 'tid':string - table id
'name':string - username
'position':string - position taken at table. One of 'N', 'E', 'S' or 'W'
04. Type: 'player.leave'
Description: Player left some table
Data: 'tid':string - table id
'position':string - position cleared. One of 'N', 'E', 'S' or 'W'
05. Type: 'chat.add'
Description: Add new chat window
Data: 'wid':string - chat window id, usually chat partner user id
'title':string - title of the chat window - visible on screen
06. Type: 'chat.message'
Description: Message is sent through we-bridge chat system
Data: 'wid':string - chat window id. Message will be shown in chat window with this id
'sender':string - issuer of the message name. Could be empty in certain cases, like in p2p chats
'message':string - URI encoded message text
07. Type: 'hand'
Description: Show cards for particular player
Data: 'side':string - side whoose hand is to be shown
'cards':list of number - each number represents a card. 0 is 2 of clubs, 1 is 3 of club 51 - for ace of spades
08. Type: 'start.bidding'
Description: All the places are taken and players can start bidding
Data: 'dealer':string - side which starts bidding in this round. One of 'N', 'E', 'S' or 'W'
09. Type: 'bid'
Description: Bid done by one of the players
Data: 'side':string - bid issuer side. One of 'N', 'E', 'S' or 'W'
'bid':string - bid itself. Value bids are of the form <level><suit> where level is a number from 1 to 7 and suit is one of 'C', 'D', 'H', 'S', 'Z' for clubs, diamonds, hearts, spades and no-trump. Could also be one of 'pass', 'dbl' or 'rdbl'
'alert':string - arbitary message accompaning bid
'dbl_mode':string - is double or redouble allowed for next bidder. Could be 'dbl' or 'rdbl'
10. Type: 'start.play'
Description: Bidding is over. Start play
Data: 'contract':string - <level><suit>[X|XX]. <level> and <suit> same as for bid message. X and XX stand for double and redouble resp.
'lead':string - indicates whose lead is it One of 'N', 'E', 'S' or 'W'
11. Type: 'move'
Description: Move done by one of the players
Data: 'side':string - the one who done the move. One of 'N', 'E', 'S' or 'W'
'card':string - card itself. Card is represented by numbers from 0 (2 of clubs) to 51 (ace of spades)
'allowed':string - suit allowed for move. Sent only to the player whose turn is next. If any suit is allowed then string 'all' is sent
'trick':int - '+1' or '-1' if move changes made a trick for player or opponents resp.
12. Type: 'tricks'
Description: Trick count. Usually sent on refresh
Data: 'NS':int - trick count for NS
'EW':int - trick count for EN
13. Type: 'claim'
Description: someone claimed certain number of tricks
Data: 'side':string - claimant side. One of 'N', 'E', 'S' or 'W'
'tricks':int - trick count claim
'result':int - result which deal would have if claim accepted. For info only
14. Type: 'claim.decline'
Description: claim is declined
Data: none
15. Type: 'end.play'
Description: deal is over
Data: 'contract':string - contract played same as in 'start.play' massage + one additional option 'pass' for passed out deals
'declearer':string - One of 'N', 'E', 'S' or 'W'
'points':int - deal result in points
'tricks':int - how many tricks
'protocol_url':string - url where protocol could be observed