Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Branch master (0a752f)
by Dan
03:57
created
lib/Default/SmrPlayer.class.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 		while ($this->db->nextRecord()) {
198 198
 			try {
199 199
 				$otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'),
200
-				                                    $this->getGameID(), $forceUpdate);
200
+													$this->getGameID(), $forceUpdate);
201 201
 			} catch (PlayerNotFoundException $e) {
202 202
 				// Skip players that have not joined this game
203 203
 				continue;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	/**
185 185
 	 * Insert a new player into the database. Returns the new player object.
186 186
 	 */
187
-	public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc=false) {
187
+	public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc = false) {
188 188
 		// Put the player in a sector with an HQ
189 189
 		$startSectorID = self::getHome($gameID, $raceID);
190 190
 
@@ -1237,13 +1237,13 @@  discard block
 block discarded – undo
1237 1237
 			$this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL);
1238 1238
 			$this->HOF = array();
1239 1239
 			while ($this->db->nextRecord()) {
1240
-				$hof =& $this->HOF;
1240
+				$hof = & $this->HOF;
1241 1241
 				$typeList = explode(':', $this->db->getField('type'));
1242 1242
 				foreach ($typeList as $type) {
1243 1243
 					if (!isset($hof[$type])) {
1244 1244
 						$hof[$type] = array();
1245 1245
 					}
1246
-					$hof =& $hof[$type];
1246
+					$hof = & $hof[$type];
1247 1247
 				}
1248 1248
 				$hof = $this->db->getField('amount');
1249 1249
 			}
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 					'OffsetLeft' => $this->db->getInt('offset_left')
1669 1669
 				);
1670 1670
 			}
1671
-			$this->storedDestinations =& $storedDestinations;
1671
+			$this->storedDestinations = & $storedDestinations;
1672 1672
 		}
1673 1673
 		return $this->storedDestinations;
1674 1674
 	}
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 			create_error('The saved sector must be in the box!');
1687 1687
 		}
1688 1688
 
1689
-		$storedDestinations =& $this->getStoredDestinations();
1689
+		$storedDestinations = & $this->getStoredDestinations();
1690 1690
 		foreach ($storedDestinations as &$sd) {
1691 1691
 			if ($sd['SectorID'] == $sectorID) {
1692 1692
 				$sd['OffsetTop'] = $offsetTop;
Please login to merge, or discard this patch.
Braces   +193 added lines, -148 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
 	public static function &getSectorPlayersByAlliances($gameID, $sectorID, array $allianceIDs, $forceUpdate = false) {
59 59
 		$players = self::getSectorPlayers($gameID, $sectorID, $forceUpdate); // Don't use & as we do an unset
60 60
 		foreach ($players as $accountID => $player) {
61
-			if (!in_array($player->getAllianceID(), $allianceIDs))
62
-				unset($players[$accountID]);
61
+			if (!in_array($player->getAllianceID(), $allianceIDs)) {
62
+							unset($players[$accountID]);
63
+			}
63 64
 		}
64 65
 		return $players;
65 66
 	}
@@ -193,8 +194,7 @@  discard block
 block discarded – undo
193 194
 			$this->newbieWarning = $db->getBoolean('newbie_warning');
194 195
 			$this->nameChanged = $db->getBoolean('name_changed');
195 196
 			$this->combatDronesKamikazeOnMines = $db->getBoolean('combat_drones_kamikaze_on_mines');
196
-		}
197
-		else {
197
+		} else {
198 198
 			throw new PlayerNotFoundException('Invalid accountID: ' . $accountID . ' OR gameID:' . $gameID);
199 199
 		}
200 200
 	}
@@ -280,22 +280,25 @@  discard block
 block discarded – undo
280 280
 	protected function setZoom($zoom) {
281 281
 		// Set the zoom level between [1, 9]
282 282
 		$zoom = max(1, min(9, $zoom));
283
-		if ($this->zoom == $zoom)
284
-			return;
283
+		if ($this->zoom == $zoom) {
284
+					return;
285
+		}
285 286
 		$this->zoom = $zoom;
286 287
 		$this->hasChanged = true;
287 288
 //		$this->db->query('UPDATE player SET zoom = ' . $zoom . ' WHERE ' . $this->SQL . ' LIMIT 1');
288 289
 	}
289 290
 
290 291
 	public function increaseZoom($zoom) {
291
-		if ($zoom < 0)
292
-			throw new Exception('Trying to increase negative zoom.');
292
+		if ($zoom < 0) {
293
+					throw new Exception('Trying to increase negative zoom.');
294
+		}
293 295
 		$this->setZoom($this->getZoom() + $zoom);
294 296
 	}
295 297
 
296 298
 	public function decreaseZoom($zoom) {
297
-		if ($zoom < 0)
298
-			throw new Exception('Trying to decrease negative zoom.');
299
+		if ($zoom < 0) {
300
+					throw new Exception('Trying to decrease negative zoom.');
301
+		}
299 302
 		$this->setZoom($this->getZoom() - $zoom);
300 303
 	}
301 304
 
@@ -310,8 +313,9 @@  discard block
 block discarded – undo
310 313
 	}
311 314
 
312 315
 	public function setLastSectorID($lastSectorID) {
313
-		if ($this->lastSectorID == $lastSectorID)
314
-			return;
316
+		if ($this->lastSectorID == $lastSectorID) {
317
+					return;
318
+		}
315 319
 		$this->lastSectorID = $lastSectorID;
316 320
 		$this->hasChanged = true;
317 321
 //		$this->db->query('UPDATE player SET last_sector_id = '.$this->lastSectorID.' WHERE '.$this->SQL.' LIMIT 1');
@@ -324,11 +328,9 @@  discard block
 block discarded – undo
324 328
 			$kickedBy->sendMessage($this->getAccountID(), MSG_PLAYER, 'You were kicked out of the alliance!', false);
325 329
 			$this->actionTaken('PlayerKicked', array('Alliance' => $alliance, 'Player' => $kickedBy));
326 330
 			$kickedBy->actionTaken('KickPlayer', array('Alliance' => $alliance, 'Player' => $this));
327
-		}
328
-		else if ($this->isAllianceLeader()) {
331
+		} else if ($this->isAllianceLeader()) {
329 332
 			$this->actionTaken('DisbandAlliance', array('Alliance' => $alliance));
330
-		}
331
-		else {
333
+		} else {
332 334
 			$this->actionTaken('LeaveAlliance', array('Alliance' => $alliance));
333 335
 			if ($alliance->getLeaderID() != 0 && $alliance->getLeaderID() != ACCOUNT_ID_NHL) {
334 336
 				$this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I left your alliance!', false);
@@ -356,7 +358,9 @@  discard block
 block discarded – undo
356 358
 			try {
357 359
 				$this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I joined your alliance!', false);
358 360
 			} catch (AccountNotFoundException $e) {
359
-				if ($alliance->getLeaderID() != ACCOUNT_ID_NHL) throw $e;
361
+				if ($alliance->getLeaderID() != ACCOUNT_ID_NHL) {
362
+					throw $e;
363
+				}
360 364
 			}
361 365
 
362 366
 			$roleID = ALLIANCE_ROLE_NEW_MEMBER;
@@ -376,8 +380,9 @@  discard block
 block discarded – undo
376 380
 	}
377 381
 
378 382
 	private function setAllianceJoinable($time) {
379
-		if ($this->allianceJoinable == $time)
380
-			return;
383
+		if ($this->allianceJoinable == $time) {
384
+					return;
385
+		}
381 386
 		$this->allianceJoinable = $time;
382 387
 		$this->hasChanged = true;
383 388
 	}
@@ -387,8 +392,9 @@  discard block
 block discarded – undo
387 392
 	}
388 393
 
389 394
 	public function setAttackColour($colour) {
390
-		if ($this->attackColour == $colour)
391
-			return;
395
+		if ($this->attackColour == $colour) {
396
+					return;
397
+		}
392 398
 		$this->attackColour = $colour;
393 399
 		$this->hasChanged = true;
394 400
 //		$this->db->query('UPDATE player SET attack_warning = ' . $this->db->escapeString($this->attackColour) . ' WHERE ' . $this->SQL . ' LIMIT 1');
@@ -399,28 +405,35 @@  discard block
 block discarded – undo
399 405
 	}
400 406
 
401 407
 	public function increaseBank($credits) {
402
-		if ($credits < 0)
403
-			throw new Exception('Trying to increase negative credits.');
404
-		if ($credits == 0)
405
-			return;
408
+		if ($credits < 0) {
409
+					throw new Exception('Trying to increase negative credits.');
410
+		}
411
+		if ($credits == 0) {
412
+					return;
413
+		}
406 414
 		$credits += $this->bank;
407 415
 		$this->setBank($credits);
408 416
 	}
409 417
 	public function decreaseBank($credits) {
410
-		if ($credits < 0)
411
-			throw new Exception('Trying to decrease negative credits.');
412
-		if ($credits == 0)
413
-			return;
418
+		if ($credits < 0) {
419
+					throw new Exception('Trying to decrease negative credits.');
420
+		}
421
+		if ($credits == 0) {
422
+					return;
423
+		}
414 424
 		$credits = $this->bank - $credits;
415 425
 		$this->setBank($credits);
416 426
 	}
417 427
 	public function setBank($credits) {
418
-		if ($this->bank == $credits)
419
-			return;
420
-		if ($credits < 0)
421
-			throw new Exception('Trying to set negative credits.');
422
-		if ($credits > MAX_MONEY)
423
-			throw new Exception('Trying to set more than max credits.');
428
+		if ($this->bank == $credits) {
429
+					return;
430
+		}
431
+		if ($credits < 0) {
432
+					throw new Exception('Trying to set negative credits.');
433
+		}
434
+		if ($credits > MAX_MONEY) {
435
+					throw new Exception('Trying to set more than max credits.');
436
+		}
424 437
 		$this->bank = $credits;
425 438
 		$this->hasChanged = true;
426 439
 //		$this->db->query('UPDATE player SET bank = '.$this->bank.' WHERE '.$this->SQL.' LIMIT 1');
@@ -431,8 +444,9 @@  discard block
 block discarded – undo
431 444
 	}
432 445
 
433 446
 	private function setLastNewsUpdate($time) {
434
-		if ($this->lastNewsUpdate == $time)
435
-			return;
447
+		if ($this->lastNewsUpdate == $time) {
448
+					return;
449
+		}
436 450
 		$this->lastNewsUpdate = $time;
437 451
 		$this->hasChanged = true;
438 452
 //		$this->db->query('UPDATE player SET last_news_update = ' . $time . ' WHERE ' . $this->SQL . ' LIMIT 1');
@@ -479,7 +493,9 @@  discard block
 block discarded – undo
479 493
 
480 494
 	public function updateTurns() {
481 495
 		// is account validated?
482
-		if (!$this->getAccount()->isValidated()) return;
496
+		if (!$this->getAccount()->isValidated()) {
497
+			return;
498
+		}
483 499
 
484 500
 		// how many turns would he get right now?
485 501
 		$extraTurns = $this->getTurnsGained(TIME);
@@ -498,8 +514,9 @@  discard block
 block discarded – undo
498 514
 	}
499 515
 
500 516
 	public function setIgnoreGlobals($bool) {
501
-		if ($this->ignoreGlobals == $bool)
502
-			return;
517
+		if ($this->ignoreGlobals == $bool) {
518
+					return;
519
+		}
503 520
 		$this->ignoreGlobals = $bool;
504 521
 		$this->hasChanged = true;
505 522
 //		$this->db->query('UPDATE player SET ignore_globals = '.$this->db->escapeBoolean($bool).' WHERE '.$this->SQL.' LIMIT 1');
@@ -511,8 +528,9 @@  discard block
 block discarded – undo
511 528
 	}
512 529
 
513 530
 	public function setLastPort($lastPort) {
514
-		if ($this->lastPort == $lastPort)
515
-			return;
531
+		if ($this->lastPort == $lastPort) {
532
+					return;
533
+		}
516 534
 		$this->lastPort = $lastPort;
517 535
 		$this->hasChanged = true;
518 536
 //		$this->db->query('UPDATE player SET last_port = ' . $this->lastPort . ' WHERE ' . $this->SQL . ' LIMIT 1');
@@ -523,8 +541,9 @@  discard block
 block discarded – undo
523 541
 	}
524 542
 
525 543
 	public function setDisplayMissions($bool) {
526
-		if ($this->displayMissions == $bool)
527
-			return;
544
+		if ($this->displayMissions == $bool) {
545
+					return;
546
+		}
528 547
 		$this->displayMissions = $bool;
529 548
 		$this->hasChanged = true;
530 549
 	}
@@ -539,8 +558,9 @@  discard block
 block discarded – undo
539 558
 	 * which does not acquire a sector lock.
540 559
 	 */
541 560
 	public function setDisplayWeapons($bool) {
542
-		if ($this->displayWeapons == $bool)
543
-			return;
561
+		if ($this->displayWeapons == $bool) {
562
+					return;
563
+		}
544 564
 		$this->displayWeapons = $bool;
545 565
 		$this->db->query('UPDATE player SET display_weapons=' . $this->db->escapeBoolean($this->displayWeapons) . ' WHERE ' . $this->SQL);
546 566
 	}
@@ -550,8 +570,9 @@  discard block
 block discarded – undo
550 570
 	}
551 571
 
552 572
 	public function setForceDropMessages($bool) {
553
-		if ($this->forceDropMessages == $bool)
554
-			return;
573
+		if ($this->forceDropMessages == $bool) {
574
+					return;
575
+		}
555 576
 		$this->forceDropMessages = $bool;
556 577
 		$this->hasChanged = true;
557 578
 	}
@@ -583,8 +604,9 @@  discard block
 block discarded – undo
583 604
 	}
584 605
 
585 606
 	public function setLastTurnUpdate($time) {
586
-		if ($this->lastTurnUpdate == $time)
587
-			return;
607
+		if ($this->lastTurnUpdate == $time) {
608
+					return;
609
+		}
588 610
 		$this->lastTurnUpdate = $time;
589 611
 		$this->hasChanged = true;
590 612
 //		$sql = $this->db->query('UPDATE player SET last_turn_update = ' . $this->lastTurnUpdate . ' WHERE '. $this->SQL . ' LIMIT 1');
@@ -628,27 +650,33 @@  discard block
 block discarded – undo
628 650
 	}
629 651
 
630 652
 	public function increaseRelations($relations, $raceID) {
631
-		if ($relations < 0)
632
-			throw new Exception('Trying to increase negative relations.');
633
-		if ($relations == 0)
634
-			return;
653
+		if ($relations < 0) {
654
+					throw new Exception('Trying to increase negative relations.');
655
+		}
656
+		if ($relations == 0) {
657
+					return;
658
+		}
635 659
 		$relations += $this->getPureRelation($raceID);
636 660
 		$this->setRelations($relations, $raceID);
637 661
 	}
638 662
 	public function decreaseRelations($relations, $raceID) {
639
-		if ($relations < 0)
640
-			throw new Exception('Trying to decrease negative relations.');
641
-		if ($relations == 0)
642
-			return;
663
+		if ($relations < 0) {
664
+					throw new Exception('Trying to decrease negative relations.');
665
+		}
666
+		if ($relations == 0) {
667
+					return;
668
+		}
643 669
 		$relations = $this->getPureRelation($raceID) - $relations;
644 670
 		$this->setRelations($relations, $raceID);
645 671
 	}
646 672
 	public function setRelations($relations, $raceID) {
647 673
 		$this->getRelations();
648
-		if ($this->pureRelations[$raceID] == $relations)
649
-			return;
650
-		if ($relations < MIN_RELATIONS)
651
-			$relations = MIN_RELATIONS;
674
+		if ($this->pureRelations[$raceID] == $relations) {
675
+					return;
676
+		}
677
+		if ($relations < MIN_RELATIONS) {
678
+					$relations = MIN_RELATIONS;
679
+		}
652 680
 		$relationsDiff = $relations - $this->pureRelations[$raceID];
653 681
 		$this->pureRelations[$raceID] = $relations;
654 682
 		$this->relations[$raceID] += round($relationsDiff);
@@ -683,8 +711,7 @@  discard block
 block discarded – undo
683 711
 			$this->db->query('SELECT * FROM ship_has_name WHERE ' . $this->SQL . ' LIMIT 1');
684 712
 			if ($this->db->nextRecord()) {
685 713
 				$this->customShipName = $this->db->getField('ship_name');
686
-			}
687
-			else {
714
+			} else {
688 715
 				$this->customShipName = false;
689 716
 			}
690 717
 		}
@@ -696,8 +723,9 @@  discard block
 block discarded – undo
696 723
 			//Get Player Gadgets
697 724
 			$this->db->query('SELECT gadget_id,equipped,cooldown,lasts_until FROM player_has_gadget WHERE ' . $this->SQL);
698 725
 			$this->gadgets = array();
699
-			while ($this->db->nextRecord())
700
-				$this->gadgets[$this->db->getField('gadget_id')] = array('Equipped' => $this->db->getField('equipped'), 'Cooldown' => $this->db->getField('cooldown'), 'Expires' => $this->db->getField('lasts_until'));
726
+			while ($this->db->nextRecord()) {
727
+							$this->gadgets[$this->db->getField('gadget_id')] = array('Equipped' => $this->db->getField('equipped'), 'Cooldown' => $this->db->getField('cooldown'), 'Expires' => $this->db->getField('lasts_until'));
728
+			}
701 729
 		}
702 730
 	}
703 731
 
@@ -719,8 +747,7 @@  discard block
 block discarded – undo
719 747
 				$set = substr($set, 0, -1);
720 748
 				$this->db->query('UPDATE player_has_gadget SET ' . $set . ' WHERE ' . $this->SQL . ' LIMIT ' . count($this->gadgets));
721 749
 			}
722
-		}
723
-		else {
750
+		} else {
724 751
 			$field = $this->gadgetKeyToField($keyOrUpdateArray);
725 752
 			if ($field !== false) {
726 753
 				foreach ($this->gadgets as $gadgetID => $gadget) {
@@ -754,12 +781,12 @@  discard block
 block discarded – undo
754 781
 					$this->db->query('UPDATE player_has_gadget SET ' . $set . ' WHERE ' . $this->SQL . ' AND gadget_id = ' . $this->db->escapeNumber($gadgetID) . ' LIMIT 1');
755 782
 					return true;
756 783
 				}
757
-			}
758
-			else {
784
+			} else {
759 785
 				$field = $this->gadgetKeyToField($keyOrUpdateArray);
760 786
 				if ($field !== false) {
761
-					if ($this->gadgets[$gadgetID][$keyOrUpdateArray] == $value)
762
-						return;
787
+					if ($this->gadgets[$gadgetID][$keyOrUpdateArray] == $value) {
788
+											return;
789
+					}
763 790
 					$this->gadgets[$gadgetID][$keyOrUpdateArray] = $value;
764 791
 					$this->db->query('UPDATE player_has_gadget SET `' . $field . '` = ' . $this->db->escapeString($value) . ' WHERE ' . $this->SQL . ' AND gadget_id = ' . $this->db->escapeNumber($gadgetID) . ' LIMIT 1');
765 792
 					return true;
@@ -770,8 +797,9 @@  discard block
 block discarded – undo
770 797
 	}
771 798
 
772 799
 	public function addGadget($gadgetID) {
773
-		if (isset($this->gadgets[$gadgetID]))
774
-			return false;
800
+		if (isset($this->gadgets[$gadgetID])) {
801
+					return false;
802
+		}
775 803
 		$this->gadgets[$gadgetID] = array('Equipped' => 0, 'Cooldown' => 0, 'Expires' => 0);
776 804
 		$this->db->query('REPLACE INTO player_has_gadget (game_id, account_id, gadget_id, cooldown, equipped,lasts_until) VALUES (' . $this->db->escapeNumber($this->gameID) . ',' . $this->db->escapeNumber($this->accountID) . ',' . $this->db->escapeNumber($gadgetID) . ',0,0,0)');
777 805
 		return true;
@@ -804,8 +832,7 @@  discard block
 block discarded – undo
804 832
 				$this->knowledge['Nyx'] = $this->db->getInt('nyx');
805 833
 				$this->knowledge['Federation'] = 0;
806 834
 				$this->knowledge['Underground'] = 0;
807
-			}
808
-			else {
835
+			} else {
809 836
 				$this->knowledge['Erebus'] = 0;
810 837
 				$this->knowledge['Aether'] = 0;
811 838
 				$this->knowledge['Tartarus'] = 0;
@@ -814,10 +841,12 @@  discard block
 block discarded – undo
814 841
 				$this->knowledge['Underground'] = 0;
815 842
 			}
816 843
 		}
817
-		if ($knowledgeType === false)
818
-			return $this->knowledge;
819
-		if (isset($this->knowledge[$knowledgeType]))
820
-			return $this->knowledge[$knowledgeType];
844
+		if ($knowledgeType === false) {
845
+					return $this->knowledge;
846
+		}
847
+		if (isset($this->knowledge[$knowledgeType])) {
848
+					return $this->knowledge[$knowledgeType];
849
+		}
821 850
 		return false;
822 851
 	}
823 852
 
@@ -830,9 +859,10 @@  discard block
 block discarded – undo
830 859
 		$sector->diedHere($this);
831 860
 
832 861
 		// if we are in an alliance we increase their deaths
833
-		if ($this->hasAlliance())
834
-			$this->db->query('UPDATE alliance SET alliance_deaths = alliance_deaths + 1
862
+		if ($this->hasAlliance()) {
863
+					$this->db->query('UPDATE alliance SET alliance_deaths = alliance_deaths + 1
835 864
 							WHERE game_id = ' . $this->db->escapeNumber($this->getGameID()) . ' AND alliance_id = ' . $this->db->escapeNumber($this->getAllianceID()) . ' LIMIT 1');
865
+		}
836 866
 
837 867
 		// record death stat
838 868
 		$this->increaseHOF(1, array('Dying', 'Deaths'), HOF_PUBLIC);
@@ -845,8 +875,9 @@  discard block
 block discarded – undo
845 875
 		$newCredits = round($this->getShip()->getCost() / 4);
846 876
 		$old_speed = $this->getShip()->getSpeed();
847 877
 
848
-		if ($newCredits < 100000)
849
-			$newCredits = 100000;
878
+		if ($newCredits < 100000) {
879
+					$newCredits = 100000;
880
+		}
850 881
 		$this->setCredits($newCredits);
851 882
 
852 883
 		$this->setSectorID($this::getHome($this->getGameID(), $this->getRaceID()));
@@ -921,14 +952,14 @@  discard block
 block discarded – undo
921 952
 		$relation = $relations[$killer->getRaceID()];
922 953
 
923 954
 		$alignChangePerRelation = 0.1;
924
-		if ($relation >= RELATIONS_PEACE || $relation <= RELATIONS_WAR)
925
-			$alignChangePerRelation = 0.04;
955
+		if ($relation >= RELATIONS_PEACE || $relation <= RELATIONS_WAR) {
956
+					$alignChangePerRelation = 0.04;
957
+		}
926 958
 
927 959
 		$return['KillerAlign'] = -$relation * $alignChangePerRelation; //Lose relations when killing a peaceful race
928 960
 		if ($return['KillerAlign'] > 0) {
929 961
 			$killer->increaseAlignment($return['KillerAlign']);
930
-		}
931
-		else {
962
+		} else {
932 963
 			$killer->decreaseAlignment(-$return['KillerAlign']);
933 964
 		}
934 965
 		// War setting gives them military pay
@@ -962,8 +993,7 @@  discard block
 block discarded – undo
962 993
 			// If the podded players alignment makes them deputy or member then set bounty
963 994
 			if ($this->getAlignment() >= 100) {
964 995
 				$return['BountyGained']['Type'] = 'HQ';
965
-			}
966
-			else if ($this->getAlignment() <= 100) {
996
+			} else if ($this->getAlignment() <= 100) {
967 997
 				$return['BountyGained']['Type'] = 'UG';
968 998
 			}
969 999
 
@@ -985,16 +1015,14 @@  discard block
 block discarded – undo
985 1015
 
986 1016
 			if ($return['KillerAlign'] > 0) {
987 1017
 				$killer->increaseHOF($return['KillerAlign'], array('Killing', 'NPC', 'Alignment', 'Gain'), HOF_PUBLIC);
988
-			}
989
-			else {
1018
+			} else {
990 1019
 				$killer->increaseHOF(-$return['KillerAlign'], array('Killing', 'NPC', 'Alignment', 'Loss'), HOF_PUBLIC);
991 1020
 			}
992 1021
 
993 1022
 			$killer->increaseHOF($return['BountyGained']['Amount'], array('Killing', 'NPC', 'Money', 'Bounty Gained'), HOF_PUBLIC);
994 1023
 
995 1024
 			$killer->increaseHOF(1, array('Killing', 'NPC Kills'), HOF_PUBLIC);
996
-		}
997
-		else {
1025
+		} else {
998 1026
 			$killer->increaseHOF($return['KillerExp'], array('Killing', 'Experience', 'Gained'), HOF_PUBLIC);
999 1027
 			$killer->increaseHOF($this->getExperience(), array('Killing', 'Experience', 'Of Traders Killed'), HOF_PUBLIC);
1000 1028
 
@@ -1006,8 +1034,7 @@  discard block
 block discarded – undo
1006 1034
 
1007 1035
 			if ($return['KillerAlign'] > 0) {
1008 1036
 				$killer->increaseHOF($return['KillerAlign'], array('Killing', 'Alignment', 'Gain'), HOF_PUBLIC);
1009
-			}
1010
-			else {
1037
+			} else {
1011 1038
 				$killer->increaseHOF(-$return['KillerAlign'], array('Killing', 'Alignment', 'Loss'), HOF_PUBLIC);
1012 1039
 			}
1013 1040
 
@@ -1015,8 +1042,7 @@  discard block
 block discarded – undo
1015 1042
 
1016 1043
 			if ($this->getShip()->getAttackRatingWithMaxCDs() <= MAX_ATTACK_RATING_NEWBIE && $this->hasNewbieStatus() && !$killer->hasNewbieStatus()) { //Newbie kill
1017 1044
 				$killer->increaseHOF(1, array('Killing', 'Newbie Kills'), HOF_PUBLIC);
1018
-			}
1019
-			else {
1045
+			} else {
1020 1046
 				$killer->increaseKills(1);
1021 1047
 				$killer->increaseHOF(1, array('Killing', 'Kills'), HOF_PUBLIC);
1022 1048
 
@@ -1198,20 +1224,21 @@  discard block
 block discarded – undo
1198 1224
 				$bountyChanged = false;
1199 1225
 				$bounty = $this->getBounty($key);
1200 1226
 				if ($bounty['New'] === true) {
1201
-					if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0)
1202
-						$this->db->query('INSERT INTO bounty (account_id,game_id,type,amount,smr_credits,claimer_id,time) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeString($bounty['Type']) . ',' . $this->db->escapeNumber($bounty['Amount']) . ',' . $this->db->escapeNumber($bounty['SmrCredits']) . ',' . $this->db->escapeNumber($bounty['Claimer']) . ',' . $this->db->escapeNumber($bounty['Time']) . ')');
1203
-				}
1204
-				else {
1205
-					if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0)
1206
-						$this->db->query('UPDATE bounty
1227
+					if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) {
1228
+											$this->db->query('INSERT INTO bounty (account_id,game_id,type,amount,smr_credits,claimer_id,time) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeString($bounty['Type']) . ',' . $this->db->escapeNumber($bounty['Amount']) . ',' . $this->db->escapeNumber($bounty['SmrCredits']) . ',' . $this->db->escapeNumber($bounty['Claimer']) . ',' . $this->db->escapeNumber($bounty['Time']) . ')');
1229
+					}
1230
+				} else {
1231
+					if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) {
1232
+											$this->db->query('UPDATE bounty
1207 1233
 							SET amount=' . $this->db->escapeNumber($bounty['Amount']) . ',
1208 1234
 							smr_credits=' . $this->db->escapeString($bounty['SmrCredits']) . ',
1209 1235
 							type=' . $this->db->escapeString($bounty['Type']) . ',
1210 1236
 							claimer_id=' . $this->db->escapeNumber($bounty['Claimer']) . ',
1211 1237
 							time=' . $this->db->escapeNumber($bounty['Time']) . '
1212 1238
 							WHERE bounty_id=' . $this->db->escapeNumber($bounty['ID']) . ' AND ' . $this->SQL . ' LIMIT 1');
1213
-					else
1214
-						$this->db->query('DELETE FROM bounty WHERE bounty_id=' . $this->db->escapeNumber($bounty['ID']) . ' AND ' . $this->SQL . ' LIMIT 1');
1239
+					} else {
1240
+											$this->db->query('DELETE FROM bounty WHERE bounty_id=' . $this->db->escapeNumber($bounty['ID']) . ' AND ' . $this->SQL . ' LIMIT 1');
1241
+					}
1215 1242
 				}
1216 1243
 			}
1217 1244
 		}
@@ -1219,14 +1246,16 @@  discard block
 block discarded – undo
1219 1246
 	}
1220 1247
 
1221 1248
 	public function saveHOF() {
1222
-		if ($this->hasHOFChanged !== false)
1223
-			$this->doHOFSave($this->hasHOFChanged);
1249
+		if ($this->hasHOFChanged !== false) {
1250
+					$this->doHOFSave($this->hasHOFChanged);
1251
+		}
1224 1252
 		if (!empty(self::$hasHOFVisChanged)) {
1225 1253
 			foreach (self::$hasHOFVisChanged as $hofType => $changeType) {
1226
-				if ($changeType == self::HOF_NEW)
1227
-					$this->db->query('INSERT INTO hof_visibility (type, visibility) VALUES (' . $this->db->escapeString($hofType) . ',' . $this->db->escapeString(self::$HOFVis[$hofType]) . ')');
1228
-				else
1229
-					$this->db->query('UPDATE hof_visibility SET visibility = ' . $this->db->escapeString(self::$HOFVis[$hofType]) . ' WHERE type = ' . $this->db->escapeString($hofType) . ' LIMIT 1');
1254
+				if ($changeType == self::HOF_NEW) {
1255
+									$this->db->query('INSERT INTO hof_visibility (type, visibility) VALUES (' . $this->db->escapeString($hofType) . ',' . $this->db->escapeString(self::$HOFVis[$hofType]) . ')');
1256
+				} else {
1257
+									$this->db->query('UPDATE hof_visibility SET visibility = ' . $this->db->escapeString(self::$HOFVis[$hofType]) . ' WHERE type = ' . $this->db->escapeString($hofType) . ' LIMIT 1');
1258
+				}
1230 1259
 				unset(self::$hasHOFVisChanged[$hofType]);
1231 1260
 			}
1232 1261
 		}
@@ -1237,14 +1266,13 @@  discard block
 block discarded – undo
1237 1266
 			$tempTypeList[] = $type;
1238 1267
 			if (is_array($hofChanged)) {
1239 1268
 				$this->doHOFSave($hofChanged, $tempTypeList);
1240
-			}
1241
-			else {
1269
+			} else {
1242 1270
 				$amount = $this->getHOF($tempTypeList);
1243 1271
 				if ($hofChanged == self::HOF_NEW) {
1244
-					if ($amount > 0)
1245
-						$this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')');
1246
-				}
1247
-				else if ($hofChanged == self::HOF_CHANGED) {
1272
+					if ($amount > 0) {
1273
+											$this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')');
1274
+					}
1275
+				} else if ($hofChanged == self::HOF_CHANGED) {
1248 1276
 	//				if($amount > 0)
1249 1277
 						$this->db->query('UPDATE player_hof
1250 1278
 							SET amount=' . $this->db->escapeNumber($amount) . '
@@ -1355,11 +1383,12 @@  discard block
 block discarded – undo
1355 1383
 			$this->tickers = array();
1356 1384
 			//get ticker info
1357 1385
 			$this->db->query('SELECT type,time,expires,recent FROM player_has_ticker WHERE ' . $this->SQL . ' AND expires > ' . $this->db->escapeNumber(TIME));
1358
-			while ($this->db->nextRecord())
1359
-				$this->tickers[$this->db->getField('type')] = array('Type' => $this->db->getField('type'),
1386
+			while ($this->db->nextRecord()) {
1387
+							$this->tickers[$this->db->getField('type')] = array('Type' => $this->db->getField('type'),
1360 1388
 																				'Time' => $this->db->getInt('time'),
1361 1389
 																				'Expires' => $this->db->getInt('expires'),
1362 1390
 																				'Recent' => $this->db->getField('recent'));
1391
+			}
1363 1392
 		}
1364 1393
 		return $this->tickers;
1365 1394
 	}
@@ -1370,8 +1399,9 @@  discard block
 block discarded – undo
1370 1399
 
1371 1400
 	public function getTicker($tickerType) {
1372 1401
 		$tickers = $this->getTickers();
1373
-		if (isset($tickers[$tickerType]))
1374
-			return $tickers[$tickerType];
1402
+		if (isset($tickers[$tickerType])) {
1403
+					return $tickers[$tickerType];
1404
+		}
1375 1405
 		return false;
1376 1406
 	}
1377 1407
 
@@ -1380,9 +1410,15 @@  discard block
 block discarded – undo
1380 1410
 	}
1381 1411
 
1382 1412
 	public function getTurnsLevel() {
1383
-		if (!$this->hasTurns()) return 'NONE';
1384
-		if ($this->getTurns() <= 25) return 'LOW';
1385
-		if ($this->getTurns() <= 75) return 'MEDIUM';
1413
+		if (!$this->hasTurns()) {
1414
+			return 'NONE';
1415
+		}
1416
+		if ($this->getTurns() <= 25) {
1417
+			return 'LOW';
1418
+		}
1419
+		if ($this->getTurns() <= 75) {
1420
+			return 'MEDIUM';
1421
+		}
1386 1422
 		return 'HIGH';
1387 1423
 	}
1388 1424
 
@@ -1460,8 +1496,9 @@  discard block
 block discarded – undo
1460 1496
 
1461 1497
 	public function sendGlobalMessage($message, $canBeIgnored = true) {
1462 1498
 		if ($canBeIgnored) {
1463
-			if ($this->getAccount()->isMailBanned())
1464
-				create_error('You are currently banned from sending messages');
1499
+			if ($this->getAccount()->isMailBanned()) {
1500
+							create_error('You are currently banned from sending messages');
1501
+			}
1465 1502
 		}
1466 1503
 		$this->sendMessageToBox(BOX_GLOBALS, $message);
1467 1504
 
@@ -1484,12 +1521,14 @@  discard block
 block discarded – undo
1484 1521
 	public function sendMessage($receiverID, $messageTypeID, $message, $canBeIgnored = true, $unread = true, $expires = false, $senderDelete = false) {
1485 1522
 		//get expire time
1486 1523
 		if ($canBeIgnored) {
1487
-			if ($this->getAccount()->isMailBanned())
1488
-				create_error('You are currently banned from sending messages');
1524
+			if ($this->getAccount()->isMailBanned()) {
1525
+							create_error('You are currently banned from sending messages');
1526
+			}
1489 1527
 			// Don't send messages to players ignoring us
1490 1528
 			$this->db->query('SELECT account_id FROM message_blacklist WHERE account_id=' . $this->db->escapeNumber($receiverID) . ' AND blacklisted_id=' . $this->db->escapeNumber($this->getAccountID()) . ' LIMIT 1');
1491
-			if ($this->db->nextRecord())
1492
-				return;
1529
+			if ($this->db->nextRecord()) {
1530
+							return;
1531
+			}
1493 1532
 		}
1494 1533
 
1495 1534
 		$message = word_filter($message);
@@ -1570,32 +1609,36 @@  discard block
 block discarded – undo
1570 1609
 
1571 1610
 	public static function sendMessageFromAdmin($gameID, $receiverID, $message, $expires = false) {
1572 1611
 		//get expire time
1573
-		if ($expires === false)
1574
-			$expires = TIME + 86400 * 365;
1612
+		if ($expires === false) {
1613
+					$expires = TIME + 86400 * 365;
1614
+		}
1575 1615
 		// send him the message
1576 1616
 		self::doMessageSending(ACCOUNT_ID_ADMIN, $receiverID, $gameID, MSG_ADMIN, $message, $expires);
1577 1617
 	}
1578 1618
 
1579 1619
 	public static function sendMessageFromAllianceAmbassador($gameID, $receiverID, $message, $expires = false) {
1580 1620
 		//get expire time
1581
-		if ($expires === false)
1582
-			$expires = TIME + 86400 * 31;
1621
+		if ($expires === false) {
1622
+					$expires = TIME + 86400 * 31;
1623
+		}
1583 1624
 		// send him the message
1584 1625
 		self::doMessageSending(ACCOUNT_ID_ALLIANCE_AMBASSADOR, $receiverID, $gameID, MSG_ALLIANCE, $message, $expires);
1585 1626
 	}
1586 1627
 
1587 1628
 	public static function sendMessageFromCasino($gameID, $receiverID, $message, $expires = false) {
1588 1629
 		//get expire time
1589
-		if ($expires === false)
1590
-			$expires = TIME + 86400 * 7;
1630
+		if ($expires === false) {
1631
+					$expires = TIME + 86400 * 7;
1632
+		}
1591 1633
 		// send him the message
1592 1634
 		self::doMessageSending(ACCOUNT_ID_CASINO, $receiverID, $gameID, MSG_CASINO, $message, $expires);
1593 1635
 	}
1594 1636
 
1595 1637
 	public static function sendMessageFromRace($raceID, $gameID, $receiverID, $message, $expires = false) {
1596 1638
 		//get expire time
1597
-		if ($expires === false)
1598
-			$expires = TIME + 86400 * 5;
1639
+		if ($expires === false) {
1640
+					$expires = TIME + 86400 * 5;
1641
+		}
1599 1642
 		// send him the message
1600 1643
 		self::doMessageSending(ACCOUNT_ID_GROUP_RACES + $raceID, $receiverID, $gameID, MSG_POLITICAL, $message, $expires);
1601 1644
 	}
@@ -1638,11 +1681,11 @@  discard block
 block discarded – undo
1638 1681
 	public function setPlottedCourse(Distance $plottedCourse) {
1639 1682
 		$hadPlottedCourse = $this->hasPlottedCourse();
1640 1683
 		$this->plottedCourse = $plottedCourse;
1641
-		if ($this->plottedCourse->getTotalSectors() > 0)
1642
-			$this->db->query('REPLACE INTO player_plotted_course
1684
+		if ($this->plottedCourse->getTotalSectors() > 0) {
1685
+					$this->db->query('REPLACE INTO player_plotted_course
1643 1686
 				(account_id, game_id, course)
1644 1687
 				VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeBinary(serialize($this->plottedCourse)) . ')');
1645
-		else if ($hadPlottedCourse) {
1688
+		} else if ($hadPlottedCourse) {
1646 1689
 			$this->deletePlottedCourse();
1647 1690
 		}
1648 1691
 	}
@@ -1652,12 +1695,14 @@  discard block
 block discarded – undo
1652 1695
 	}
1653 1696
 
1654 1697
 	public function isPartOfCourse($sectorOrSectorID) {
1655
-		if (!$this->hasPlottedCourse())
1656
-			return false;
1657
-		if ($sectorOrSectorID instanceof SmrSector)
1658
-			$sectorID = $sectorOrSectorID->getSectorID();
1659
-		else
1660
-			$sectorID = $sectorOrSectorID;
1698
+		if (!$this->hasPlottedCourse()) {
1699
+					return false;
1700
+		}
1701
+		if ($sectorOrSectorID instanceof SmrSector) {
1702
+					$sectorID = $sectorOrSectorID->getSectorID();
1703
+		} else {
1704
+					$sectorID = $sectorOrSectorID;
1705
+		}
1661 1706
 		return $this->getPlottedCourse()->isInPath($sectorID);
1662 1707
 	}
1663 1708
 
Please login to merge, or discard this patch.
lib/Default/DummyPlayer.class.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class DummyPlayer extends AbstractSmrPlayer {
4
-	public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) {
4
+	public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) {
5 5
 		parent::__construct();
6 6
 		$this->accountID				= 0;
7
-		$this->gameID					= (int) $gameID;
8
-		$this->playerName				= (string) $playerName;
7
+		$this->gameID = (int)$gameID;
8
+		$this->playerName = (string)$playerName;
9 9
 		$this->playerID					= 0;
10 10
 		$this->sectorID					= 0;
11
-		$this->lastSectorID				= 0;
11
+		$this->lastSectorID = 0;
12 12
 		$this->turns					= 1000;
13
-		$this->newbieTurns				= 0;
13
+		$this->newbieTurns = 0;
14 14
 		$this->lastNewsUpdate			= 0;
15 15
 		$this->dead						= false;
16 16
 		$this->landedOnPlanet			= false;
17
-		$this->lastActive				= 0;
18
-		$this->lastCPLAction			= 0;
19
-		$this->raceID					= (int) $raceID;
20
-		$this->credits					= 0;
21
-		$this->experience				= (int) $experience;
22
-		$this->alignment				= (int) $alignment;
23
-		$this->militaryPayment			= 0;
24
-		$this->allianceID				= (int) $allianceID;
25
-		$this->shipID					= (int) $shipTypeID;
17
+		$this->lastActive = 0;
18
+		$this->lastCPLAction = 0;
19
+		$this->raceID = (int)$raceID;
20
+		$this->credits = 0;
21
+		$this->experience				= (int)$experience;
22
+		$this->alignment = (int)$alignment;
23
+		$this->militaryPayment = 0;
24
+		$this->allianceID				= (int)$allianceID;
25
+		$this->shipID					= (int)$shipTypeID;
26 26
 		$this->kills					= 0;
27 27
 		$this->deaths					= 0;
28
-		$this->lastPort					= 0;
28
+		$this->lastPort = 0;
29 29
 		$this->bank						= 0;
30 30
 		$this->zoom						= 0;
31 31
 		
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 	
55 55
 	public function setAllianceID($ID) {
56
-		if($this->allianceID == $ID)
56
+		if ($this->allianceID == $ID)
57 57
 			return;
58
-		$this->allianceID=$ID;
58
+		$this->allianceID = $ID;
59 59
 	}
60 60
 	
61 61
 	public function &killPlayerByPlayer(AbstractSmrPlayer $killer) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$db = new SmrMySqlDatabase();
82 82
 		$db->query('REPLACE INTO cached_dummys ' .
83 83
 					'(type, id, info) ' .
84
-					'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')');	
84
+					'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')');	
85 85
 		 unserialize($cache);
86 86
 	}
87 87
 	
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$db->query('SELECT info FROM cached_dummys
91 91
 					WHERE type = \'DummyPlayer\'
92 92
 						AND id = ' . $db->escapeString($name) . ' LIMIT 1');
93
-		if($db->nextRecord()) {
93
+		if ($db->nextRecord()) {
94 94
 			$return = unserialize($db->getField('info'));
95 95
 			return $return;
96 96
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$db->query('SELECT id FROM cached_dummys
106 106
 					WHERE type = \'DummyPlayer\'');
107 107
 		$dummyNames = array();
108
-		while($db->nextRecord()) {
108
+		while ($db->nextRecord()) {
109 109
 			$dummyNames[] = $db->getField('id');
110 110
 		}
111 111
 		return $dummyNames;
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 	
55 55
 	public function setAllianceID($ID) {
56
-		if($this->allianceID == $ID)
57
-			return;
56
+		if($this->allianceID == $ID) {
57
+					return;
58
+		}
58 59
 		$this->allianceID=$ID;
59 60
 	}
60 61
 	
@@ -93,8 +94,7 @@  discard block
 block discarded – undo
93 94
 		if($db->nextRecord()) {
94 95
 			$return = unserialize($db->getField('info'));
95 96
 			return $return;
96
-		}
97
-		else {
97
+		} else {
98 98
 			$return = new DummyPlayer();
99 99
 			return $return;
100 100
 		}
Please login to merge, or discard this patch.
lib/Default/SocialLogins/Twitter.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		}
36 36
 		$helper = self::getTwitterObj($_SESSION['TwitterToken']);
37 37
 		$accessToken = $helper->oauth('oauth/access_token',
38
-		                              ['oauth_verifier' => $_REQUEST['oauth_verifier']]);
38
+									  ['oauth_verifier' => $_REQUEST['oauth_verifier']]);
39 39
 		$auth = self::getTwitterObj($accessToken);
40 40
 		$userInfo = $auth->get('account/verify_credentials', ['include_email' => 'true']);
41 41
 		if ($auth->getLastHttpCode() == 200) {
Please login to merge, or discard this patch.
htdocs/login.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,6 @@
 block discarded – undo
50 50
 	$template->assign('Body', 'login/login.php');
51 51
 	$template->display('login/skeleton.php');
52 52
 
53
-}
54
-catch (Throwable $e) {
53
+} catch (Throwable $e) {
55 54
 	handleException($e);
56 55
 }
Please login to merge, or discard this patch.
templates/Default/engine/Default/includes/PlanetTraderTeamCombatResults.inc 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-foreach($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) {
3
-	$ShootingPlayer =& $TraderResults['Player'];
4
-	$TotalDamage =& $TraderResults['TotalDamage'];
5
-	if($MinimalDisplay && !$ThisPlayer->equals($ShootingPlayer)) {
2
+foreach ($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) {
3
+	$ShootingPlayer = & $TraderResults['Player'];
4
+	$TotalDamage = & $TraderResults['TotalDamage'];
5
+	if ($MinimalDisplay && !$ThisPlayer->equals($ShootingPlayer)) {
6 6
 		echo $ShootingPlayer->getDisplayName();
7
-		if($TotalDamage > 0) {
7
+		if ($TotalDamage > 0) {
8 8
 			?> hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php
9 9
 		} else {
10 10
 			?> does no damage this round<?php
@@ -12,125 +12,125 @@  discard block
 block discarded – undo
12 12
 		continue;
13 13
 	}
14 14
 
15
-	if($TraderResults['DeadBeforeShot']) {
15
+	if ($TraderResults['DeadBeforeShot']) {
16 16
 		echo $ShootingPlayer->getDisplayName() ?> died before they were able to attack!<br /><?php
17 17
 	} else {
18
-		if(isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) {
19
-			foreach($TraderResults['Weapons'] as $WeaponResults) {
20
-				$ShootingWeapon =& $WeaponResults['Weapon'];
21
-				$ShotHit =& $WeaponResults['Hit'];
22
-				$ActualDamage =& $WeaponResults['ActualDamage'];
23
-				$WeaponDamage =& $WeaponResults['WeaponDamage'];
24
-				$TargetPlanet =& $WeaponResults['TargetPlanet'];
18
+		if (isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) {
19
+			foreach ($TraderResults['Weapons'] as $WeaponResults) {
20
+				$ShootingWeapon = & $WeaponResults['Weapon'];
21
+				$ShotHit = & $WeaponResults['Hit'];
22
+				$ActualDamage = & $WeaponResults['ActualDamage'];
23
+				$WeaponDamage = & $WeaponResults['WeaponDamage'];
24
+				$TargetPlanet = & $WeaponResults['TargetPlanet'];
25 25
 				$DamageTypes = 0;
26
-				if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; }
27
-				if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; }
28
-				if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; }
26
+				if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; }
27
+				if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; }
28
+				if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; }
29 29
 				
30
-				echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php if($ShotHit && $ActualDamage['TargetAlreadyDead']){ ?>the debris that was once <?php } echo $TargetPlanet->getDisplayName();
31
-				if(!$ActualDamage['TargetAlreadyDead']) {
32
-					if(!$ShotHit) {
30
+				echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { ?>the debris that was once <?php } echo $TargetPlanet->getDisplayName();
31
+				if (!$ActualDamage['TargetAlreadyDead']) {
32
+					if (!$ShotHit) {
33 33
 						?> and misses<?php
34
-					} else if($ActualDamage['TotalDamage'] == 0) {
35
-						if($WeaponDamage['Shield'] > 0) {
36
-							if($ActualDamage['HasCDs']) {
34
+					} else if ($ActualDamage['TotalDamage'] == 0) {
35
+						if ($WeaponDamage['Shield'] > 0) {
36
+							if ($ActualDamage['HasCDs']) {
37 37
 								?> which proves ineffective against their combat drones<?php
38 38
 							} else {
39 39
 								?> which washes harmlessly over their hull<?php
40 40
 							}
41
-						} else if($WeaponDamage['Armour'] > 0) {
41
+						} else if ($WeaponDamage['Armour'] > 0) {
42 42
 							?> which is deflected by their shields<?php
43 43
 						} else {
44 44
 							?> but it cannot do any damage<?php
45 45
 						}
46 46
 					} else {
47 47
 						?> destroying <?php
48
-						if($ActualDamage['Shield'] > 0) {
48
+						if ($ActualDamage['Shield'] > 0) {
49 49
 							?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php
50 50
 							$this->doDamageTypeReductionDisplay($DamageTypes);
51 51
 						}
52
-						if($ActualDamage['NumCDs'] > 0) {
52
+						if ($ActualDamage['NumCDs'] > 0) {
53 53
 							?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php
54 54
 							$this->doDamageTypeReductionDisplay($DamageTypes);
55 55
 						}
56
-						if($ActualDamage['Armour'] > 0) {
56
+						if ($ActualDamage['Armour'] > 0) {
57 57
 							?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php
58 58
 						}
59 59
 					}
60 60
 				} ?>.
61 61
 				<br /><?php
62
-				if($ActualDamage['KillingShot']) {
63
-					$this->includeTemplate('includes/PlanetKillMessage.inc',array('KillResults'=>$WeaponResults['KillResults'],'TargetPlanet'=>$TargetPlanet));
62
+				if ($ActualDamage['KillingShot']) {
63
+					$this->includeTemplate('includes/PlanetKillMessage.inc', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPlanet'=>$TargetPlanet));
64 64
 				}
65 65
 			}
66 66
 		}
67
-		if(isset($TraderResults['Drones'])) {
68
-			$Drones =& $TraderResults['Drones'];
69
-			$ActualDamage =& $Drones['ActualDamage'];
70
-			$WeaponDamage =& $Drones['WeaponDamage'];
71
-			$TargetPlanet =& $Drones['TargetPlanet'];
67
+		if (isset($TraderResults['Drones'])) {
68
+			$Drones = & $TraderResults['Drones'];
69
+			$ActualDamage = & $Drones['ActualDamage'];
70
+			$WeaponDamage = & $Drones['WeaponDamage'];
71
+			$TargetPlanet = & $Drones['TargetPlanet'];
72 72
 			$DamageTypes = 0;
73
-			if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; }
74
-			if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; }
75
-			if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; }
73
+			if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; }
74
+			if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; }
75
+			if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; }
76 76
 
77 77
 			echo $ShootingPlayer->getDisplayName();
78
-			if($WeaponDamage['Launched'] == 0) {
78
+			if ($WeaponDamage['Launched'] == 0) {
79 79
 				?> fails to launch their combat drones<?php
80 80
 			} else {
81 81
 				?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php
82
-				if($ActualDamage['TargetAlreadyDead']) {
82
+				if ($ActualDamage['TargetAlreadyDead']) {
83 83
 					?>the debris that was once <?php
84 84
 				}
85 85
 				echo $TargetPlanet->getDisplayName();
86
-				if(!$ActualDamage['TargetAlreadyDead']) {
87
-					if($ActualDamage['TotalDamage'] == 0) {
88
-						if($WeaponDamage['Shield'] > 0) {
89
-							if($ActualDamage['HasCDs']) {
86
+				if (!$ActualDamage['TargetAlreadyDead']) {
87
+					if ($ActualDamage['TotalDamage'] == 0) {
88
+						if ($WeaponDamage['Shield'] > 0) {
89
+							if ($ActualDamage['HasCDs']) {
90 90
 								?> which prove ineffective against their combat drones<?php
91 91
 							} else {
92 92
 								?> which washes harmlessly over their hull<?php
93 93
 							}
94 94
 						}
95
-						if($ActualDamage['Armour'] > 0) {
95
+						if ($ActualDamage['Armour'] > 0) {
96 96
 							?> which is deflected by their shields<?php
97 97
 						} else {
98 98
 							?> but they cannot do any damage<?php
99 99
 						}
100 100
 					} else {
101 101
 						?> destroying <?php
102
-						if($ActualDamage['Shield'] > 0) {
102
+						if ($ActualDamage['Shield'] > 0) {
103 103
 							?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php
104 104
 							$this->doDamageTypeReductionDisplay($DamageTypes);
105 105
 						}
106
-						if($ActualDamage['NumCDs'] > 0) {
106
+						if ($ActualDamage['NumCDs'] > 0) {
107 107
 							?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php
108 108
 							$this->doDamageTypeReductionDisplay($DamageTypes);
109 109
 						}
110
-						if($ActualDamage['Armour'] > 0) {
110
+						if ($ActualDamage['Armour'] > 0) {
111 111
 							?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php
112 112
 						}
113 113
 					}
114 114
 				}
115 115
 			} ?>.
116 116
 			<br /><?php
117
-			if($ActualDamage['KillingShot']) {
118
-				$this->includeTemplate('includes/PlanetKillMessage.inc',array('KillResults'=>$Drones['KillResults'],'TargetPlanet'=>$TargetPlanet));
117
+			if ($ActualDamage['KillingShot']) {
118
+				$this->includeTemplate('includes/PlanetKillMessage.inc', array('KillResults'=>$Drones['KillResults'], 'TargetPlanet'=>$TargetPlanet));
119 119
 			}
120 120
 		}
121 121
 	}
122 122
 	echo $ShootingPlayer->getDisplayName();
123
-	if($TotalDamage > 0) {
123
+	if ($TotalDamage > 0) {
124 124
 		?> hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php
125 125
 	} else {
126 126
 		?> does no damage this round<?php
127
-		if(!$TraderResults['DeadBeforeShot']) {
127
+		if (!$TraderResults['DeadBeforeShot']) {
128 128
 			?>. Maybe they should go back to the academy<?php
129 129
 		}
130 130
 	} ?>.<br /><br /><?php
131 131
 }
132 132
 $TotalDamage = $TraderTeamCombatResults['TotalDamage']; ?>
133
-This fleet <?php if($TotalDamage > 0){ ?>hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php } else{ ?>does no damage this round. You call that a fleet? They need a better recruiter<?php } ?>.<br /><?php
133
+This fleet <?php if ($TotalDamage > 0) { ?>hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php } else { ?>does no damage this round. You call that a fleet? They need a better recruiter<?php } ?>.<br /><?php
134 134
 foreach ($TraderTeamCombatResults['Downgrades'] as $structureID => $numDestroyed) { ?>
135 135
 	This team destroys <span class="red"><?php echo $numDestroyed; ?> </span><?php echo pluralise($TargetPlanet->getStructureTypes($structureID)->name(), $numDestroyed); ?>.<br /><?php
136 136
 } ?>
Please login to merge, or discard this patch.