1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace eXpansion\Framework\GameTrackmania\DataProviders; |
4
|
|
|
|
5
|
|
|
use eXpansion\Framework\Core\DataProviders\AbstractDataProvider; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class RaceDataProvider |
10
|
|
|
* |
11
|
|
|
* @package eXpansion\Framework\GameTrackmania\DataProviders; |
12
|
|
|
* @author reaby |
13
|
|
|
*/ |
14
|
|
|
class PlayerEventsDataProvider extends AbstractDataProvider |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param $params |
19
|
|
|
* [ |
20
|
|
|
* "{ |
21
|
|
|
* "time": 123456 //< Server time when the event occured, |
22
|
|
|
* "login": "PlayerLogin", |
23
|
|
|
* "nbrespawns": 5, //< Number of respawns since the beginning of the race |
24
|
|
|
* "racetime": 123456, //< Total race time in milliseconds |
25
|
|
|
* "laptime": 45678, //< Lap time in milliseconds |
26
|
|
|
* "stuntsscore": 3457, //< Stunts score |
27
|
|
|
* "checkpointinrace": 13, //< Number of checkpoints crossed since the beginning of the race |
28
|
|
|
* "checkpointinlap": 4, //< Number of checkpoints crossed since the beginning of the lap |
29
|
|
|
* "speed": 456.45, //< Speed of the player in km/h |
30
|
|
|
* "distance": 398.49 //< Distance traveled by the player since the beginning of the race |
31
|
|
|
* }" |
32
|
|
|
* ] |
33
|
|
|
*/ |
34
|
|
|
public function onRespawn($params) |
35
|
|
|
{ |
36
|
|
|
$this->dispatch( |
37
|
|
|
'onPlayerRespawn', |
38
|
|
|
[ |
39
|
|
|
$params['login'], |
40
|
|
|
$params['nbrespawns'], |
41
|
|
|
] |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* |
47
|
|
|
*/ |
48
|
|
|
public function onGiveUp($params) |
49
|
|
|
{ |
50
|
|
|
$this->dispatch( |
51
|
|
|
'onPlayerRespawn', |
52
|
|
|
[ |
53
|
|
|
$params['login'], |
54
|
|
|
]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function onStartLine($params) |
58
|
|
|
{ |
59
|
|
|
$this->dispatch( |
60
|
|
|
'onPlayerStartLine', |
61
|
|
|
[ |
62
|
|
|
$params['login'], |
63
|
|
|
]); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param $params |
68
|
|
|
* "time": 123456 //< Server time when the event occured, |
69
|
|
|
* "login": "PlayerLogin", |
70
|
|
|
* "racetime": 123456, //< Total race time in milliseconds |
71
|
|
|
* "laptime": 45678, //< Lap time in milliseconds |
72
|
|
|
* "stuntsscore": 3457, //< Stunts score |
73
|
|
|
* "figure": "EStuntFigure::Roll", //< Name of the figure |
74
|
|
|
* "angle": 125, //< Angle of the car |
75
|
|
|
* "points": 18, //< Point awarded by the figure |
76
|
|
|
* "combo": 35, //< Combo counter |
77
|
|
|
* "isstraight": true, //< Is the car straight |
78
|
|
|
* "isreverse": false, //< Is the car reversed |
79
|
|
|
* "ismasterjump": false, |
80
|
|
|
* "factor": 0.5 / |
81
|
|
|
*/ |
82
|
|
|
public function onPlayerStunt($params) |
83
|
|
|
{ |
84
|
|
|
$this->dispatch( |
85
|
|
|
'onPlayerStunt', |
86
|
|
|
[ |
87
|
|
|
$params['login'], |
88
|
|
|
$params['stuntsscore'], |
89
|
|
|
$params['figure'], |
90
|
|
|
$params['angle'], |
91
|
|
|
$params['points'], |
92
|
|
|
$params['combo'], |
93
|
|
|
$params['isstraight'], |
94
|
|
|
$params['isreverse'], |
95
|
|
|
$params['ismasterjump'], |
96
|
|
|
$params['factor'], |
97
|
|
|
]); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
|