Completed
Pull Request — master (#210)
by
unknown
03:50
created

Test::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 3
crap 2
1
<?php
2
3
namespace eXpansion\Storm\Toto\Plugins;
4
5
use eXpansion\Framework\Core\Helpers\ChatNotification;
6
use eXpansion\Framework\Core\Services\Console;
7
use eXpansion\Framework\Core\Storage\PlayerStorage;
8
use eXpansion\Framework\GameShootmania\DataProviders\Listener\ListenerInterfaceSmPlayer;
9
use eXpansion\Framework\GameShootmania\DataProviders\Listener\ListenerInterfaceSmPlayerShoot;
10
use eXpansion\Framework\GameShootmania\Structures\Landmark;
11
12
class Test implements ListenerInterfaceSmPlayer, ListenerInterfaceSmPlayerShoot
13
{
14
    /**
15
     * @var ChatNotification
16
     */
17
    private $chatNotification;
18
    /**
19
     * @var Console
20
     */
21
    private $console;
22
    /**
23
     * @var PlayerStorage
24
     */
25
    private $playerStorage;
26
27
    /**
28
     * Test constructor.
29
     * @param ChatNotification $chatNotification
30
     * @param Console          $console
31
     * @param PlayerStorage    $playerStorage
32
     */
33
    public function __construct(
34
        ChatNotification $chatNotification,
35
        Console $console,
36
        PlayerStorage $playerStorage
37
    ) {
38
39
        $this->chatNotification = $chatNotification;
40
        $this->console = $console;
41
        $this->playerStorage = $playerStorage;
42
    }
43
44
    /**
45
     * Callback sent when a player is hit.
46
     *
47
     * @param string $shooterLogin    login
48
     * @param string $victimLogin     login
49
     * @param int    $weapon          id of weapon: [1-laser, 2-rocket, 3-nucleus, 5-arrow]
50
     * @param int    $damage          amount damage done by hit
51
     * @param int    $points          amount of points scored by shooter
52
     * @param float  $distance        distance between 2 players
53
     * @param array  $shooterPosition position at level
54
     * @param array  $victimPosition  position at level
55
     * @return void
56
     */
57
    public function onPlayerHit(
58
        $shooterLogin,
59
        $victimLogin,
60
        $weapon,
61
        $damage,
62
        $points,
63
        $distance,
64
        $shooterPosition,
65
        $victimPosition
66
    ) {
67
        // do nothing
68
        $this->console->writeln($shooterLogin." -> ".$victimLogin." with: ".$damage);
69
    }
70
71
    /**
72
     * Callback sent when a player is eliminated.
73
     * @param string $shooterLogin    login
74
     * @param string $victimLogin     login
75
     * @param int    $weapon          id of weapon: [1-laser, 2-rocket, 3-nucleus, 5-arrow]
76
     * @param int    $damage          amount damage done by hit
77
     * @param array  $shooterPosition position at level
78
     * @param array  $victimPosition  position at level
79
     * @return void
80
     */
81
    public function onArmorEmpty(
82
        $shooterLogin,
83
        $victimLogin,
84
        $weapon,
85
        $damage,
86
        $shooterPosition,
87
        $victimPosition
88
    ) {
89
        $this->console->writeln("armor empty: ".$victimLogin." with: ".$damage);
90
    }
91
92
    /**
93
     * Callback when pole is being captured
94
     *
95
     * @param array    $players
96
     * @param Landmark $landmark
97
     */
98
    public function onCapture(
99
        $players,
100
        Landmark $landmark
101
    ) {
102
        $this->console->writeln('onCapture');
103
    }
104
105
    /**
106
     * Callback when player triggers sector
107
     *
108
     * @param string $login
109
     * @param string $sectorId
110
     */
111
    public function onPlayerTriggersSector(
112
        $login,
113
        $sectorId
114
    ) {
115
        $this->console->writeln('onPlayerTriggersSector: '.$login);
116
    }
117
118
    /**
119
     *  Callback when player touches an object at level
120
     *
121
     * @param string $login
122
     * @param string $objectId
123
     * @param string $modelId
124
     * @param string $modelName
125
     */
126
    public function onPlayerTouchesObject(
127
        $login,
128
        $objectId,
129
        $modelId,
130
        $modelName
131
    ) {
132
        $this->console->writeln('Object: '.$login.' ModelName:'.$modelName);
133
    }
134
135
    /**
136
     *  Callback when player touches an object at level
137
     *
138
     * @param string $login
139
     * @param string $objectId
140
     * @param string $modelId
141
     * @param string $modelName
142
     */
143
    public function onPlayerThrowsObject(
144
        $login,
145
        $objectId,
146
        $modelId,
147
        $modelName
148
    ) {
149
        $this->console->writeln('Throw: '.$login.' ModelName:'.$modelName);
150
    }
151
152
    /**
153
     * @param string $login  login
154
     * @param int    $weapon indexes are: 1-Laser, 2-Rocket, 3-Nucleus, 5-Arrow
155
     * @return void
156
     */
157
    public function onShoot($login, $weapon)
158
    {
159
        $this->console->writeln('Shoot: '.$login.' Weapon: '.$weapon);
160
    }
161
}
162