|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\LocalRecords\Plugins; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Framework\GameTrackmania\DataProviders\Listener\BaseDataListenerInterface as TmBaseDataListenerInterface; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class RaceRecords |
|
9
|
|
|
* |
|
10
|
|
|
* @package eXpansion\Bundle\LocalRecords\Plugins; |
|
11
|
|
|
* @author oliver de Cramer <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
|
class RaceRecords extends BaseRecords implements TmBaseDataListenerInterface |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @param string $login Login of the player that crossed the CP point |
|
17
|
|
|
* @param int $time Server time when the event occured, |
|
18
|
|
|
* @param int $raceTime Total race time in milliseconds |
|
19
|
|
|
* @param int $stuntsScore Stunts score |
|
20
|
|
|
* @param int $cpInRace Number of checkpoints crossed since the beginning of the race |
|
21
|
|
|
* @param int[] $curCps Checkpoints times since the beginning of the race |
|
22
|
|
|
* @param string $blockId Id of the checkpoint block |
|
23
|
|
|
* @param string $speed Speed of the player in km/h |
|
24
|
|
|
* @param string $distance Distance traveled by the player |
|
25
|
|
|
*/ |
|
26
|
2 |
|
public function onPlayerEndRace( |
|
27
|
|
|
$login, |
|
28
|
|
|
$time, |
|
29
|
|
|
$raceTime, |
|
30
|
|
|
$stuntsScore, |
|
31
|
|
|
$cpInRace, |
|
32
|
|
|
$curCps, |
|
33
|
|
|
$blockId, |
|
34
|
|
|
$speed, |
|
35
|
|
|
$distance |
|
36
|
|
|
) |
|
37
|
|
|
{ |
|
38
|
2 |
|
$eventData = $this->recordsHandler->addRecord($login, $raceTime, $cpInRace); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
2 |
|
if ($eventData) { |
|
41
|
1 |
|
$this->dispatchEvent($eventData); |
|
42
|
|
|
} |
|
43
|
2 |
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param string $login Login of the player that crossed the CP point |
|
47
|
|
|
* @param int $time Server time when the event occured, |
|
48
|
|
|
* @param int $lapTime Lap time in milliseconds |
|
49
|
|
|
* @param int $stuntsScore Stunts score |
|
50
|
|
|
* @param int $cpInLap Number of checkpoints crossed since the beginning of the lap |
|
51
|
|
|
* @param int[] $curLapCps Checkpoints time since the beginning of the lap |
|
52
|
|
|
* @param string $blockId Id of the checkpoint block |
|
53
|
|
|
* @param string $speed Speed of the player in km/h |
|
54
|
|
|
* @param string $distance Distance traveled by the player |
|
55
|
|
|
*/ |
|
56
|
1 |
|
public function onPlayerEndLap( |
|
57
|
|
|
$login, |
|
58
|
|
|
$time, |
|
59
|
|
|
$lapTime, |
|
60
|
|
|
$stuntsScore, |
|
61
|
|
|
$cpInLap, |
|
62
|
|
|
$curLapCps, |
|
63
|
|
|
$blockId, |
|
64
|
|
|
$speed, |
|
65
|
|
|
$distance |
|
66
|
|
|
) |
|
67
|
|
|
{ |
|
68
|
|
|
// Nothing to do. |
|
69
|
1 |
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param string $login Login of the player that crossed the CP point |
|
73
|
|
|
* @param int $time Server time when the event occured, |
|
74
|
|
|
* @param int $raceTime Total race time in milliseconds |
|
75
|
|
|
* @param int $lapTime Lap time in milliseconds |
|
76
|
|
|
* @param int $stuntsScore Stunts score |
|
77
|
|
|
* @param int $cpInRace Number of checkpoints crossed since the beginning of the race |
|
78
|
|
|
* @param int $cpInLap Number of checkpoints crossed since the beginning of the lap |
|
79
|
|
|
* @param int[] $curCps Checkpoints times since the beginning of the race |
|
80
|
|
|
* @param int[] $curLapCps Checkpoints time since the beginning of the lap |
|
81
|
|
|
* @param string $blockId Id of the checkpoint block |
|
82
|
|
|
* @param string $speed Speed of the player in km/h |
|
83
|
|
|
* @param string $distance Distance traveled by the player |
|
84
|
|
|
*/ |
|
85
|
1 |
|
public function onPlayerWayPoint( |
|
86
|
|
|
$login, |
|
87
|
|
|
$time, |
|
88
|
|
|
$raceTime, |
|
89
|
|
|
$lapTime, |
|
90
|
|
|
$stuntsScore, |
|
91
|
|
|
$cpInRace, |
|
92
|
|
|
$cpInLap, |
|
93
|
|
|
$curCps, |
|
94
|
|
|
$curLapCps, |
|
95
|
|
|
$blockId, |
|
96
|
|
|
$speed, |
|
97
|
|
|
$distance |
|
98
|
|
|
) |
|
99
|
|
|
{ |
|
100
|
|
|
// Nothing to do. |
|
101
|
|
|
} |
|
102
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: