1 | <?php |
||
19 | class MapRatings implements ListenerInterfaceExpApplication, ListenerInterfaceMpScriptMatch, |
||
20 | ListenerInterfaceMpScriptMap, ListenerInterfaceMpLegacyChat |
||
21 | { |
||
22 | /** |
||
23 | * @var MapStorage |
||
24 | */ |
||
25 | private $mapStorage; |
||
26 | /** |
||
27 | * @var PlayerStorage |
||
28 | */ |
||
29 | private $playerStorage; |
||
30 | |||
31 | /** |
||
32 | * @var Group |
||
33 | */ |
||
34 | private $players; |
||
35 | /** |
||
36 | * @var MapRatingsService |
||
37 | */ |
||
38 | private $mapRatingsService; |
||
39 | /** |
||
40 | * @var LoggerInterface |
||
41 | */ |
||
42 | private $logger; |
||
43 | |||
44 | /** |
||
45 | * MapRatingService constructor. |
||
46 | * @param MapStorage $mapStorage |
||
47 | * @param PlayerStorage $playerStorage |
||
48 | * @param MapRatingsService $mapRatingsService |
||
49 | * @param Group $players |
||
50 | * @param LoggerInterface $logger |
||
51 | */ |
||
52 | public function __construct( |
||
66 | |||
67 | /** |
||
68 | * Called when a player chats. |
||
69 | * |
||
70 | * @param Player $player |
||
71 | * @param $text |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | public function onPlayerChat(Player $player, $text) |
||
95 | |||
96 | /** |
||
97 | * helper function to load mapratings for current map |
||
98 | * @param Map $map |
||
99 | */ |
||
100 | private function loadRatings(Map $map) |
||
108 | |||
109 | private function saveRatings() |
||
117 | |||
118 | /** |
||
119 | * called at eXpansion init |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | public function onApplicationInit() |
||
127 | |||
128 | /** |
||
129 | * called when init is done and callbacks are enabled |
||
130 | * |
||
131 | * @return void |
||
132 | */ |
||
133 | public function onApplicationReady() |
||
137 | |||
138 | /** |
||
139 | * called when requesting application stop |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | public function onApplicationStop() |
||
147 | |||
148 | /** |
||
149 | * Callback sent when the "StartMatch" section start. |
||
150 | * |
||
151 | * @param int $count Each time this section is played, this number is incremented by one |
||
152 | * @param int $time Server time when the callback was sent |
||
153 | * |
||
154 | * @return void |
||
155 | */ |
||
156 | public function onStartMatchStart($count, $time) |
||
160 | |||
161 | /** |
||
162 | * Callback sent when the "StartMatch" section end. |
||
163 | * |
||
164 | * @param int $count Each time this section is played, this number is incremented by one |
||
165 | * @param int $time Server time when the callback was sent |
||
166 | * |
||
167 | * @return void |
||
168 | */ |
||
169 | public function onStartMatchEnd($count, $time) |
||
173 | |||
174 | /** |
||
175 | * Callback sent when the "EndMatch" section start. |
||
176 | * |
||
177 | * @param int $count Each time this section is played, this number is incremented by one |
||
178 | * @param int $time Server time when the callback was sent |
||
179 | * |
||
180 | * @return void |
||
181 | */ |
||
182 | public function onEndMatchStart($count, $time) |
||
186 | |||
187 | /** |
||
188 | * Callback sent when the "EndMatch" section end. |
||
189 | * |
||
190 | * @param int $count Each time this section is played, this number is incremented by one |
||
191 | * @param int $time Server time when the callback was sent |
||
192 | * |
||
193 | * @return void |
||
194 | */ |
||
195 | public function onEndMatchEnd($count, $time) |
||
199 | |||
200 | /** |
||
201 | * Callback sent when the "StartTurn" section start. |
||
202 | * |
||
203 | * @param int $count Each time this section is played, this number is incremented by one |
||
204 | * @param int $time Server time when the callback was sent |
||
205 | * |
||
206 | * @return void |
||
207 | */ |
||
208 | public function onStartTurnStart($count, $time) |
||
212 | |||
213 | /** |
||
214 | * Callback sent when the "StartTurn" section end. |
||
215 | * |
||
216 | * @param int $count Each time this section is played, this number is incremented by one |
||
217 | * @param int $time Server time when the callback was sent |
||
218 | * |
||
219 | * @return void |
||
220 | */ |
||
221 | public function onStartTurnEnd($count, $time) |
||
225 | |||
226 | /** |
||
227 | * Callback sent when the "EndMatch" section start. |
||
228 | * |
||
229 | * @param int $count Each time this section is played, this number is incremented by one |
||
230 | * @param int $time Server time when the callback was sent |
||
231 | * |
||
232 | * @return void |
||
233 | */ |
||
234 | public function onEndTurnStart($count, $time) |
||
238 | |||
239 | /** |
||
240 | * Callback sent when the "EndMatch" section end. |
||
241 | * |
||
242 | * @param int $count Each time this section is played, this number is incremented by one |
||
243 | * @param int $time Server time when the callback was sent |
||
244 | * |
||
245 | * @return void |
||
246 | */ |
||
247 | public function onEndTurnEnd($count, $time) |
||
251 | |||
252 | /** |
||
253 | * Callback sent when the "StartRound" section start. |
||
254 | * |
||
255 | * @param int $count Each time this section is played, this number is incremented by one |
||
256 | * @param int $time Server time when the callback was sent |
||
257 | * |
||
258 | * @return void |
||
259 | */ |
||
260 | public function onStartRoundStart($count, $time) |
||
264 | |||
265 | /** |
||
266 | * Callback sent when the "StartRound" section end. |
||
267 | * |
||
268 | * @param int $count Each time this section is played, this number is incremented by one |
||
269 | * @param int $time Server time when the callback was sent |
||
270 | * |
||
271 | * @return void |
||
272 | */ |
||
273 | public function onStartRoundEnd($count, $time) |
||
277 | |||
278 | /** |
||
279 | * Callback sent when the "EndMatch" section start. |
||
280 | * |
||
281 | * @param int $count Each time this section is played, this number is incremented by one |
||
282 | * @param int $time Server time when the callback was sent |
||
283 | * |
||
284 | * @return void |
||
285 | */ |
||
286 | public function onEndRoundStart($count, $time) |
||
290 | |||
291 | /** |
||
292 | * Callback sent when the "EndMatch" section end. |
||
293 | * |
||
294 | * @param int $count Each time this section is played, this number is incremented by one |
||
295 | * @param int $time Server time when the callback was sent |
||
296 | * |
||
297 | * @return void |
||
298 | */ |
||
299 | public function onEndRoundEnd($count, $time) |
||
303 | |||
304 | |||
305 | /** |
||
306 | * Callback sent when the "StartMap" section start. |
||
307 | * |
||
308 | * @param int $count Each time this section is played, this number is incremented by one |
||
309 | * @param int $time Server time when the callback was sent |
||
310 | * @param boolean $restarted true if the map was restarted, false otherwise |
||
311 | * @param Map $map Map started with. |
||
312 | * |
||
313 | * @return void |
||
314 | */ |
||
315 | public function onStartMapStart($count, $time, $restarted, Map $map) |
||
323 | |||
324 | /** |
||
325 | * Callback sent when the "StartMap" section end. |
||
326 | * |
||
327 | * @param int $count Each time this section is played, this number is incremented by one |
||
328 | * @param int $time Server time when the callback was sent |
||
329 | * @param boolean $restarted true if the map was restarted, false otherwise |
||
330 | * @param Map $map Map started with. |
||
331 | * |
||
332 | * @return void |
||
333 | */ |
||
334 | public function onStartMapEnd($count, $time, $restarted, Map $map) |
||
338 | |||
339 | /** |
||
340 | * Callback sent when the "EndMap" section start. |
||
341 | * |
||
342 | * @param int $count Each time this section is played, this number is incremented by one |
||
343 | * @param int $time Server time when the callback was sent |
||
344 | * @param boolean $restarted true if the map was restarted, false otherwise |
||
345 | * @param Map $map Map started with. |
||
346 | * |
||
347 | * @return void |
||
348 | */ |
||
349 | public function onEndMapStart($count, $time, $restarted, Map $map) |
||
353 | |||
354 | /** |
||
355 | * Callback sent when the "EndMap" section end. |
||
356 | * |
||
357 | * @param int $count Each time this section is played, this number is incremented by one |
||
358 | * @param int $time Server time when the callback was sent |
||
359 | * @param boolean $restarted true if the map was restarted, false otherwise |
||
360 | * @param Map $map Map started with. |
||
361 | * |
||
362 | * @return void |
||
363 | */ |
||
364 | public function onEndMapEnd($count, $time, $restarted, Map $map) |
||
368 | |||
369 | } |
||
370 |