-
Notifications
You must be signed in to change notification settings - Fork 0
/
draftstate.go
40 lines (29 loc) · 1.03 KB
/
draftstate.go
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
package main
type DraftState struct {
// bidder id of the current bidder with highest bid
CurrentBidderId string `json:"currentBidderId"`
// current player up for bid
CurrentPlayerName string `json:"currentPlayerName"`
// current highest bid
CurrentBid int `json:"currentBid"`
// current nominator
CurrentNominatorId string `json:"currentNominatorId"`
// if draft is active
Running bool `json:"draftRunning"`
// if draft is paused
Paused bool `json:"paused"`
// if we are currently nominating
nominating bool
// if we are currently bidding
bidding bool
}
func sendDraftState(s *Subscriber, h *DraftHub) {
response := Response{"INIT_DRAFT_STATE", map[string]interface{}{"draftState": h.draftState}}
response_json := responseToJson(response)
sendMessageToSubscriber(h, s, response_json)
}
func braodcastDraftState(h *DraftHub) {
response := Response{"INIT_DRAFT_STATE", map[string]interface{}{"draftState": h.draftState}}
response_json := responseToJson(response)
broadcastMessage(h, response_json)
}