1
|
|
|
<?php namespace FreedomCore\TrinityCore\Console\Commands; |
2
|
|
|
|
3
|
|
|
use FreedomCore\TrinityCore\Console\Abstracts\BaseCommand; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Player |
7
|
|
|
* @package FreedomCore\TrinityCore\Console\Commands |
8
|
|
|
* @codeCoverageIgnore |
9
|
|
|
*/ |
10
|
|
|
class Character extends BaseCommand |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @inheritdoc |
15
|
|
|
* @var array |
16
|
|
|
*/ |
17
|
|
|
protected $doNotPrefix = [ |
18
|
|
|
'unstuck', |
19
|
|
|
'unmute', |
20
|
|
|
'unban', |
21
|
|
|
'mute', |
22
|
|
|
'kick', |
23
|
|
|
'ban' |
24
|
|
|
]; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Teleport specified player to specified location |
28
|
|
|
* @param string $playerName |
29
|
|
|
* @param string $location |
30
|
|
|
* @return array|string |
31
|
|
|
*/ |
32
|
|
|
public function unstuck(string $playerName, string $location = 'graveyard') |
33
|
|
|
{ |
34
|
|
|
$availableLocations = ['inn', 'graveyard', 'startzone']; |
35
|
|
|
if (!in_array($location, $availableLocations)) { |
36
|
|
|
$location = $availableLocations[1]; |
37
|
|
|
} |
38
|
|
|
return $this->executeCommand(__FUNCTION__, ['playerName' => $playerName, 'location' => $location]); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Restore messaging functionality for specified character |
43
|
|
|
* @param string $playerName |
44
|
|
|
* @return array|string |
45
|
|
|
*/ |
46
|
|
|
public function unmute(string $playerName) |
47
|
|
|
{ |
48
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Unban character by name |
53
|
|
|
* @param string $playerName |
54
|
|
|
* @param string $function |
55
|
|
|
* @return array|string |
56
|
|
|
*/ |
57
|
|
|
public function unban(string $playerName, $function = 'character') |
58
|
|
|
{ |
59
|
|
|
return $this->executeCommand(__FUNCTION__, ['function' => $function, 'playerName' => $playerName]); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Ban specified character |
64
|
|
|
* @param string $playerName |
65
|
|
|
* @param string $function |
66
|
|
|
* @return array|string |
67
|
|
|
*/ |
68
|
|
|
public function ban(string $playerName, $function = 'character') |
69
|
|
|
{ |
70
|
|
|
return $this->executeCommand(__FUNCTION__, ['function' => $function, 'playerName' => $playerName]); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Disable characters messaging functionality |
75
|
|
|
* @param string $playerName |
76
|
|
|
* @param int $minutes |
77
|
|
|
* @param string $reason |
78
|
|
|
* @return array|string |
79
|
|
|
*/ |
80
|
|
|
public function mute(string $playerName, int $minutes, $reason = 'No reason given!') |
81
|
|
|
{ |
82
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Kick player from game world |
87
|
|
|
* @param string $playerName |
88
|
|
|
* @param string $reason |
89
|
|
|
* @return array|string |
90
|
|
|
*/ |
91
|
|
|
public function kick(string $playerName, string $reason = 'No reason given!') |
92
|
|
|
{ |
93
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Send "customise character" request on next login |
98
|
|
|
* @param string $playerName |
99
|
|
|
* @return array|string |
100
|
|
|
*/ |
101
|
|
|
public function customize(string $playerName) |
102
|
|
|
{ |
103
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Send "change faction" request on next login |
108
|
|
|
* @param string $playerName |
109
|
|
|
* @return array|string |
110
|
|
|
*/ |
111
|
|
|
public function changeFaction(string $playerName) |
112
|
|
|
{ |
113
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Send "change race" request on next login |
118
|
|
|
* @param string $playerName |
119
|
|
|
* @return array|string |
120
|
|
|
*/ |
121
|
|
|
public function changeRace(string $playerName) |
122
|
|
|
{ |
123
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Completely delete character |
128
|
|
|
* @param string $playerName |
129
|
|
|
* @return array|string |
130
|
|
|
*/ |
131
|
|
|
public function erase(string $playerName) |
132
|
|
|
{ |
133
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Increase/Decrease character level by the provided value |
138
|
|
|
* @param string $playerName |
139
|
|
|
* @param int $level |
140
|
|
|
* @return array|string |
141
|
|
|
*/ |
142
|
|
|
public function level(string $playerName, int $level = 1) |
143
|
|
|
{ |
144
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Send "change name" request on next login. |
149
|
|
|
* IF $newName is provided, name will be forcefully changed |
150
|
|
|
* @param string $oldName |
151
|
|
|
* @param string $newName |
152
|
|
|
* @return array|string |
153
|
|
|
*/ |
154
|
|
|
public function rename(string $oldName, string $newName = '') |
155
|
|
|
{ |
156
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Show reputation information for selected character |
161
|
|
|
* Player MUST be online |
162
|
|
|
* @param string $playerName |
163
|
|
|
* @return array|string |
164
|
|
|
*/ |
165
|
|
|
public function reputation(string $playerName) |
166
|
|
|
{ |
167
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Show titles known by character |
172
|
|
|
* Player MUST be online |
173
|
|
|
* @param string $playerName |
174
|
|
|
* @return array|string |
175
|
|
|
*/ |
176
|
|
|
public function titles(string $playerName) |
177
|
|
|
{ |
178
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Delete characters which contain specified string in their name |
183
|
|
|
* @param string $playerName |
184
|
|
|
* @return array|string |
185
|
|
|
*/ |
186
|
|
|
public function deletedDelete(string $playerName = '') |
187
|
|
|
{ |
188
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Show deleted characters with specified string in their names |
193
|
|
|
* @param string $playerName |
194
|
|
|
* @return array|string |
195
|
|
|
*/ |
196
|
|
|
public function deletedList(string $playerName = '') |
197
|
|
|
{ |
198
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Restore deleted characters with specified string in their names |
203
|
|
|
* @param string $playerName |
204
|
|
|
* @return array|string |
205
|
|
|
*/ |
206
|
|
|
public function deletedRestore(string $playerName = '') |
207
|
|
|
{ |
208
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Delete characters which was deleted more than $days ago |
213
|
|
|
* @param string $playerName |
214
|
|
|
* @param int $days |
215
|
|
|
* @return array|string |
216
|
|
|
*/ |
217
|
|
|
public function deletedOld(string $playerName, int $days) |
218
|
|
|
{ |
219
|
|
|
return $this->executeCommand(__FUNCTION__, get_defined_vars()); |
220
|
|
|
} |
221
|
|
|
} |
222
|
|
|
|