| @@ 15-46 (lines=32) @@ | ||
| 12 | * @copyright 2017 Smile |
|
| 13 | * @package eXpansion\Framework\GameTrackmania\DataProviders |
|
| 14 | */ |
|
| 15 | class LapDataProvider extends AbstractDataProvider implements CompatibilityCheckDataProviderInterface |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * Check if data provider is compatible with current situation. |
|
| 19 | * |
|
| 20 | * @return bool |
|
| 21 | */ |
|
| 22 | public function isCompatible(Map $map): bool |
|
| 23 | { |
|
| 24 | return $map->lapRace; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function onWayPoint($params) |
|
| 28 | { |
|
| 29 | if ($params['isendlap']) { |
|
| 30 | $this->dispatch( |
|
| 31 | 'onPlayerEndLap', |
|
| 32 | [ |
|
| 33 | $params['login'], |
|
| 34 | $params['time'], |
|
| 35 | $params['laptime'], |
|
| 36 | $params['stuntsscore'], |
|
| 37 | $params['checkpointinlap'], |
|
| 38 | $params['curlapcheckpoints'], |
|
| 39 | $params['blockid'], |
|
| 40 | $params['speed'], |
|
| 41 | $params['distance'], |
|
| 42 | ] |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | } |
|
| @@ 16-48 (lines=33) @@ | ||
| 13 | * @copyright 2017 Smile |
|
| 14 | * @package eXpansion\Framework\GameTrackmania\DataProviders\ScriptBaseRounds |
|
| 15 | */ |
|
| 16 | class RaceDataProvider extends AbstractDataProvider implements CompatibilityCheckDataProviderInterface |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * Check if data provider is compatible with current situation. |
|
| 20 | * |
|
| 21 | * @return bool |
|
| 22 | */ |
|
| 23 | public function isCompatible(Map $map): bool |
|
| 24 | { |
|
| 25 | return !$map->lapRace; |
|
| 26 | } |
|
| 27 | ||
| 28 | ||
| 29 | public function onWayPoint($params) |
|
| 30 | { |
|
| 31 | if ($params['isendrace']) { |
|
| 32 | $this->dispatch( |
|
| 33 | 'onPlayerEndRace', |
|
| 34 | [ |
|
| 35 | $params['login'], |
|
| 36 | $params['time'], |
|
| 37 | $params['racetime'], |
|
| 38 | $params['stuntsscore'], |
|
| 39 | $params['checkpointinrace'], |
|
| 40 | $params['curracecheckpoints'], |
|
| 41 | $params['blockid'], |
|
| 42 | $params['speed'], |
|
| 43 | $params['distance'], |
|
| 44 | ] |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||