We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -98,8 +98,7 @@ discard block |
||
| 98 | 98 | $this->name = $db->getField('location_name'); |
| 99 | 99 | $this->processor = $db->getField('location_processor'); |
| 100 | 100 | $this->image = $db->getField('location_image'); |
| 101 | - } |
|
| 102 | - else { |
|
| 101 | + } else { |
|
| 103 | 102 | throw new Exception('Cannot find location: ' . $locationTypeID); |
| 104 | 103 | } |
| 105 | 104 | } |
@@ -158,8 +157,7 @@ discard block |
||
| 158 | 157 | if ($bool === true) { |
| 159 | 158 | $this->db->query('INSERT IGNORE INTO location_is_fed (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')'); |
| 160 | 159 | $this->fed = true; |
| 161 | - } |
|
| 162 | - else if ($bool === false) { |
|
| 160 | + } else if ($bool === false) { |
|
| 163 | 161 | $this->db->query('DELETE FROM location_is_fed WHERE ' . $this->SQL . ' LIMIT 1'); |
| 164 | 162 | $this->fed = false; |
| 165 | 163 | } |
@@ -180,8 +178,7 @@ discard block |
||
| 180 | 178 | if ($bool === true) { |
| 181 | 179 | $this->db->query('INSERT INTO location_is_bank (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')'); |
| 182 | 180 | $this->bank = true; |
| 183 | - } |
|
| 184 | - else if ($bool === false) { |
|
| 181 | + } else if ($bool === false) { |
|
| 185 | 182 | $this->db->query('DELETE FROM location_is_bank WHERE ' . $this->SQL . ' LIMIT 1'); |
| 186 | 183 | $this->bank = false; |
| 187 | 184 | } |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | if ($bool === true) { |
| 203 | 200 | $this->db->query('INSERT IGNORE INTO location_is_bar (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')'); |
| 204 | 201 | $this->bar = true; |
| 205 | - } |
|
| 206 | - else if ($bool === false) { |
|
| 202 | + } else if ($bool === false) { |
|
| 207 | 203 | $this->db->query('DELETE FROM location_is_bar WHERE ' . $this->SQL . ' LIMIT 1'); |
| 208 | 204 | $this->bar = false; |
| 209 | 205 | } |
@@ -224,8 +220,7 @@ discard block |
||
| 224 | 220 | if ($bool === true) { |
| 225 | 221 | $this->db->query('INSERT IGNORE INTO location_is_hq (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')'); |
| 226 | 222 | $this->HQ = true; |
| 227 | - } |
|
| 228 | - else if ($bool === false) { |
|
| 223 | + } else if ($bool === false) { |
|
| 229 | 224 | $this->db->query('DELETE FROM location_is_hq WHERE ' . $this->SQL . ' LIMIT 1'); |
| 230 | 225 | $this->HQ = false; |
| 231 | 226 | } |
@@ -246,8 +241,7 @@ discard block |
||
| 246 | 241 | if ($bool === true) { |
| 247 | 242 | $this->db->query('INSERT INTO location_is_ug (location_type_id) values (' . $this->db->escapeNumber($this->getTypeID()) . ')'); |
| 248 | 243 | $this->UG = true; |
| 249 | - } |
|
| 250 | - else if ($bool === false) { |
|
| 244 | + } else if ($bool === false) { |
|
| 251 | 245 | $this->db->query('DELETE FROM location_is_ug WHERE ' . $this->SQL . ' LIMIT 1'); |
| 252 | 246 | $this->UG = false; |
| 253 | 247 | } |
@@ -335,8 +329,9 @@ discard block |
||
| 335 | 329 | if (!isset($this->weaponsSold)) { |
| 336 | 330 | $this->weaponsSold = array(); |
| 337 | 331 | $this->db->query('SELECT * FROM location_sells_weapons JOIN weapon_type USING (weapon_type_id) WHERE ' . $this->SQL); |
| 338 | - while ($this->db->nextRecord()) |
|
| 339 | - $this->weaponsSold[$this->db->getInt('weapon_type_id')] = SmrWeapon::getWeapon($this->db->getInt('weapon_type_id'), false, $this->db); |
|
| 332 | + while ($this->db->nextRecord()) { |
|
| 333 | + $this->weaponsSold[$this->db->getInt('weapon_type_id')] = SmrWeapon::getWeapon($this->db->getInt('weapon_type_id'), false, $this->db); |
|
| 334 | + } |
|
| 340 | 335 | } |
| 341 | 336 | return $this->weaponsSold; |
| 342 | 337 | } |
@@ -375,8 +370,7 @@ discard block |
||
| 375 | 370 | if ($this->getTypeID() == LOCATION_TYPE_FEDERAL_HQ) { |
| 376 | 371 | $linkedLocations[] = SmrLocation::getLocation(LOCATION_TYPE_FEDERAL_BEACON); |
| 377 | 372 | $linkedLocations[] = SmrLocation::getLocation(LOCATION_TYPE_FEDERAL_MINT); |
| 378 | - } |
|
| 379 | - else { |
|
| 373 | + } else { |
|
| 380 | 374 | $raceID = $this->getRaceID(); |
| 381 | 375 | $linkedLocations[] = SmrLocation::getLocation(LOCATION_GROUP_RACIAL_BEACONS + $raceID); |
| 382 | 376 | $linkedLocations[] = SmrLocation::getLocation(LOCATION_GROUP_RACIAL_SHIPS + $raceID); |
@@ -227,8 +227,7 @@ |
||
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | $string = substr($string, 0, -1); |
| 230 | - } |
|
| 231 | - else { |
|
| 230 | + } else { |
|
| 232 | 231 | $string = $this->escape(implode($implodeString, $array), $autoQuotes, $quotes); |
| 233 | 232 | } |
| 234 | 233 | return $string; |
@@ -273,8 +273,7 @@ discard block |
||
| 273 | 273 | if ($replacement < 0) { |
| 274 | 274 | // Shift everything up by one and put the selected weapon at the bottom |
| 275 | 275 | array_push($this->weapons, array_shift($this->weapons)); |
| 276 | - } |
|
| 277 | - else { |
|
| 276 | + } else { |
|
| 278 | 277 | // Swap the selected weapon with the one above it |
| 279 | 278 | $temp = $this->weapons[$replacement]; |
| 280 | 279 | $this->weapons[$replacement] = $this->weapons[$orderID]; |
@@ -288,8 +287,7 @@ discard block |
||
| 288 | 287 | if ($replacement >= count($this->weapons)) { |
| 289 | 288 | // Shift everything down by one and put the selected weapon at the top |
| 290 | 289 | array_unshift($this->weapons, array_pop($this->weapons)); |
| 291 | - } |
|
| 292 | - else { |
|
| 290 | + } else { |
|
| 293 | 291 | // Swap the selected weapon with the one below it |
| 294 | 292 | $temp = $this->weapons[$replacement]; |
| 295 | 293 | $this->weapons[$replacement] = $this->weapons[$orderID]; |
@@ -348,8 +346,7 @@ discard block |
||
| 348 | 346 | $this->setArmour(150, true); |
| 349 | 347 | $this->setCargoHolds(40); |
| 350 | 348 | $this->setShipTypeID(SHIP_TYPE_NEWBIE_MERCHANT_VESSEL); |
| 351 | - } |
|
| 352 | - else { |
|
| 349 | + } else { |
|
| 353 | 350 | $this->setShields(50, true); |
| 354 | 351 | $this->setArmour(50, true); |
| 355 | 352 | $this->setCargoHolds(5); |
@@ -193,22 +193,28 @@ |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { |
| 196 | - if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 196 | + if (!$this->canShootForces()) { |
|
| 197 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 197 | 198 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 199 | + } |
|
| 198 | 200 | $damage =& $this->getModifiedDamage(); |
| 199 | 201 | return $damage; |
| 200 | 202 | } |
| 201 | 203 | |
| 202 | 204 | public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { |
| 203 | - if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 205 | + if (!$this->canShootPorts()) { |
|
| 206 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 204 | 207 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 208 | + } |
|
| 205 | 209 | $damage =& $this->getModifiedDamage(); |
| 206 | 210 | return $damage; |
| 207 | 211 | } |
| 208 | 212 | |
| 209 | 213 | public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { |
| 210 | - if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 214 | + if (!$this->canShootPlanets()) { |
|
| 215 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 211 | 216 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 217 | + } |
|
| 212 | 218 | $damage =& $this->getModifiedDamage(); |
| 213 | 219 | |
| 214 | 220 | $planetMod = self::PLANET_DAMAGE_MOD; |
@@ -279,8 +279,7 @@ discard block |
||
| 279 | 279 | // Changed (26/10/05) - scout drones count * 2 |
| 280 | 280 | if ($this->getCDs() == 0 && $this->getMines() == 0 && $this->getSDs() > 0) { |
| 281 | 281 | $time = self::TIME_PER_SCOUT_ONLY * $this->getSDs(); |
| 282 | - } |
|
| 283 | - else { |
|
| 282 | + } else { |
|
| 284 | 283 | $time = ($this->getCDs() * self::TIME_PERCENT_PER_COMBAT + $this->getSDs() * self::TIME_PERCENT_PER_SCOUT + $this->getMines() * self::TIME_PERCENT_PER_MINE) * $this->getMaxGalaxyExpireTime(); |
| 285 | 284 | } |
| 286 | 285 | $this->setExpire(TIME + $time); |
@@ -307,11 +306,9 @@ discard block |
||
| 307 | 306 | } |
| 308 | 307 | if ($mines < 10) { |
| 309 | 308 | $turns = 1; |
| 310 | - } |
|
| 311 | - else if ($mines < 25) { |
|
| 309 | + } else if ($mines < 25) { |
|
| 312 | 310 | $turns = 2; |
| 313 | - } |
|
| 314 | - else { |
|
| 311 | + } else { |
|
| 315 | 312 | $turns = 3; |
| 316 | 313 | } |
| 317 | 314 | if ($ship->isFederal() || $ship->hasDCS()) { |
@@ -366,12 +363,10 @@ discard block |
||
| 366 | 363 | if (!$this->exists()) { |
| 367 | 364 | $this->db->query('DELETE FROM sector_has_forces WHERE ' . $this->SQL); |
| 368 | 365 | $this->isNew = true; |
| 369 | - } |
|
| 370 | - else if ($this->hasChanged) { |
|
| 366 | + } else if ($this->hasChanged) { |
|
| 371 | 367 | $this->db->query('UPDATE sector_has_forces SET combat_drones = ' . $this->db->escapeNumber($this->combatDrones) . ', scout_drones = ' . $this->db->escapeNumber($this->scoutDrones) . ', mines = ' . $this->db->escapeNumber($this->mines) . ', expire_time = ' . $this->db->escapeNumber($this->expire) . ' WHERE ' . $this->SQL); |
| 372 | 368 | } |
| 373 | - } |
|
| 374 | - else if ($this->exists()) { |
|
| 369 | + } else if ($this->exists()) { |
|
| 375 | 370 | $this->db->query('INSERT INTO sector_has_forces (game_id, sector_id, owner_id, combat_drones, scout_drones, mines, expire_time) |
| 376 | 371 | VALUES('.$this->db->escapeNumber($this->gameID) . ', ' . $this->db->escapeNumber($this->sectorID) . ', ' . $this->db->escapeNumber($this->ownerID) . ', ' . $this->db->escapeNumber($this->combatDrones) . ', ' . $this->db->escapeNumber($this->scoutDrones) . ', ' . $this->db->escapeNumber($this->mines) . ', ' . $this->db->escapeNumber($this->expire) . ')'); |
| 377 | 372 | $this->isNew = false; |
@@ -151,26 +151,19 @@ discard block |
||
| 151 | 151 | $level = $this->getLevel(); |
| 152 | 152 | if ($level < 9) { |
| 153 | 153 | return .0404; |
| 154 | - } |
|
| 155 | - elseif ($level < 19) { |
|
| 154 | + } elseif ($level < 19) { |
|
| 156 | 155 | return .0609; |
| 157 | - } |
|
| 158 | - elseif ($level < 29) { |
|
| 156 | + } elseif ($level < 29) { |
|
| 159 | 157 | return .1236; |
| 160 | - } |
|
| 161 | - elseif ($level < 39) { |
|
| 158 | + } elseif ($level < 39) { |
|
| 162 | 159 | return .050625; |
| 163 | - } |
|
| 164 | - elseif ($level < 49) { |
|
| 160 | + } elseif ($level < 49) { |
|
| 165 | 161 | return .0404; |
| 166 | - } |
|
| 167 | - elseif ($level < 59) { |
|
| 162 | + } elseif ($level < 59) { |
|
| 168 | 163 | return .030225; |
| 169 | - } |
|
| 170 | - elseif ($level < 69) { |
|
| 164 | + } elseif ($level < 69) { |
|
| 171 | 165 | return .0201; |
| 172 | - } |
|
| 173 | - else { |
|
| 166 | + } else { |
|
| 174 | 167 | return .018081; |
| 175 | 168 | } |
| 176 | 169 | } |
@@ -383,8 +376,7 @@ discard block |
||
| 383 | 376 | } |
| 384 | 377 | if ($delayed === false) { |
| 385 | 378 | $this->setShields($this->getShields() - $number); |
| 386 | - } |
|
| 387 | - else { |
|
| 379 | + } else { |
|
| 388 | 380 | $this->delayedShieldsDelta -= $number; |
| 389 | 381 | } |
| 390 | 382 | } |
@@ -395,8 +387,7 @@ discard block |
||
| 395 | 387 | } |
| 396 | 388 | if ($delayed === false) { |
| 397 | 389 | $this->setShields($this->getShields() + $number); |
| 398 | - } |
|
| 399 | - else { |
|
| 390 | + } else { |
|
| 400 | 391 | $this->delayedShieldsDelta += $number; |
| 401 | 392 | } |
| 402 | 393 | } |
@@ -428,8 +419,7 @@ discard block |
||
| 428 | 419 | } |
| 429 | 420 | if ($delayed === false) { |
| 430 | 421 | $this->setArmour($this->getArmour() - $number); |
| 431 | - } |
|
| 432 | - else { |
|
| 422 | + } else { |
|
| 433 | 423 | $this->delayedArmourDelta -= $number; |
| 434 | 424 | } |
| 435 | 425 | } |
@@ -440,8 +430,7 @@ discard block |
||
| 440 | 430 | } |
| 441 | 431 | if ($delayed === false) { |
| 442 | 432 | $this->setArmour($this->getArmour() + $number); |
| 443 | - } |
|
| 444 | - else { |
|
| 433 | + } else { |
|
| 445 | 434 | $this->delayedArmourDelta += $number; |
| 446 | 435 | } |
| 447 | 436 | } |
@@ -473,8 +462,7 @@ discard block |
||
| 473 | 462 | } |
| 474 | 463 | if ($delayed === false) { |
| 475 | 464 | $this->setCDs($this->getCDs() - $number); |
| 476 | - } |
|
| 477 | - else { |
|
| 465 | + } else { |
|
| 478 | 466 | $this->delayedCDsDelta -= $number; |
| 479 | 467 | } |
| 480 | 468 | } |
@@ -485,8 +473,7 @@ discard block |
||
| 485 | 473 | } |
| 486 | 474 | if ($delayed === false) { |
| 487 | 475 | $this->setCDs($this->getCDs() + $number); |
| 488 | - } |
|
| 489 | - else { |
|
| 476 | + } else { |
|
| 490 | 477 | $this->delayedCDsDelta += $number; |
| 491 | 478 | } |
| 492 | 479 | } |
@@ -580,8 +567,9 @@ discard block |
||
| 580 | 567 | // get supplies from db |
| 581 | 568 | $this->db->query('SELECT good_id, amount FROM planet_has_cargo WHERE ' . $this->SQL); |
| 582 | 569 | // adding cargo and amount to array |
| 583 | - while ($this->db->nextRecord()) |
|
| 584 | - $this->stockpile[$this->db->getInt('good_id')] = $this->db->getInt('amount'); |
|
| 570 | + while ($this->db->nextRecord()) { |
|
| 571 | + $this->stockpile[$this->db->getInt('good_id')] = $this->db->getInt('amount'); |
|
| 572 | + } |
|
| 585 | 573 | } |
| 586 | 574 | if ($goodID === false) { |
| 587 | 575 | return $this->stockpile; |
@@ -596,8 +584,7 @@ discard block |
||
| 596 | 584 | if ($goodID === false) { |
| 597 | 585 | $stockpile = $this->getStockpile($goodID); |
| 598 | 586 | return count($stockpile) > 0 && max($stockpile) > 0; |
| 599 | - } |
|
| 600 | - else { |
|
| 587 | + } else { |
|
| 601 | 588 | return $this->getStockpile($goodID) > 0; |
| 602 | 589 | } |
| 603 | 590 | } |
@@ -831,8 +818,7 @@ discard block |
||
| 831 | 818 | if ($amount != 0) { |
| 832 | 819 | $this->db->query('REPLACE INTO planet_has_cargo (game_id, sector_id, good_id, amount) ' . |
| 833 | 820 | 'VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber($id) . ', ' . $this->db->escapeNumber($amount) . ')'); |
| 834 | - } |
|
| 835 | - else { |
|
| 821 | + } else { |
|
| 836 | 822 | $this->db->query('DELETE FROM planet_has_cargo WHERE ' . $this->SQL . ' |
| 837 | 823 | AND good_id = ' . $this->db->escapeNumber($id)); |
| 838 | 824 | } |
@@ -861,8 +847,7 @@ discard block |
||
| 861 | 847 | if ($this->hasBuilding($id)) { |
| 862 | 848 | $this->db->query('REPLACE INTO planet_has_building (game_id, sector_id, construction_id, amount) ' . |
| 863 | 849 | 'VALUES(' . $this->db->escapeNumber($this->gameID) . ', ' . $this->db->escapeNumber($this->sectorID) . ', ' . $this->db->escapeNumber($id) . ', ' . $this->db->escapeNumber($this->getBuilding($id)) . ')'); |
| 864 | - } |
|
| 865 | - else { |
|
| 850 | + } else { |
|
| 866 | 851 | $this->db->query('DELETE FROM planet_has_building WHERE ' . $this->SQL . ' |
| 867 | 852 | AND construction_id = ' . $this->db->escapeNumber($id)); |
| 868 | 853 | } |
@@ -1236,8 +1221,7 @@ discard block |
||
| 1236 | 1221 | } |
| 1237 | 1222 | } |
| 1238 | 1223 | |
| 1239 | - } |
|
| 1240 | - else { // hit drones behind shields - we should only use this reduced damage branch if we cannot hit shields. |
|
| 1224 | + } else { // hit drones behind shields - we should only use this reduced damage branch if we cannot hit shields. |
|
| 1241 | 1225 | $cdDamage = $this->doCDDamage(IFloor(min($damage['MaxDamage'], $damage['Armour']) * DRONES_BEHIND_SHIELDS_DAMAGE_PERCENT), $delayed); |
| 1242 | 1226 | } |
| 1243 | 1227 | } |
@@ -13,8 +13,7 @@ discard block |
||
| 13 | 13 | $this->maxDamage = 2; |
| 14 | 14 | $this->shieldDamage = 2; |
| 15 | 15 | $this->armourDamage = 2; |
| 16 | - } |
|
| 17 | - else { |
|
| 16 | + } else { |
|
| 18 | 17 | $this->maxDamage = 1; |
| 19 | 18 | $this->shieldDamage = 1; |
| 20 | 19 | $this->armourDamage = 1; |
@@ -129,8 +128,10 @@ discard block |
||
| 129 | 128 | } |
| 130 | 129 | |
| 131 | 130 | public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { |
| 132 | - if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 131 | + if (!$this->canShootForces()) { |
|
| 132 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 133 | 133 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 134 | + } |
|
| 134 | 135 | $damage =& $this->getModifiedDamage(); |
| 135 | 136 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100); |
| 136 | 137 | $damage['Kamikaze'] = 0; |
@@ -151,8 +152,10 @@ discard block |
||
| 151 | 152 | } |
| 152 | 153 | |
| 153 | 154 | public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { |
| 154 | - if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 155 | + if (!$this->canShootPorts()) { |
|
| 156 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 155 | 157 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 158 | + } |
|
| 156 | 159 | $damage =& $this->getModifiedDamage(); |
| 157 | 160 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100); |
| 158 | 161 | $damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']); |
@@ -163,8 +166,10 @@ discard block |
||
| 163 | 166 | } |
| 164 | 167 | |
| 165 | 168 | public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { |
| 166 | - if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 169 | + if (!$this->canShootPlanets()) { |
|
| 170 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
| 167 | 171 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 172 | + } |
|
| 168 | 173 | $damage =& $this->getModifiedDamage(); |
| 169 | 174 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100); |
| 170 | 175 | $planetMod = self::PLANET_DAMAGE_MOD; |
@@ -239,8 +239,7 @@ discard block |
||
| 239 | 239 | if(empty($this->hofName)) { |
| 240 | 240 | $this->hofName=$this->login; |
| 241 | 241 | } |
| 242 | - } |
|
| 243 | - else { |
|
| 242 | + } else { |
|
| 244 | 243 | throw new AccountNotFoundException('Account ID '.$accountID.' does not exist!'); |
| 245 | 244 | } |
| 246 | 245 | } |
@@ -262,8 +261,7 @@ discard block |
||
| 262 | 261 | 'Reason' => $this->db->getField('reason'), |
| 263 | 262 | 'ReasonID' => $this->db->getInt('reason_id') |
| 264 | 263 | ); |
| 265 | - } |
|
| 266 | - else { |
|
| 264 | + } else { |
|
| 267 | 265 | return false; |
| 268 | 266 | } |
| 269 | 267 | } |
@@ -319,7 +317,9 @@ discard block |
||
| 319 | 317 | if ($curr_ip != 'unknown' && $curr_ip != 'unknown...' && $curr_ip != 'unknown, unknown') { |
| 320 | 318 | $curr_ip = $fi.'.'.$se.'.'.$th.'.'.$fo; |
| 321 | 319 | $host = gethostbyaddr($curr_ip); |
| 322 | - } else $host = 'unknown'; |
|
| 320 | + } else { |
|
| 321 | + $host = 'unknown'; |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | // save...first make sure there isn't one for these keys (someone could double click and get error) |
| 325 | 325 | $this->db->query('REPLACE INTO account_has_ip (account_id, time, ip, host) VALUES ('.$this->db->escapeNumber($this->account_id).', '.$this->db->escapeNumber(TIME).', '.$this->db->escapeString($curr_ip).', '.$this->db->escapeString($host).')'); |
@@ -997,8 +997,7 @@ discard block |
||
| 997 | 997 | if($hotkeyType!==false) { |
| 998 | 998 | if(isset($this->hotkeys[$hotkeyType])) { |
| 999 | 999 | return $this->hotkeys[$hotkeyType]; |
| 1000 | - } |
|
| 1001 | - else { |
|
| 1000 | + } else { |
|
| 1002 | 1001 | return array(); |
| 1003 | 1002 | } |
| 1004 | 1003 | } |
@@ -1178,8 +1177,7 @@ discard block |
||
| 1178 | 1177 | |
| 1179 | 1178 | if($days==0) { |
| 1180 | 1179 | $expireTime = 0; |
| 1181 | - } |
|
| 1182 | - else { |
|
| 1180 | + } else { |
|
| 1183 | 1181 | $expireTime = TIME + $days * 86400; |
| 1184 | 1182 | } |
| 1185 | 1183 | $this->banAccount($expireTime,$admin,$reasonID,$suspicion); |
@@ -464,7 +464,9 @@ discard block |
||
| 464 | 464 | if ($this->level === null) { |
| 465 | 465 | $LEVELS_REQUIREMENTS = Globals::getLevelRequirements(); |
| 466 | 466 | foreach ($LEVELS_REQUIREMENTS as $level_id => $require) { |
| 467 | - if ($this->getExperience() >= $require['Requirement']) continue; |
|
| 467 | + if ($this->getExperience() >= $require['Requirement']) { |
|
| 468 | + continue; |
|
| 469 | + } |
|
| 468 | 470 | $this->level = $level_id - 1; |
| 469 | 471 | return $this->level; |
| 470 | 472 | } |
@@ -585,8 +587,7 @@ discard block |
||
| 585 | 587 | public function getAllianceDisplayName($linked = false, $includeAllianceID = false) { |
| 586 | 588 | if ($this->hasAlliance()) { |
| 587 | 589 | return $this->getAlliance()->getAllianceDisplayName($linked, $includeAllianceID); |
| 588 | - } |
|
| 589 | - else { |
|
| 590 | + } else { |
|
| 590 | 591 | return 'No Alliance'; |
| 591 | 592 | } |
| 592 | 593 | } |
@@ -923,8 +924,7 @@ discard block |
||
| 923 | 924 | $hofType = implode(':', $typeList); |
| 924 | 925 | if (!isset(self::$HOFVis[$hofType])) { |
| 925 | 926 | self::$hasHOFVisChanged[$hofType] = self::HOF_NEW; |
| 926 | - } |
|
| 927 | - else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 927 | + } else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 928 | 928 | self::$hasHOFVisChanged[$hofType] = self::HOF_CHANGED; |
| 929 | 929 | } |
| 930 | 930 | self::$HOFVis[$hofType] = $visibility; |
@@ -1159,8 +1159,7 @@ discard block |
||
| 1159 | 1159 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
| 1160 | 1160 | // If we have completed this mission just use false to indicate no current task. |
| 1161 | 1161 | $currentStep = false; |
| 1162 | - } |
|
| 1163 | - else { |
|
| 1162 | + } else { |
|
| 1164 | 1163 | $currentStep = MISSIONS[$missionID]['Steps'][$mission['On Step']]; |
| 1165 | 1164 | $currentStep['Text'] = str_replace(array('<Race>', '<Sector>', '<Starting Sector>', '<trader>'), array($this->getRaceID(), $mission['Sector'], $mission['Starting Sector'], $this->playerName), $currentStep['Text']); |
| 1166 | 1165 | if (isset($currentStep['Task'])) { |
@@ -1168,8 +1167,7 @@ discard block |
||
| 1168 | 1167 | } |
| 1169 | 1168 | if (isset($currentStep['Level'])) { |
| 1170 | 1169 | $currentStep['Level'] = str_replace('<Player Level>', $this->getLevelID(), $currentStep['Level']); |
| 1171 | - } |
|
| 1172 | - else { |
|
| 1170 | + } else { |
|
| 1173 | 1171 | $currentStep['Level'] = 0; |
| 1174 | 1172 | } |
| 1175 | 1173 | } |
@@ -1386,8 +1384,9 @@ discard block |
||
| 1386 | 1384 | if (!isset($this->visitedSectors)) { |
| 1387 | 1385 | $this->visitedSectors = array(); |
| 1388 | 1386 | $this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL); |
| 1389 | - while ($this->db->nextRecord()) |
|
| 1390 | - $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1387 | + while ($this->db->nextRecord()) { |
|
| 1388 | + $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1389 | + } |
|
| 1391 | 1390 | } |
| 1392 | 1391 | return !isset($this->visitedSectors[$sectorID]); |
| 1393 | 1392 | } |