@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG)); |
| 38 | 38 | if ($db === null) { |
| 39 | 39 | $db = __DIR__ . '/../../database/dramiel.sqlite'; |
| 40 | - } elseif ($db === 'eve'){ |
|
| 40 | + } elseif ($db === 'eve') { |
|
| 41 | 41 | $db = __DIR__ . '/../../database/eveData.db'; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | $gooVolume = 0.1; |
| 132 | 132 | $gooCurrent = $gooAmount * $gooVolume; |
| 133 | 133 | //double check tower race |
| 134 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 134 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 135 | 135 | $towerFull = 30000; |
| 136 | 136 | } |
| 137 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 137 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 138 | 138 | $towerFull = 40000; |
| 139 | 139 | } |
| 140 | 140 | $cleanNumber = number_format($gooCurrent); |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | $gooVolume = 0.4; |
| 174 | 174 | $gooCurrent = $gooAmount * $gooVolume; |
| 175 | 175 | //double check tower race |
| 176 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 176 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 177 | 177 | $towerFull = 30000; |
| 178 | 178 | } |
| 179 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 179 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 180 | 180 | $towerFull = 40000; |
| 181 | 181 | } |
| 182 | 182 | $cleanNumber = number_format($gooCurrent); |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | $gooVolume = 0.8; |
| 216 | 216 | $gooCurrent = $gooAmount * $gooVolume; |
| 217 | 217 | //double check tower race |
| 218 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 218 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 219 | 219 | $towerFull = 30000; |
| 220 | 220 | } |
| 221 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 221 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 222 | 222 | $towerFull = 40000; |
| 223 | 223 | } |
| 224 | 224 | $cleanNumber = number_format($gooCurrent); |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | $gooVolume = 0.6; |
| 258 | 258 | $gooCurrent = $gooAmount * $gooVolume; |
| 259 | 259 | //double check tower race |
| 260 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 260 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 261 | 261 | $towerFull = 30000; |
| 262 | 262 | } |
| 263 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 263 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 264 | 264 | $towerFull = 40000; |
| 265 | 265 | } |
| 266 | 266 | $cleanNumber = number_format($gooCurrent); |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | $gooVolume = 0.4; |
| 300 | 300 | $gooCurrent = $gooAmount * $gooVolume; |
| 301 | 301 | //double check tower race |
| 302 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 302 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 303 | 303 | $towerFull = 30000; |
| 304 | 304 | } |
| 305 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 305 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 306 | 306 | $towerFull = 40000; |
| 307 | 307 | } |
| 308 | 308 | $cleanNumber = number_format($gooCurrent); |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | $gooVolume = 0.1; |
| 342 | 342 | $gooCurrent = $gooAmount * $gooVolume; |
| 343 | 343 | //double check tower race |
| 344 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 344 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 345 | 345 | $towerFull = 30000; |
| 346 | 346 | } |
| 347 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 347 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 348 | 348 | $towerFull = 40000; |
| 349 | 349 | } |
| 350 | 350 | $cleanNumber = number_format($gooCurrent); |
@@ -383,10 +383,10 @@ discard block |
||
| 383 | 383 | $gooVolume = 0.8; |
| 384 | 384 | $gooCurrent = $gooAmount * $gooVolume; |
| 385 | 385 | //double check tower race |
| 386 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 386 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 387 | 387 | $towerFull = 30000; |
| 388 | 388 | } |
| 389 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 389 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 390 | 390 | $towerFull = 40000; |
| 391 | 391 | } |
| 392 | 392 | $cleanNumber = number_format($gooCurrent); |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | $gooVolume = 0.1; |
| 426 | 426 | $gooCurrent = $gooAmount * $gooVolume; |
| 427 | 427 | //double check tower race |
| 428 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 428 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 429 | 429 | $towerFull = 30000; |
| 430 | 430 | } |
| 431 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 431 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 432 | 432 | $towerFull = 40000; |
| 433 | 433 | } |
| 434 | 434 | $cleanNumber = number_format($gooCurrent); |
@@ -467,10 +467,10 @@ discard block |
||
| 467 | 467 | $gooVolume = 0.8; |
| 468 | 468 | $gooCurrent = $gooAmount * $gooVolume; |
| 469 | 469 | //double check tower race |
| 470 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 470 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 471 | 471 | $towerFull = 30000; |
| 472 | 472 | } |
| 473 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 473 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 474 | 474 | $towerFull = 40000; |
| 475 | 475 | } |
| 476 | 476 | $cleanNumber = number_format($gooCurrent); |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | $gooVolume = 1; |
| 510 | 510 | $gooCurrent = $gooAmount * $gooVolume; |
| 511 | 511 | //double check tower race |
| 512 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 512 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 513 | 513 | $towerFull = 30000; |
| 514 | 514 | } |
| 515 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 515 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 516 | 516 | $towerFull = 40000; |
| 517 | 517 | } |
| 518 | 518 | $cleanNumber = number_format($gooCurrent); |
@@ -551,10 +551,10 @@ discard block |
||
| 551 | 551 | $gooVolume = 1; |
| 552 | 552 | $gooCurrent = $gooAmount * $gooVolume; |
| 553 | 553 | //double check tower race |
| 554 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 554 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 555 | 555 | $towerFull = 30000; |
| 556 | 556 | } |
| 557 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 557 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 558 | 558 | $towerFull = 40000; |
| 559 | 559 | } |
| 560 | 560 | $cleanNumber = number_format($gooCurrent); |
@@ -593,10 +593,10 @@ discard block |
||
| 593 | 593 | $gooVolume = 1; |
| 594 | 594 | $gooCurrent = $gooAmount * $gooVolume; |
| 595 | 595 | //double check tower race |
| 596 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 596 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 597 | 597 | $towerFull = 30000; |
| 598 | 598 | } |
| 599 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 599 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 600 | 600 | $towerFull = 40000; |
| 601 | 601 | } |
| 602 | 602 | $cleanNumber = number_format($gooCurrent); |
@@ -635,10 +635,10 @@ discard block |
||
| 635 | 635 | $gooVolume = 1; |
| 636 | 636 | $gooCurrent = $gooAmount * $gooVolume; |
| 637 | 637 | //double check tower race |
| 638 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 638 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 639 | 639 | $towerFull = 30000; |
| 640 | 640 | } |
| 641 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 641 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 642 | 642 | $towerFull = 40000; |
| 643 | 643 | } |
| 644 | 644 | $cleanNumber = number_format($gooCurrent); |
@@ -677,10 +677,10 @@ discard block |
||
| 677 | 677 | $gooVolume = 0.4; |
| 678 | 678 | $gooCurrent = $gooAmount * $gooVolume; |
| 679 | 679 | //double check tower race |
| 680 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 680 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 681 | 681 | $towerFull = 30000; |
| 682 | 682 | } |
| 683 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 683 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 684 | 684 | $towerFull = 40000; |
| 685 | 685 | } |
| 686 | 686 | $cleanNumber = number_format($gooCurrent); |
@@ -719,10 +719,10 @@ discard block |
||
| 719 | 719 | $gooVolume = 0.1; |
| 720 | 720 | $gooCurrent = $gooAmount * $gooVolume; |
| 721 | 721 | //double check tower race |
| 722 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 722 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 723 | 723 | $towerFull = 30000; |
| 724 | 724 | } |
| 725 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 725 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 726 | 726 | $towerFull = 40000; |
| 727 | 727 | } |
| 728 | 728 | $cleanNumber = number_format($gooCurrent); |
@@ -761,10 +761,10 @@ discard block |
||
| 761 | 761 | $gooVolume = 1; |
| 762 | 762 | $gooCurrent = $gooAmount * $gooVolume; |
| 763 | 763 | //double check tower race |
| 764 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 764 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 765 | 765 | $towerFull = 30000; |
| 766 | 766 | } |
| 767 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 767 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 768 | 768 | $towerFull = 40000; |
| 769 | 769 | } |
| 770 | 770 | $cleanNumber = number_format($gooCurrent); |
@@ -803,10 +803,10 @@ discard block |
||
| 803 | 803 | $gooVolume = 1; |
| 804 | 804 | $gooCurrent = $gooAmount * $gooVolume; |
| 805 | 805 | //double check tower race |
| 806 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 806 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 807 | 807 | $towerFull = 30000; |
| 808 | 808 | } |
| 809 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 809 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 810 | 810 | $towerFull = 40000; |
| 811 | 811 | } |
| 812 | 812 | $cleanNumber = number_format($gooCurrent); |
@@ -845,10 +845,10 @@ discard block |
||
| 845 | 845 | $gooVolume = 0.4; |
| 846 | 846 | $gooCurrent = $gooAmount * $gooVolume; |
| 847 | 847 | //double check tower race |
| 848 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 848 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 849 | 849 | $towerFull = 30000; |
| 850 | 850 | } |
| 851 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 851 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 852 | 852 | $towerFull = 40000; |
| 853 | 853 | } |
| 854 | 854 | $cleanNumber = number_format($gooCurrent); |
@@ -887,10 +887,10 @@ discard block |
||
| 887 | 887 | $gooVolume = 0.4; |
| 888 | 888 | $gooCurrent = $gooAmount * $gooVolume; |
| 889 | 889 | //double check tower race |
| 890 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 890 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 891 | 891 | $towerFull = 30000; |
| 892 | 892 | } |
| 893 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 893 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 894 | 894 | $towerFull = 40000; |
| 895 | 895 | } |
| 896 | 896 | $cleanNumber = number_format($gooCurrent); |
@@ -929,10 +929,10 @@ discard block |
||
| 929 | 929 | $gooVolume = 1; |
| 930 | 930 | $gooCurrent = $gooAmount * $gooVolume; |
| 931 | 931 | //double check tower race |
| 932 | - if ((int)$towerFull === 20000 && (int)$gooCurrent > 20000) { |
|
| 932 | + if ((int) $towerFull === 20000 && (int) $gooCurrent > 20000) { |
|
| 933 | 933 | $towerFull = 30000; |
| 934 | 934 | } |
| 935 | - if ((int)$towerFull === 20000 || 30000 && (int)$gooCurrent > 30000) { |
|
| 935 | + if ((int) $towerFull === 20000 || 30000 && (int) $gooCurrent > 30000) { |
|
| 936 | 936 | $towerFull = 40000; |
| 937 | 937 | } |
| 938 | 938 | $cleanNumber = number_format($gooCurrent); |
@@ -979,9 +979,9 @@ discard block |
||
| 979 | 979 | $url = "https://api.eveonline.com/corp/StarbaseList.xml.aspx?keyID={$keyID}&vCode={$vCode}"; |
| 980 | 980 | $xml = makeApiRequest($url); |
| 981 | 981 | foreach ($xml->result->rowset->row as $tower) { |
| 982 | - $typeID = (int)$tower->attributes()->typeID; |
|
| 983 | - $locationID = (int)$tower->attributes()->locationID; |
|
| 984 | - if ($locationID === (int)$systemID) { |
|
| 982 | + $typeID = (int) $tower->attributes()->typeID; |
|
| 983 | + $locationID = (int) $tower->attributes()->locationID; |
|
| 984 | + if ($locationID === (int) $systemID) { |
|
| 985 | 985 | if ($typeID === 12235 || $typeID === 20059 || $typeID === 20060 || $typeID === 27532 || $typeID === 27591 || $typeID === 27594 || $typeID === 27530 || $typeID === 27589 || $typeID === 27592 || $typeID === 27780 || $typeID === 27782 || $typeID === 27784 || $typeID === 27786 || $typeID === 27788 || $typeID === 27790) { |
| 986 | 986 | return '1'; |
| 987 | 987 | } |
@@ -4,71 +4,71 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | class sysInfo |
| 6 | 6 | { |
| 7 | - public $config; |
|
| 8 | - public $discord; |
|
| 9 | - public $logger; |
|
| 10 | - private $excludeChannel; |
|
| 11 | - private $message; |
|
| 12 | - private $triggers; |
|
| 13 | - |
|
| 14 | - public function init($config, $discord, $logger) |
|
| 15 | - { |
|
| 16 | - $this->config = $config; |
|
| 17 | - $this->discord = $discord; |
|
| 18 | - $this->logger = $logger; |
|
| 19 | - $this->excludeChannel = $this->config['bot']['restrictedChannels']; |
|
| 20 | - $this->triggers[] = $this->config['bot']['trigger'] . 'sys'; |
|
| 21 | - $this->triggers[] = $this->config['bot']['trigger'] . 'Sys'; |
|
| 22 | - $this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo'; |
|
| 23 | - $this->triggers[] = $this->config['bot']['trigger'] . 'system'; |
|
| 24 | - $this->triggers[] = $this->config['bot']['trigger'] . 'System'; |
|
| 25 | - $this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo'; |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function onMessage($msgData, $message) |
|
| 29 | - { |
|
| 30 | - $channelID = (int) $msgData['message']['channelID']; |
|
| 31 | - |
|
| 32 | - if(in_array($channelID, $this->excludeChannel, true)) |
|
| 33 | - { |
|
| 34 | - return null; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - $this->message = $message; |
|
| 38 | - |
|
| 39 | - $message = $msgData['message']['message']; |
|
| 40 | - $user = $msgData['message']['from']; |
|
| 41 | - |
|
| 42 | - $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']); |
|
| 43 | - if(isset($data['trigger'])) |
|
| 44 | - { |
|
| 45 | - $messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString']; |
|
| 46 | - if(is_numeric($messageString)) |
|
| 47 | - { |
|
| 48 | - $messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString)); |
|
| 49 | - } |
|
| 50 | - $cleanString = urlencode($messageString); |
|
| 51 | - $sysID = urlencode(getSystemID($cleanString)); |
|
| 52 | - |
|
| 53 | - //Check if we get a system back, otherwise check for partials |
|
| 54 | - if(empty($sysID)) |
|
| 55 | - { |
|
| 7 | + public $config; |
|
| 8 | + public $discord; |
|
| 9 | + public $logger; |
|
| 10 | + private $excludeChannel; |
|
| 11 | + private $message; |
|
| 12 | + private $triggers; |
|
| 13 | + |
|
| 14 | + public function init($config, $discord, $logger) |
|
| 15 | + { |
|
| 16 | + $this->config = $config; |
|
| 17 | + $this->discord = $discord; |
|
| 18 | + $this->logger = $logger; |
|
| 19 | + $this->excludeChannel = $this->config['bot']['restrictedChannels']; |
|
| 20 | + $this->triggers[] = $this->config['bot']['trigger'] . 'sys'; |
|
| 21 | + $this->triggers[] = $this->config['bot']['trigger'] . 'Sys'; |
|
| 22 | + $this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo'; |
|
| 23 | + $this->triggers[] = $this->config['bot']['trigger'] . 'system'; |
|
| 24 | + $this->triggers[] = $this->config['bot']['trigger'] . 'System'; |
|
| 25 | + $this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo'; |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function onMessage($msgData, $message) |
|
| 29 | + { |
|
| 30 | + $channelID = (int) $msgData['message']['channelID']; |
|
| 31 | + |
|
| 32 | + if(in_array($channelID, $this->excludeChannel, true)) |
|
| 33 | + { |
|
| 34 | + return null; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + $this->message = $message; |
|
| 38 | + |
|
| 39 | + $message = $msgData['message']['message']; |
|
| 40 | + $user = $msgData['message']['from']; |
|
| 41 | + |
|
| 42 | + $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']); |
|
| 43 | + if(isset($data['trigger'])) |
|
| 44 | + { |
|
| 45 | + $messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString']; |
|
| 46 | + if(is_numeric($messageString)) |
|
| 47 | + { |
|
| 48 | + $messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString)); |
|
| 49 | + } |
|
| 50 | + $cleanString = urlencode($messageString); |
|
| 51 | + $sysID = urlencode(getSystemID($cleanString)); |
|
| 52 | + |
|
| 53 | + //Check if we get a system back, otherwise check for partials |
|
| 54 | + if(empty($sysID)) |
|
| 55 | + { |
|
| 56 | 56 | return $this->message->reply('**Error:** no data available'); |
| 57 | - } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - $systemDetails = systemDetails($sysID); |
|
| 60 | - if (null === $systemDetails) |
|
| 61 | - { |
|
| 62 | - return $this->message->reply('**Error:** ESI is down. Try again later.'); |
|
| 63 | - } |
|
| 59 | + $systemDetails = systemDetails($sysID); |
|
| 60 | + if (null === $systemDetails) |
|
| 61 | + { |
|
| 62 | + return $this->message->reply('**Error:** ESI is down. Try again later.'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/"; |
|
| 66 | - $json = json_decode(file_get_contents($url)); |
|
| 65 | + $url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/"; |
|
| 66 | + $json = json_decode(file_get_contents($url)); |
|
| 67 | 67 | |
| 68 | - $regionID = $json->info->regionID; |
|
| 69 | - $regionName = getRegionName($regionID); |
|
| 68 | + $regionID = $json->info->regionID; |
|
| 69 | + $regionName = getRegionName($regionID); |
|
| 70 | 70 | |
| 71 | - $thisMonth = (string)date('Ym'); |
|
| 71 | + $thisMonth = (string)date('Ym'); |
|
| 72 | 72 | $lastMonth = (string)date('Ym', strtotime('first day of previous month')); |
| 73 | 73 | |
| 74 | 74 | $thisMonthKill = $json->months->$thisMonth->shipsDestroyed; |
@@ -78,21 +78,21 @@ discard block |
||
| 78 | 78 | $activeKills = $activePVP->kills->count; |
| 79 | 79 | $activeChars = $activePVP->characters->count; |
| 80 | 80 | |
| 81 | - $sysName = $systemDetails['name']; |
|
| 82 | - $secStatus = round($systemDetails['security_status'],2); |
|
| 81 | + $sysName = $systemDetails['name']; |
|
| 82 | + $secStatus = round($systemDetails['security_status'],2); |
|
| 83 | 83 | |
| 84 | - $npc = "https://api.eveonline.com/map/kills.xml.aspx"; |
|
| 85 | - $npc = new SimpleXMLElement(file_get_contents($npc)); |
|
| 86 | - foreach($npc->result->rowset->row as $row){ |
|
| 87 | - if($row->attributes()->solarSystemID == $sysID){ |
|
| 88 | - $npcKills = $row->attributes()->factionKills; |
|
| 89 | - $podKills = $row->attributes()->podKills; |
|
| 90 | - } |
|
| 91 | - } |
|
| 84 | + $npc = "https://api.eveonline.com/map/kills.xml.aspx"; |
|
| 85 | + $npc = new SimpleXMLElement(file_get_contents($npc)); |
|
| 86 | + foreach($npc->result->rowset->row as $row){ |
|
| 87 | + if($row->attributes()->solarSystemID == $sysID){ |
|
| 88 | + $npcKills = $row->attributes()->factionKills; |
|
| 89 | + $podKills = $row->attributes()->podKills; |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - $url = "https://zkillboard.com/system/{$sysID}/"; |
|
| 93 | + $url = "https://zkillboard.com/system/{$sysID}/"; |
|
| 94 | 94 | |
| 95 | - $msg = "```Systeminfo |
|
| 95 | + $msg = "```Systeminfo |
|
| 96 | 96 | Name: {$sysName} |
| 97 | 97 | Region: {$regionName} |
| 98 | 98 | Security: {$secStatus} |
@@ -109,18 +109,18 @@ discard block |
||
| 109 | 109 | ``` |
| 110 | 110 | |
| 111 | 111 | More information: $url"; |
| 112 | - $this->logger->addInfo("sysInfo: Sending system information to {$user}"); |
|
| 113 | - $this->message->reply($msg); |
|
| 114 | - } |
|
| 115 | - return null; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - public function information() |
|
| 119 | - { |
|
| 120 | - return array( |
|
| 121 | - 'name' => 'sys', |
|
| 122 | - 'trigger' => $this->triggers, |
|
| 123 | - 'information' => 'Returns information for the given system' |
|
| 124 | - ); |
|
| 125 | - } |
|
| 112 | + $this->logger->addInfo("sysInfo: Sending system information to {$user}"); |
|
| 113 | + $this->message->reply($msg); |
|
| 114 | + } |
|
| 115 | + return null; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + public function information() |
|
| 119 | + { |
|
| 120 | + return array( |
|
| 121 | + 'name' => 'sys', |
|
| 122 | + 'trigger' => $this->triggers, |
|
| 123 | + 'information' => 'Returns information for the given system' |
|
| 124 | + ); |
|
| 125 | + } |
|
| 126 | 126 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $channelID = (int) $msgData['message']['channelID']; |
| 31 | 31 | |
| 32 | - if(in_array($channelID, $this->excludeChannel, true)) |
|
| 32 | + if (in_array($channelID, $this->excludeChannel, true)) |
|
| 33 | 33 | { |
| 34 | 34 | return null; |
| 35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | $user = $msgData['message']['from']; |
| 41 | 41 | |
| 42 | 42 | $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']); |
| 43 | - if(isset($data['trigger'])) |
|
| 43 | + if (isset($data['trigger'])) |
|
| 44 | 44 | { |
| 45 | 45 | $messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString']; |
| 46 | - if(is_numeric($messageString)) |
|
| 46 | + if (is_numeric($messageString)) |
|
| 47 | 47 | { |
| 48 | 48 | $messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString)); |
| 49 | 49 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $sysID = urlencode(getSystemID($cleanString)); |
| 52 | 52 | |
| 53 | 53 | //Check if we get a system back, otherwise check for partials |
| 54 | - if(empty($sysID)) |
|
| 54 | + if (empty($sysID)) |
|
| 55 | 55 | { |
| 56 | 56 | return $this->message->reply('**Error:** no data available'); |
| 57 | 57 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | $regionID = $json->info->regionID; |
| 69 | 69 | $regionName = getRegionName($regionID); |
| 70 | 70 | |
| 71 | - $thisMonth = (string)date('Ym'); |
|
| 72 | - $lastMonth = (string)date('Ym', strtotime('first day of previous month')); |
|
| 71 | + $thisMonth = (string) date('Ym'); |
|
| 72 | + $lastMonth = (string) date('Ym', strtotime('first day of previous month')); |
|
| 73 | 73 | |
| 74 | 74 | $thisMonthKill = $json->months->$thisMonth->shipsDestroyed; |
| 75 | 75 | $lastMonthKill = $json->months->$lastMonth->shipsDestroyed; |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $activeChars = $activePVP->characters->count; |
| 80 | 80 | |
| 81 | 81 | $sysName = $systemDetails['name']; |
| 82 | - $secStatus = round($systemDetails['security_status'],2); |
|
| 82 | + $secStatus = round($systemDetails['security_status'], 2); |
|
| 83 | 83 | |
| 84 | 84 | $npc = "https://api.eveonline.com/map/kills.xml.aspx"; |
| 85 | 85 | $npc = new SimpleXMLElement(file_get_contents($npc)); |
| 86 | - foreach($npc->result->rowset->row as $row){ |
|
| 87 | - if($row->attributes()->solarSystemID == $sysID){ |
|
| 86 | + foreach ($npc->result->rowset->row as $row) { |
|
| 87 | + if ($row->attributes()->solarSystemID == $sysID) { |
|
| 88 | 88 | $npcKills = $row->attributes()->factionKills; |
| 89 | 89 | $podKills = $row->attributes()->podKills; |
| 90 | 90 | } |