shibdib /
Dramiel
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * The MIT License (MIT). |
||
| 4 | * |
||
| 5 | * Copyright (c) 2016 Robert Sardinia |
||
| 6 | * |
||
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
||
| 8 | * of this software and associated documentation files (the "Software"), to deal |
||
| 9 | * in the Software without restriction, including without limitation the rights |
||
| 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||
| 11 | * copies of the Software, and to permit persons to whom the Software is |
||
| 12 | * furnished to do so, subject to the following conditions: |
||
| 13 | * |
||
| 14 | * The above copyright notice and this permission notice shall be included in all |
||
| 15 | * copies or substantial portions of the Software. |
||
| 16 | * |
||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||
| 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||
| 23 | * SOFTWARE. |
||
| 24 | */ |
||
| 25 | use Discord\Discord; |
||
| 26 | use Discord\Parts\Channel\Channel; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Class siloFull. |
||
| 30 | * |
||
| 31 | * @property towerRace |
||
| 32 | */ |
||
| 33 | class siloFull |
||
| 34 | { |
||
| 35 | /* |
||
| 36 | * @var |
||
| 37 | */ |
||
| 38 | public $config; |
||
| 39 | /* |
||
| 40 | * @var |
||
| 41 | */ |
||
| 42 | public $discord; |
||
| 43 | /* |
||
| 44 | * @var |
||
| 45 | */ |
||
| 46 | public $logger; |
||
| 47 | /* |
||
| 48 | * @var |
||
| 49 | */ |
||
| 50 | public $toDiscordChannel; |
||
| 51 | protected $keyID; |
||
| 52 | protected $vCode; |
||
| 53 | protected $prefix; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param $config |
||
| 57 | * @param $discord |
||
| 58 | * @param $logger |
||
| 59 | */ |
||
| 60 | View Code Duplication | public function init($config, $discord, $logger) |
|
| 61 | { |
||
| 62 | $this->config = $config; |
||
| 63 | $this->discord = $discord; |
||
| 64 | $this->logger = $logger; |
||
| 65 | $this->toDiscordChannel = $config['plugins']['siloFull']['channelID']; |
||
| 66 | $this->keyID = $config['plugins']['siloFull']['keyID']; |
||
| 67 | $this->vCode = $config['plugins']['siloFull']['vCode']; |
||
| 68 | $this->towerRace = $config['plugins']['siloFull']['towerRace']; |
||
| 69 | $lastCheck = getPermCache("siloLastChecked{$this->keyID}"); |
||
| 70 | if ($lastCheck == null) { |
||
| 71 | // Schedule it for right now if first run |
||
| 72 | setPermCache("siloLastChecked{$this->keyID}", time() - 5); |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | |||
| 77 | public function tick() |
||
| 78 | { |
||
| 79 | $lastChecked = getPermCache("siloLastChecked{$this->keyID}"); |
||
| 80 | $keyID = $this->keyID; |
||
| 81 | $vCode = $this->vCode; |
||
| 82 | if ($lastChecked <= time()) { |
||
| 83 | $this->logger->addInfo("Checking API Key {$keyID} for full silos"); |
||
| 84 | $this->checkTowers($keyID, $vCode); |
||
| 85 | } |
||
| 86 | } |
||
| 87 | |||
| 88 | public function checkTowers($keyID, $vCode) |
||
| 89 | { |
||
| 90 | $url = "https://api.eveonline.com/corp/AssetList.xml.aspx?keyID={$keyID}&vCode={$vCode}"; |
||
| 91 | $xml = makeApiRequest($url); |
||
| 92 | $siloCount = 0; |
||
| 93 | $towerMulti = 0; |
||
| 94 | $towerFull = 20000; |
||
| 95 | $cleanFull = number_format($towerFull); |
||
| 96 | View Code Duplication | if ($this->towerRace == 1) { |
|
| 97 | $towerMulti = 0.50; |
||
| 98 | $towerFull = 30000; |
||
| 99 | $cleanFull = number_format($towerFull); |
||
| 100 | } |
||
| 101 | View Code Duplication | if ($this->towerRace == 2) { |
|
| 102 | $towerMulti = 1; |
||
| 103 | $towerFull = 40000; |
||
| 104 | $cleanFull = number_format($towerFull); |
||
| 105 | } |
||
| 106 | foreach ($xml->result->rowset->row as $structures) { |
||
| 107 | //Check silos |
||
| 108 | if ($structures->attributes()->typeID == 14343) { |
||
| 109 | if (isset($structures->rowset->row)) { |
||
| 110 | foreach ($structures->rowset->row as $silo) { |
||
| 111 | $moonGoo = $silo->attributes()->typeID; |
||
| 112 | switch ($moonGoo) { |
||
| 113 | View Code Duplication | case 16634: |
|
| 114 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16634], 'ccp'); |
||
| 115 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 116 | $towerWarn = 180000 + (180000 * $towerMulti); |
||
| 117 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 118 | $gooAmount = $silo->attributes()->quantity; |
||
| 119 | $gooVolume = 0.1; |
||
| 120 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 121 | $cleanNumber = number_format($gooCurrent); |
||
| 122 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 123 | if ($gooCurrent == $towerFull) { |
||
| 124 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 125 | } |
||
| 126 | $msg .= "**System: **{$systemName}\n"; |
||
| 127 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 128 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 129 | // Send the msg to the channel; |
||
| 130 | $channelID = $this->toDiscordChannel; |
||
| 131 | $channel = Channel::find($channelID); |
||
| 132 | $channel->sendMessage($msg, false); |
||
| 133 | $siloCount++; |
||
| 134 | sleep(1); |
||
| 135 | } |
||
| 136 | break; |
||
| 137 | View Code Duplication | case 16643: |
|
| 138 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16643], 'ccp'); |
||
| 139 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 140 | $towerWarn = 45000 + (45000 * $towerMulti); |
||
| 141 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 142 | $gooAmount = $silo->attributes()->quantity; |
||
| 143 | $gooVolume = 0.4; |
||
| 144 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 145 | $cleanNumber = number_format($gooCurrent); |
||
| 146 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 147 | if ($gooCurrent == $towerFull) { |
||
| 148 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 149 | } |
||
| 150 | $msg .= "**System: **{$systemName}\n"; |
||
| 151 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 152 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 153 | // Send the msg to the channel; |
||
| 154 | $channelID = $this->toDiscordChannel; |
||
| 155 | $channel = Channel::find($channelID); |
||
| 156 | $channel->sendMessage($msg, false); |
||
| 157 | $siloCount++; |
||
| 158 | sleep(1); |
||
| 159 | } |
||
| 160 | break; |
||
| 161 | View Code Duplication | case 16647: |
|
| 162 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16647], 'ccp'); |
||
| 163 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 164 | $towerWarn = 22500 + (22500 * $towerMulti); |
||
| 165 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 166 | $gooAmount = $silo->attributes()->quantity; |
||
| 167 | $gooVolume = 0.8; |
||
| 168 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 169 | $cleanNumber = number_format($gooCurrent); |
||
| 170 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 171 | if ($gooCurrent == $towerFull) { |
||
| 172 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 173 | } |
||
| 174 | $msg .= "**System: **{$systemName}\n"; |
||
| 175 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 176 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 177 | // Send the msg to the channel; |
||
| 178 | $channelID = $this->toDiscordChannel; |
||
| 179 | $channel = Channel::find($channelID); |
||
| 180 | $channel->sendMessage($msg, false); |
||
| 181 | $siloCount++; |
||
| 182 | sleep(1); |
||
| 183 | } |
||
| 184 | break; |
||
| 185 | View Code Duplication | case 16641: |
|
| 186 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16641], 'ccp'); |
||
| 187 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 188 | $towerWarn = 30000 + (30000 * $towerMulti); |
||
| 189 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 190 | $gooAmount = $silo->attributes()->quantity; |
||
| 191 | $gooVolume = 0.6; |
||
| 192 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 193 | $cleanNumber = number_format($gooCurrent); |
||
| 194 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 195 | if ($gooCurrent == $towerFull) { |
||
| 196 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 197 | } |
||
| 198 | $msg .= "**System: **{$systemName}\n"; |
||
| 199 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 200 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 201 | // Send the msg to the channel; |
||
| 202 | $channelID = $this->toDiscordChannel; |
||
| 203 | $channel = Channel::find($channelID); |
||
| 204 | $channel->sendMessage($msg, false); |
||
| 205 | $siloCount++; |
||
| 206 | sleep(1); |
||
| 207 | } |
||
| 208 | break; |
||
| 209 | View Code Duplication | case 16640: |
|
| 210 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16640], 'ccp'); |
||
| 211 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 212 | $towerWarn = 45000 + (45000 * $towerMulti); |
||
| 213 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 214 | $gooAmount = $silo->attributes()->quantity; |
||
| 215 | $gooVolume = 0.4; |
||
| 216 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 217 | $cleanNumber = number_format($gooCurrent); |
||
| 218 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 219 | if ($gooCurrent == $towerFull) { |
||
| 220 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 221 | } |
||
| 222 | $msg .= "**System: **{$systemName}\n"; |
||
| 223 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 224 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 225 | // Send the msg to the channel; |
||
| 226 | $channelID = $this->toDiscordChannel; |
||
| 227 | $channel = Channel::find($channelID); |
||
| 228 | $channel->sendMessage($msg, false); |
||
| 229 | $siloCount++; |
||
| 230 | sleep(1); |
||
| 231 | } |
||
| 232 | break; |
||
| 233 | View Code Duplication | case 16635: |
|
| 234 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16635], 'ccp'); |
||
| 235 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 236 | $towerWarn = 180000 + (180000 * $towerMulti); |
||
| 237 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 238 | $gooAmount = $silo->attributes()->quantity; |
||
| 239 | $gooVolume = 0.1; |
||
| 240 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 241 | $cleanNumber = number_format($gooCurrent); |
||
| 242 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 243 | if ($gooCurrent == $towerFull) { |
||
| 244 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 245 | } |
||
| 246 | $msg .= "**System: **{$systemName}\n"; |
||
| 247 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 248 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 249 | // Send the msg to the channel; |
||
| 250 | $channelID = $this->toDiscordChannel; |
||
| 251 | $channel = Channel::find($channelID); |
||
| 252 | $channel->sendMessage($msg, false); |
||
| 253 | $siloCount++; |
||
| 254 | sleep(1); |
||
| 255 | } |
||
| 256 | break; |
||
| 257 | View Code Duplication | case 16648: |
|
| 258 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16648], 'ccp'); |
||
| 259 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 260 | $towerWarn = 22500 + (22500 * $towerMulti); |
||
| 261 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 262 | $gooAmount = $silo->attributes()->quantity; |
||
| 263 | $gooVolume = 0.8; |
||
| 264 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 265 | $cleanNumber = number_format($gooCurrent); |
||
| 266 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 267 | if ($gooCurrent == $towerFull) { |
||
| 268 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 269 | } |
||
| 270 | $msg .= "**System: **{$systemName}\n"; |
||
| 271 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 272 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 273 | // Send the msg to the channel; |
||
| 274 | $channelID = $this->toDiscordChannel; |
||
| 275 | $channel = Channel::find($channelID); |
||
| 276 | $channel->sendMessage($msg, false); |
||
| 277 | $siloCount++; |
||
| 278 | sleep(1); |
||
| 279 | } |
||
| 280 | break; |
||
| 281 | View Code Duplication | case 16633: |
|
| 282 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16633], 'ccp'); |
||
| 283 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 284 | $towerWarn = 180000 + (180000 * $towerMulti); |
||
| 285 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 286 | $gooAmount = $silo->attributes()->quantity; |
||
| 287 | $gooVolume = 0.1; |
||
| 288 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 289 | $cleanNumber = number_format($gooCurrent); |
||
| 290 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 291 | if ($gooCurrent == $towerFull) { |
||
| 292 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 293 | } |
||
| 294 | $msg .= "**System: **{$systemName}\n"; |
||
| 295 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 296 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 297 | // Send the msg to the channel; |
||
| 298 | $channelID = $this->toDiscordChannel; |
||
| 299 | $channel = Channel::find($channelID); |
||
| 300 | $channel->sendMessage($msg, false); |
||
| 301 | $siloCount++; |
||
| 302 | sleep(1); |
||
| 303 | } |
||
| 304 | break; |
||
| 305 | View Code Duplication | case 16646: |
|
| 306 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16646], 'ccp'); |
||
| 307 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 308 | $towerWarn = 22500 + (22500 * $towerMulti); |
||
| 309 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 310 | $gooAmount = $silo->attributes()->quantity; |
||
| 311 | $gooVolume = 0.8; |
||
| 312 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 313 | $cleanNumber = number_format($gooCurrent); |
||
| 314 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 315 | if ($gooCurrent == $towerFull) { |
||
| 316 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 317 | } |
||
| 318 | $msg .= "**System: **{$systemName}\n"; |
||
| 319 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 320 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 321 | // Send the msg to the channel; |
||
| 322 | $channelID = $this->toDiscordChannel; |
||
| 323 | $channel = Channel::find($channelID); |
||
| 324 | $channel->sendMessage($msg, false); |
||
| 325 | $siloCount++; |
||
| 326 | sleep(1); |
||
| 327 | } |
||
| 328 | break; |
||
| 329 | View Code Duplication | case 16651: |
|
| 330 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16651], 'ccp'); |
||
| 331 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 332 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 333 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 334 | $gooAmount = $silo->attributes()->quantity; |
||
| 335 | $gooVolume = 1; |
||
| 336 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 337 | $cleanNumber = number_format($gooCurrent); |
||
| 338 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 339 | if ($gooCurrent == $towerFull) { |
||
| 340 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 341 | } |
||
| 342 | $msg .= "**System: **{$systemName}\n"; |
||
| 343 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 344 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 345 | // Send the msg to the channel; |
||
| 346 | $channelID = $this->toDiscordChannel; |
||
| 347 | $channel = Channel::find($channelID); |
||
| 348 | $channel->sendMessage($msg, false); |
||
| 349 | $siloCount++; |
||
| 350 | sleep(1); |
||
| 351 | } |
||
| 352 | break; |
||
| 353 | View Code Duplication | case 16650: |
|
| 354 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16650], 'ccp'); |
||
| 355 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 356 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 357 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 358 | $gooAmount = $silo->attributes()->quantity; |
||
| 359 | $gooVolume = 1; |
||
| 360 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 361 | $cleanNumber = number_format($gooCurrent); |
||
| 362 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 363 | if ($gooCurrent == $towerFull) { |
||
| 364 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 365 | } |
||
| 366 | $msg .= "**System: **{$systemName}\n"; |
||
| 367 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 368 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 369 | // Send the msg to the channel; |
||
| 370 | $channelID = $this->toDiscordChannel; |
||
| 371 | $channel = Channel::find($channelID); |
||
| 372 | $channel->sendMessage($msg, false); |
||
| 373 | $siloCount++; |
||
| 374 | sleep(1); |
||
| 375 | } |
||
| 376 | break; |
||
| 377 | View Code Duplication | case 16644: |
|
| 378 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16644], 'ccp'); |
||
| 379 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 380 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 381 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 382 | $gooAmount = $silo->attributes()->quantity; |
||
| 383 | $gooVolume = 1; |
||
| 384 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 385 | $cleanNumber = number_format($gooCurrent); |
||
| 386 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 387 | if ($gooCurrent == $towerFull) { |
||
| 388 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 389 | } |
||
| 390 | $msg .= "**System: **{$systemName}\n"; |
||
| 391 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 392 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 393 | // Send the msg to the channel; |
||
| 394 | $channelID = $this->toDiscordChannel; |
||
| 395 | $channel = Channel::find($channelID); |
||
| 396 | $channel->sendMessage($msg, false); |
||
| 397 | $siloCount++; |
||
| 398 | sleep(1); |
||
| 399 | } |
||
| 400 | break; |
||
| 401 | View Code Duplication | case 16652: |
|
| 402 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16652], 'ccp'); |
||
| 403 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 404 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 405 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 406 | $gooAmount = $silo->attributes()->quantity; |
||
| 407 | $gooVolume = 1; |
||
| 408 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 409 | $cleanNumber = number_format($gooCurrent); |
||
| 410 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 411 | if ($gooCurrent == $towerFull) { |
||
| 412 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 413 | } |
||
| 414 | $msg .= "**System: **{$systemName}\n"; |
||
| 415 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 416 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 417 | // Send the msg to the channel; |
||
| 418 | $channelID = $this->toDiscordChannel; |
||
| 419 | $channel = Channel::find($channelID); |
||
| 420 | $channel->sendMessage($msg, false); |
||
| 421 | $siloCount++; |
||
| 422 | sleep(1); |
||
| 423 | } |
||
| 424 | break; |
||
| 425 | View Code Duplication | case 16639: |
|
| 426 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16639], 'ccp'); |
||
| 427 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 428 | $towerWarn = 45000 + (45000 * $towerMulti); |
||
| 429 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 430 | $gooAmount = $silo->attributes()->quantity; |
||
| 431 | $gooVolume = 0.4; |
||
| 432 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 433 | $cleanNumber = number_format($gooCurrent); |
||
| 434 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 435 | if ($gooCurrent == $towerFull) { |
||
| 436 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 437 | } |
||
| 438 | $msg .= "**System: **{$systemName}\n"; |
||
| 439 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 440 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 441 | // Send the msg to the channel; |
||
| 442 | $channelID = $this->toDiscordChannel; |
||
| 443 | $channel = Channel::find($channelID); |
||
| 444 | $channel->sendMessage($msg, false); |
||
| 445 | $siloCount++; |
||
| 446 | sleep(1); |
||
| 447 | } |
||
| 448 | break; |
||
| 449 | View Code Duplication | case 16636: |
|
| 450 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16636], 'ccp'); |
||
| 451 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 452 | $towerWarn = 180000 + (180000 * $towerMulti); |
||
| 453 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 454 | $gooAmount = $silo->attributes()->quantity; |
||
| 455 | $gooVolume = 0.1; |
||
| 456 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 457 | $cleanNumber = number_format($gooCurrent); |
||
| 458 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 459 | if ($gooCurrent == $towerFull) { |
||
| 460 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 461 | } |
||
| 462 | $msg .= "**System: **{$systemName}\n"; |
||
| 463 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 464 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 465 | // Send the msg to the channel; |
||
| 466 | $channelID = $this->toDiscordChannel; |
||
| 467 | $channel = Channel::find($channelID); |
||
| 468 | $channel->sendMessage($msg, false); |
||
| 469 | $siloCount++; |
||
| 470 | sleep(1); |
||
| 471 | } |
||
| 472 | break; |
||
| 473 | View Code Duplication | case 16649: |
|
| 474 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16649], 'ccp'); |
||
| 475 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 476 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 477 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 478 | $gooAmount = $silo->attributes()->quantity; |
||
| 479 | $gooVolume = 1; |
||
| 480 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 481 | $cleanNumber = number_format($gooCurrent); |
||
| 482 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 483 | if ($gooCurrent == $towerFull) { |
||
| 484 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 485 | } |
||
| 486 | $msg .= "**System: **{$systemName}\n"; |
||
| 487 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 488 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 489 | // Send the msg to the channel; |
||
| 490 | $channelID = $this->toDiscordChannel; |
||
| 491 | $channel = Channel::find($channelID); |
||
| 492 | $channel->sendMessage($msg, false); |
||
| 493 | $siloCount++; |
||
| 494 | sleep(1); |
||
| 495 | } |
||
| 496 | break; |
||
| 497 | View Code Duplication | case 16653: |
|
| 498 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16653], 'ccp'); |
||
| 499 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 500 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 501 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 502 | $gooAmount = $silo->attributes()->quantity; |
||
| 503 | $gooVolume = 1; |
||
| 504 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 505 | $cleanNumber = number_format($gooCurrent); |
||
| 506 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 507 | if ($gooCurrent == $towerFull) { |
||
| 508 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 509 | } |
||
| 510 | $msg .= "**System: **{$systemName}\n"; |
||
| 511 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 512 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 513 | // Send the msg to the channel; |
||
| 514 | $channelID = $this->toDiscordChannel; |
||
| 515 | $channel = Channel::find($channelID); |
||
| 516 | $channel->sendMessage($msg, false); |
||
| 517 | $siloCount++; |
||
| 518 | sleep(1); |
||
| 519 | } |
||
| 520 | break; |
||
| 521 | View Code Duplication | case 16638: |
|
| 522 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16638], 'ccp'); |
||
| 523 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 524 | $towerWarn = 45000 + (45000 * $towerMulti); |
||
| 525 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 526 | $gooAmount = $silo->attributes()->quantity; |
||
| 527 | $gooVolume = 0.4; |
||
| 528 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 529 | $cleanNumber = number_format($gooCurrent); |
||
| 530 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 531 | if ($gooCurrent == $towerFull) { |
||
| 532 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 533 | } |
||
| 534 | $msg .= "**System: **{$systemName}\n"; |
||
| 535 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 536 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 537 | // Send the msg to the channel; |
||
| 538 | $channelID = $this->toDiscordChannel; |
||
| 539 | $channel = Channel::find($channelID); |
||
| 540 | $channel->sendMessage($msg, false); |
||
| 541 | $siloCount++; |
||
| 542 | sleep(1); |
||
| 543 | } |
||
| 544 | break; |
||
| 545 | View Code Duplication | case 16637: |
|
| 546 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16637], 'ccp'); |
||
| 547 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 548 | $towerWarn = 45000 + (45000 * $towerMulti); |
||
| 549 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 550 | $gooAmount = $silo->attributes()->quantity; |
||
| 551 | $gooVolume = 0.4; |
||
| 552 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 553 | $cleanNumber = number_format($gooCurrent); |
||
| 554 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 555 | if ($gooCurrent == $towerFull) { |
||
| 556 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 557 | } |
||
| 558 | $msg .= "**System: **{$systemName}\n"; |
||
| 559 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 560 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 561 | // Send the msg to the channel; |
||
| 562 | $channelID = $this->toDiscordChannel; |
||
| 563 | $channel = Channel::find($channelID); |
||
| 564 | $channel->sendMessage($msg, false); |
||
| 565 | $siloCount++; |
||
| 566 | sleep(1); |
||
| 567 | } |
||
| 568 | break; |
||
| 569 | View Code Duplication | case 16642: |
|
| 570 | $typeName = dbQueryField('SELECT typeName FROM invTypes WHERE typeID = :id', 'typeName', [':id' => 16642], 'ccp'); |
||
| 571 | $systemName = dbQueryField('SELECT solarSystemName FROM mapSolarSystems WHERE solarSystemID = :id', 'solarSystemName', [':id' => $structures->attributes()->locationID], 'ccp'); |
||
| 572 | $towerWarn = 18000 + (18000 * $towerMulti); |
||
| 573 | if ($silo->attributes()->quantity >= $towerWarn) { |
||
| 574 | $gooAmount = $silo->attributes()->quantity; |
||
| 575 | $gooVolume = 1; |
||
| 576 | $gooCurrent = $gooAmount * $gooVolume; |
||
| 577 | $cleanNumber = number_format($gooCurrent); |
||
| 578 | $msg = "**{$typeName} Silo Nearing Capacity**\n"; |
||
| 579 | if ($gooCurrent == $towerFull) { |
||
| 580 | $msg = "**{$typeName} Silo Full**\n"; |
||
| 581 | } |
||
| 582 | $msg .= "**System: **{$systemName}\n"; |
||
| 583 | $msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
||
| 584 | $this->logger->addInfo("{$typeName} Silo nearing capacity in {$systemName}"); |
||
| 585 | // Send the msg to the channel; |
||
| 586 | $channelID = $this->toDiscordChannel; |
||
| 587 | $channel = Channel::find($channelID); |
||
| 588 | $channel->sendMessage($msg, false); |
||
| 589 | $siloCount++; |
||
| 590 | sleep(1); |
||
| 591 | } |
||
| 592 | break; |
||
| 593 | } |
||
| 594 | } |
||
| 595 | } |
||
| 596 | } |
||
| 597 | } |
||
| 598 | $cached = $xml->cachedUntil[0]; |
||
| 599 | $baseUnix = strtotime($cached); |
||
| 600 | $cacheClr = $baseUnix - 13500; |
||
| 601 | View Code Duplication | if ($cacheClr <= time()) { |
|
| 602 | $weirdTime = time() + 21700; |
||
| 603 | $cacheTimer = gmdate('Y-m-d H:i:s', $weirdTime); |
||
| 604 | setPermCache("siloLastChecked{$keyID}", $weirdTime); |
||
| 605 | } else { |
||
| 606 | $cacheTimer = gmdate('Y-m-d H:i:s', $cacheClr); |
||
| 607 | setPermCache("siloLastChecked{$keyID}", $cacheClr); |
||
| 608 | } |
||
| 609 | |||
| 610 | View Code Duplication | if ($siloCount > 0) { |
|
| 611 | $msg = "Next Silo Check At: {$cacheTimer} EVE Time"; |
||
| 612 | // Send the msg to the channel; |
||
| 613 | $channelID = $this->toDiscordChannel; |
||
| 614 | $channel = Channel::find($channelID); |
||
| 615 | $channel->sendMessage($msg, false); |
||
| 616 | } |
||
| 617 | $this->logger->addInfo("Silo Check Complete Next Check At {$cacheTimer}"); |
||
| 618 | |||
| 619 | return; |
||
| 620 | |||
| 621 | |||
| 622 | function onMessage() |
||
|
0 ignored issues
–
show
|
|||
| 623 | { |
||
| 624 | } |
||
| 625 | |||
| 626 | /** |
||
| 627 | * @return array |
||
| 628 | */ |
||
| 629 | function information() |
||
| 630 | { |
||
| 631 | return [ |
||
| 632 | 'name' => '', |
||
| 633 | 'trigger' => [''], |
||
| 634 | 'information' => '', |
||
| 635 | ]; |
||
| 636 | } |
||
| 637 | } |
||
| 638 | } |
||
| 639 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return,dieorexitstatements that have been added for debug purposes.In the above example, the last
return falsewill never be executed, because a return statement has already been met in every possible execution path.