|
1 | 1 | package controller
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "encoding/json" |
4 | 5 | "fmt"
|
5 | 6 | "time"
|
6 | 7 | )
|
@@ -92,72 +93,25 @@ type EventModifyCardTime struct {
|
92 | 93 | type EventModifyValue struct {
|
93 | 94 | ForTeam Team `json:"forTeam"`
|
94 | 95 |
|
95 |
| - Goals *int `json:"goals"` |
96 |
| - Goalie *int `json:"goalie"` |
97 |
| - YellowCards *int `json:"yellowCards"` |
98 |
| - YellowCardTime *EventModifyCardTime `json:"yellowCardTime"` |
99 |
| - RedCards *int `json:"redCards"` |
100 |
| - TimeoutsLeft *int `json:"timeoutsLeft"` |
101 |
| - TimeoutTimeLeft *string `json:"timeoutTimeLeft"` |
102 |
| - OnPositiveHalf *bool `json:"onPositiveHalf"` |
103 |
| - TeamName *string `json:"teamName"` |
104 |
| - FoulCounter *int `json:"foulCounter"` |
105 |
| - BallPlacementFailures *int `json:"ballPlacementFailures"` |
106 |
| - CanPlaceBall *bool `json:"canPlaceBall"` |
107 |
| - Division *Division `json:"division"` |
108 |
| - AutoContinue *bool `json:"autoContinue"` |
| 96 | + Goals *int `json:"goals,omitempty"` |
| 97 | + Goalie *int `json:"goalie,omitempty"` |
| 98 | + YellowCards *int `json:"yellowCards,omitempty"` |
| 99 | + YellowCardTime *EventModifyCardTime `json:"yellowCardTime,omitempty"` |
| 100 | + RedCards *int `json:"redCards,omitempty"` |
| 101 | + TimeoutsLeft *int `json:"timeoutsLeft,omitempty"` |
| 102 | + TimeoutTimeLeft *string `json:"timeoutTimeLeft,omitempty"` |
| 103 | + OnPositiveHalf *bool `json:"onPositiveHalf,omitempty"` |
| 104 | + TeamName *string `json:"teamName,omitempty"` |
| 105 | + FoulCounter *int `json:"foulCounter,omitempty"` |
| 106 | + BallPlacementFailures *int `json:"ballPlacementFailures,omitempty"` |
| 107 | + CanPlaceBall *bool `json:"canPlaceBall,omitempty"` |
| 108 | + Division *Division `json:"division,omitempty"` |
| 109 | + AutoContinue *bool `json:"autoContinue,omitempty"` |
109 | 110 | }
|
110 | 111 |
|
111 | 112 | func (m EventModifyValue) String() string {
|
112 |
| - str := "modify" |
113 |
| - if m.ForTeam != TeamUnknown { |
114 |
| - str += fmt.Sprintf(" for team %v:", m.ForTeam) |
115 |
| - } else { |
116 |
| - str += ":" |
117 |
| - } |
118 |
| - if m.Goals != nil { |
119 |
| - return fmt.Sprintf("%v Goals=%v", str, *m.Goals) |
120 |
| - } |
121 |
| - if m.Goalie != nil { |
122 |
| - return fmt.Sprintf("%v Goalie=%v", str, *m.Goalie) |
123 |
| - } |
124 |
| - if m.YellowCards != nil { |
125 |
| - return fmt.Sprintf("%v YellowCards=%v", str, *m.YellowCards) |
126 |
| - } |
127 |
| - if m.YellowCardTime != nil { |
128 |
| - return fmt.Sprintf("%v YellowCardTime=%v", str, *m.YellowCardTime) |
129 |
| - } |
130 |
| - if m.RedCards != nil { |
131 |
| - return fmt.Sprintf("%v RedCards=%v", str, *m.RedCards) |
132 |
| - } |
133 |
| - if m.TimeoutsLeft != nil { |
134 |
| - return fmt.Sprintf("%v TimeoutsLeft=%v", str, *m.TimeoutsLeft) |
135 |
| - } |
136 |
| - if m.TimeoutTimeLeft != nil { |
137 |
| - return fmt.Sprintf("%v TimeoutTimeLeft=%v", str, *m.TimeoutTimeLeft) |
138 |
| - } |
139 |
| - if m.OnPositiveHalf != nil { |
140 |
| - return fmt.Sprintf("%v OnPositiveHalf=%v", str, *m.OnPositiveHalf) |
141 |
| - } |
142 |
| - if m.TeamName != nil { |
143 |
| - return fmt.Sprintf("%v TeamName=%v", str, *m.TeamName) |
144 |
| - } |
145 |
| - if m.FoulCounter != nil { |
146 |
| - return fmt.Sprintf("%v FoulCounter=%v", str, *m.FoulCounter) |
147 |
| - } |
148 |
| - if m.BallPlacementFailures != nil { |
149 |
| - return fmt.Sprintf("%v BallPlacementFailures=%v", str, *m.BallPlacementFailures) |
150 |
| - } |
151 |
| - if m.CanPlaceBall != nil { |
152 |
| - return fmt.Sprintf("%v CanPlaceBall=%v", str, *m.CanPlaceBall) |
153 |
| - } |
154 |
| - if m.Division != nil { |
155 |
| - return fmt.Sprintf("%v Division=%v", str, *m.Division) |
156 |
| - } |
157 |
| - if m.AutoContinue != nil { |
158 |
| - return fmt.Sprintf("%v AutoContinue=%v", str, *m.AutoContinue) |
159 |
| - } |
160 |
| - return fmt.Sprintf("%v undefined", str) |
| 113 | + b, _ := json.Marshal(&m) |
| 114 | + return string(b) |
161 | 115 | }
|
162 | 116 |
|
163 | 117 | // EventTrigger is an event that can be applied
|
|
0 commit comments