@@ -19,10 +19,10 @@ |
||
| 19 | 19 | $url = $this->getView()->plugin('url'); |
| 20 | 20 | |
| 21 | 21 | $class = ''; |
| 22 | - if (! $item['status']) { |
|
| 22 | + if (!$item['status']) { |
|
| 23 | 23 | $class = ' class="offline"'; |
| 24 | 24 | } |
| 25 | - $str = '<a' . $class. ' href="' . $url('player-info', ['nick' => $item['nick']]) . '">'; |
|
| 25 | + $str = '<a' . $class . ' href="' . $url('player-info', ['nick' => $item['nick']]) . '">'; |
|
| 26 | 26 | $str .= $item['nick'] . '</a>'; |
| 27 | 27 | $str .= ', the level ' . $item['level'] . ' ' . $item['class'] . '. '; |
| 28 | 28 | $str .= 'Next level in ' . $this->secondsToTime($item['ttl']) . '.'; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getItems() |
| 147 | 147 | { |
| 148 | - $key = __FUNCTION__ ; |
|
| 148 | + $key = __FUNCTION__; |
|
| 149 | 149 | |
| 150 | 150 | if ($this->cache->hasItem($key)) { |
| 151 | 151 | $items = $this->cache->getItem($key); |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $record = [ |
| 164 | - 'x_pos' => (int)$data[0], |
|
| 165 | - 'y_pos' => (int)$data[1], |
|
| 164 | + 'x_pos' => (int) $data[0], |
|
| 165 | + 'y_pos' => (int) $data[1], |
|
| 166 | 166 | 'type' => $data[2], |
| 167 | 167 | 'level' => $data[3], |
| 168 | 168 | 'age' => $data[4] |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function getScoreboard() |
| 188 | 188 | { |
| 189 | - $key = __FUNCTION__ ; |
|
| 189 | + $key = __FUNCTION__; |
|
| 190 | 190 | |
| 191 | 191 | if ($this->cache->hasItem($key)) { |
| 192 | 192 | $players = $this->cache->getItem($key); |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | $players[] = [ |
| 204 | 204 | 'nick' => $data[0], |
| 205 | - 'level' => (int)$data[3], |
|
| 205 | + 'level' => (int) $data[3], |
|
| 206 | 206 | 'class' => $data[4], |
| 207 | - 'ttl' => (int)$data[5], |
|
| 208 | - 'status' => (bool)$data[8], |
|
| 207 | + 'ttl' => (int) $data[5], |
|
| 208 | + 'status' => (bool) $data[8], |
|
| 209 | 209 | ]; |
| 210 | 210 | } |
| 211 | 211 | fclose($handle); |
@@ -247,105 +247,105 @@ discard block |
||
| 247 | 247 | 'admin' => ($data[2] ? 'Yes' : 'No'), // admin |
| 248 | 248 | 'class' => $data[4], // class |
| 249 | 249 | 'ttl' => [ |
| 250 | - 'display' => $this->secondsToTime((int)$data[5]), |
|
| 251 | - 'numeric' => (int)$data[5], // ttl |
|
| 250 | + 'display' => $this->secondsToTime((int) $data[5]), |
|
| 251 | + 'numeric' => (int) $data[5], // ttl |
|
| 252 | 252 | ], |
| 253 | 253 | 'nick_host' => $data[7], // nick and host |
| 254 | 254 | 'online' => ($data[8] ? 'Yes' : 'No'), // online |
| 255 | 255 | 'idled' => [ |
| 256 | - 'display' => $this->secondsToTime((int)$data[9]), // idled |
|
| 257 | - 'numeric' => (int)$data[9], |
|
| 256 | + 'display' => $this->secondsToTime((int) $data[9]), // idled |
|
| 257 | + 'numeric' => (int) $data[9], |
|
| 258 | 258 | ], |
| 259 | - 'x_pos' => (int)$data[10], // x pos |
|
| 260 | - 'y_pos' => (int)$data[11], // y pos |
|
| 259 | + 'x_pos' => (int) $data[10], // x pos |
|
| 260 | + 'y_pos' => (int) $data[11], // y pos |
|
| 261 | 261 | 'msg_pen' => [ |
| 262 | - 'display' => $this->secondsToTime((int)$data[12]), // msg pen |
|
| 263 | - 'numeric' => (int)$data[12], |
|
| 262 | + 'display' => $this->secondsToTime((int) $data[12]), // msg pen |
|
| 263 | + 'numeric' => (int) $data[12], |
|
| 264 | 264 | ], |
| 265 | 265 | 'nick_pen' => [ |
| 266 | - 'display' => $this->secondsToTime((int)$data[13]), // nick pen |
|
| 267 | - 'numeric' => (int)$data[13], |
|
| 266 | + 'display' => $this->secondsToTime((int) $data[13]), // nick pen |
|
| 267 | + 'numeric' => (int) $data[13], |
|
| 268 | 268 | ], |
| 269 | 269 | 'part_pen' => [ |
| 270 | - 'display' => $this->secondsToTime((int)$data[14]), // part pen |
|
| 271 | - 'numeric' => (int)$data[14], |
|
| 270 | + 'display' => $this->secondsToTime((int) $data[14]), // part pen |
|
| 271 | + 'numeric' => (int) $data[14], |
|
| 272 | 272 | ], |
| 273 | 273 | 'kick_pen' => [ |
| 274 | - 'display' => $this->secondsToTime((int)$data[15]), // kick pen |
|
| 275 | - 'numeric' => (int)$data[15], |
|
| 274 | + 'display' => $this->secondsToTime((int) $data[15]), // kick pen |
|
| 275 | + 'numeric' => (int) $data[15], |
|
| 276 | 276 | ], |
| 277 | 277 | 'quit_pen' => [ |
| 278 | - 'display' => $this->secondsToTime((int)$data[16]), // quit pen |
|
| 279 | - 'numeric' => (int)$data[16], |
|
| 278 | + 'display' => $this->secondsToTime((int) $data[16]), // quit pen |
|
| 279 | + 'numeric' => (int) $data[16], |
|
| 280 | 280 | ], |
| 281 | 281 | 'quest_pen' => [ |
| 282 | - 'display' => $this->secondsToTime((int)$data[17]), // quest pen |
|
| 283 | - 'numeric' => (int)$data[17], |
|
| 282 | + 'display' => $this->secondsToTime((int) $data[17]), // quest pen |
|
| 283 | + 'numeric' => (int) $data[17], |
|
| 284 | 284 | ], |
| 285 | 285 | 'logout_pen' => [ |
| 286 | - 'display' => $this->secondsToTime((int)$data[18]), // logout pen |
|
| 287 | - 'numeric' => (int)$data[18], |
|
| 286 | + 'display' => $this->secondsToTime((int) $data[18]), // logout pen |
|
| 287 | + 'numeric' => (int) $data[18], |
|
| 288 | 288 | ], |
| 289 | 289 | 'total_pen' => [ |
| 290 | 290 | 'display' => $this->secondsToTime($this->sumFields($data, 12, 18)), |
| 291 | 291 | 'numeric' => $this->sumFields($data, 12, 18), |
| 292 | 292 | ], |
| 293 | 293 | 'created' => [ |
| 294 | - 'display' => date('Y-m-d H:i:s', (int)$data[19]), // created |
|
| 295 | - 'numeric' => (int)$data[19], |
|
| 294 | + 'display' => date('Y-m-d H:i:s', (int) $data[19]), // created |
|
| 295 | + 'numeric' => (int) $data[19], |
|
| 296 | 296 | ], |
| 297 | 297 | 'last_login' => [ |
| 298 | - 'display' => date('Y-m-d H:i:s', (int)$data[20]), // last login |
|
| 299 | - 'numeric' => (int)$data[20], |
|
| 298 | + 'display' => date('Y-m-d H:i:s', (int) $data[20]), // last login |
|
| 299 | + 'numeric' => (int) $data[20], |
|
| 300 | 300 | ], |
| 301 | 301 | 'amulet' => [ |
| 302 | 302 | 'display' => $data[21], // amulet |
| 303 | - 'numeric' => (int)$data[21], |
|
| 303 | + 'numeric' => (int) $data[21], |
|
| 304 | 304 | 'unique' => $this->parseUniqueItem($data[21]) |
| 305 | 305 | ], |
| 306 | 306 | 'charm' => [ |
| 307 | 307 | 'display' => $data[22], // charm |
| 308 | - 'numeric' => (int)$data[22], |
|
| 308 | + 'numeric' => (int) $data[22], |
|
| 309 | 309 | 'unique' => $this->parseUniqueItem($data[22]) |
| 310 | 310 | ], |
| 311 | 311 | 'helm' => [ |
| 312 | 312 | 'display' => $data[23], // helm |
| 313 | - 'numeric' => (int)$data[23], |
|
| 313 | + 'numeric' => (int) $data[23], |
|
| 314 | 314 | 'unique' => $this->parseUniqueItem($data[23]) |
| 315 | 315 | ], |
| 316 | 316 | 'boots' => [ |
| 317 | 317 | 'display' => $data[24], // boots |
| 318 | - 'numeric' => (int)$data[24], |
|
| 318 | + 'numeric' => (int) $data[24], |
|
| 319 | 319 | 'unique' => $this->parseUniqueItem($data[24]) |
| 320 | 320 | ], |
| 321 | 321 | 'gloves' => [ |
| 322 | 322 | 'display' => $data[25], // gloves |
| 323 | - 'numeric' => (int)$data[25], |
|
| 323 | + 'numeric' => (int) $data[25], |
|
| 324 | 324 | 'unique' => $this->parseUniqueItem($data[25]) |
| 325 | 325 | ], |
| 326 | 326 | 'ring' => [ |
| 327 | 327 | 'display' => $data[26], // ring |
| 328 | - 'numeric' => (int)$data[26], |
|
| 328 | + 'numeric' => (int) $data[26], |
|
| 329 | 329 | 'unique' => $this->parseUniqueItem($data[26]) |
| 330 | 330 | ], |
| 331 | 331 | 'leggings' => [ |
| 332 | 332 | 'display' => $data[27], // leggings |
| 333 | - 'numeric' => (int)$data[27], |
|
| 333 | + 'numeric' => (int) $data[27], |
|
| 334 | 334 | 'unique' => $this->parseUniqueItem($data[27]) |
| 335 | 335 | ], |
| 336 | 336 | 'shield' => [ |
| 337 | 337 | 'display' => $data[28], // shield |
| 338 | - 'numeric' => (int)$data[28], |
|
| 338 | + 'numeric' => (int) $data[28], |
|
| 339 | 339 | 'unique' => $this->parseUniqueItem($data[28]) |
| 340 | 340 | ], |
| 341 | 341 | 'tunic' => [ |
| 342 | 342 | 'display' => $data[29], // tunic |
| 343 | - 'numeric' => (int)$data[29], |
|
| 343 | + 'numeric' => (int) $data[29], |
|
| 344 | 344 | 'unique' => $this->parseUniqueItem($data[29]) |
| 345 | 345 | ], |
| 346 | 346 | 'weapon' => [ |
| 347 | 347 | 'display' => $data[30], // weapon |
| 348 | - 'numeric' => (int)$data[30], |
|
| 348 | + 'numeric' => (int) $data[30], |
|
| 349 | 349 | 'unique' => $this->parseUniqueItem($data[30]) |
| 350 | 350 | ], |
| 351 | 351 | 'sum' => $this->sumFields($data, 21, 30), |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function getQuestData() |
| 456 | 456 | { |
| 457 | - $key = __FUNCTION__ ; |
|
| 457 | + $key = __FUNCTION__; |
|
| 458 | 458 | |
| 459 | 459 | if ($this->cache->hasItem($key)) { |
| 460 | 460 | $quest = $this->cache->getItem($key); |
@@ -463,11 +463,11 @@ discard block |
||
| 463 | 463 | if (($handle = fopen($this->config['bot_quest'], "r")) !== false) { |
| 464 | 464 | while (($data = fgets($handle, 1024)) !== false) { |
| 465 | 465 | // T - title |
| 466 | - if (! isset($data['title']) && $data[0] == "T") { |
|
| 466 | + if (!isset($data['title']) && $data[0] == "T") { |
|
| 467 | 467 | $quest['title'] = substr($data, 2); |
| 468 | 468 | } |
| 469 | 469 | // Y - type. 1 for time based, 2 for stages |
| 470 | - if (! isset($data['type']) && $data[0] == "Y") { |
|
| 470 | + if (!isset($data['type']) && $data[0] == "Y") { |
|
| 471 | 471 | $quest['type'] = (int) substr($data, 2); |
| 472 | 472 | } |
| 473 | 473 | // S - objective |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | // P - stages position |
| 480 | 480 | if ($data_exploded[0] == "P") { |
| 481 | 481 | $quest['stages'] = [ |
| 482 | - ['x_pos' => (int) $data_exploded[1],'y_pos' => (int) $data_exploded[2]], |
|
| 483 | - ['x_pos' => (int) $data_exploded[3],'y_pos' => (int) $data_exploded[4]], |
|
| 482 | + ['x_pos' => (int) $data_exploded[1], 'y_pos' => (int) $data_exploded[2]], |
|
| 483 | + ['x_pos' => (int) $data_exploded[3], 'y_pos' => (int) $data_exploded[4]], |
|
| 484 | 484 | ]; |
| 485 | 485 | } |
| 486 | 486 | // P{1-4} - player position |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | private function drawCrosshair(Image $image, int $x, int $y, string $color, string $text = null) |
| 41 | 41 | { |
| 42 | 42 | // Bottom top |
| 43 | - $image->line($x - self::CROSSHAIR_SIZE, $y, $x + self::CROSSHAIR_SIZE, $y, function ($draw) use ($color) { |
|
| 43 | + $image->line($x - self::CROSSHAIR_SIZE, $y, $x + self::CROSSHAIR_SIZE, $y, function($draw) use ($color) { |
|
| 44 | 44 | $draw->color($color); |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | 47 | // Left right |
| 48 | - $image->line($x, $y - self::CROSSHAIR_SIZE, $x, $y + self::CROSSHAIR_SIZE, function ($draw) use ($color) { |
|
| 48 | + $image->line($x, $y - self::CROSSHAIR_SIZE, $x, $y + self::CROSSHAIR_SIZE, function($draw) use ($color) { |
|
| 49 | 49 | $draw->color($color); |
| 50 | 50 | }); |
| 51 | 51 | |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | $text_y = $y + self::CROSSHAIR_SIZE; |
| 55 | 55 | |
| 56 | 56 | // Draw a "shadow" 1 pixel ahead |
| 57 | - $image->text($text, $text_x + 1, $text_y + 1, function ($font) { |
|
| 57 | + $image->text($text, $text_x + 1, $text_y + 1, function($font) { |
|
| 58 | 58 | $font->file(4); |
| 59 | 59 | $font->color("#000"); |
| 60 | 60 | }); |
| 61 | 61 | |
| 62 | 62 | // Text |
| 63 | - $image->text($text, $text_x, $text_y, function ($font) use ($color) { |
|
| 63 | + $image->text($text, $text_x, $text_y, function($font) use ($color) { |
|
| 64 | 64 | $font->file(4); |
| 65 | 65 | $font->color($color); |
| 66 | 66 | }); |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | use Application\View\Helper\Scoreboard; |
| 9 | 9 | |
| 10 | 10 | return [ |
| 11 | - 'router' => require __DIR__ .'/router.config.php', |
|
| 12 | - 'navigation' => require __DIR__ .'/navigation.config.php', |
|
| 11 | + 'router' => require __DIR__ . '/router.config.php', |
|
| 12 | + 'navigation' => require __DIR__ . '/navigation.config.php', |
|
| 13 | 13 | |
| 14 | 14 | 'service_manager' => [ |
| 15 | 15 | 'factories' => [ |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | // Composer autoloading |
| 22 | 22 | include __DIR__ . '/../vendor/autoload.php'; |
| 23 | 23 | |
| 24 | -if (! class_exists(Application::class)) { |
|
| 24 | +if (!class_exists(Application::class)) { |
|
| 25 | 25 | throw new RuntimeException( |
| 26 | 26 | "Unable to load application.\n" |
| 27 | 27 | . "- Type `composer install` if you are developing locally.\n" |