We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -1,36 +1,36 @@ discard block |
||
1 | 1 | <?php |
2 | -if(is_array($TraderTeamCombatResults['Traders'])) { |
|
3 | - foreach($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) { |
|
4 | - $ShootingPlayer =& $TraderResults['Player']; |
|
5 | - $TotalDamage =& $TraderResults['TotalDamage']; |
|
2 | +if (is_array($TraderTeamCombatResults['Traders'])) { |
|
3 | + foreach ($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) { |
|
4 | + $ShootingPlayer = & $TraderResults['Player']; |
|
5 | + $TotalDamage = & $TraderResults['TotalDamage']; |
|
6 | 6 | |
7 | - if($TraderResults['DeadBeforeShot']) { |
|
7 | + if ($TraderResults['DeadBeforeShot']) { |
|
8 | 8 | echo $ShootingPlayer->getDisplayName() ?> died before they were able to attack!<br /><?php |
9 | 9 | } else { |
10 | - if(isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) { |
|
11 | - foreach($TraderResults['Weapons'] as $WeaponResults) { |
|
12 | - $ShootingWeapon =& $WeaponResults['Weapon']; |
|
13 | - $ShotHit =& $WeaponResults['Hit']; |
|
14 | - $ActualDamage =& $WeaponResults['ActualDamage']; |
|
15 | - $WeaponDamage =& $WeaponResults['WeaponDamage']; |
|
16 | - $TargetPlayer =& $WeaponResults['TargetPlayer']; |
|
10 | + if (isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) { |
|
11 | + foreach ($TraderResults['Weapons'] as $WeaponResults) { |
|
12 | + $ShootingWeapon = & $WeaponResults['Weapon']; |
|
13 | + $ShotHit = & $WeaponResults['Hit']; |
|
14 | + $ActualDamage = & $WeaponResults['ActualDamage']; |
|
15 | + $WeaponDamage = & $WeaponResults['WeaponDamage']; |
|
16 | + $TargetPlayer = & $WeaponResults['TargetPlayer']; |
|
17 | 17 | |
18 | 18 | echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php |
19 | - if($ShotHit && $ActualDamage['TargetAlreadyDead']) { |
|
19 | + if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { |
|
20 | 20 | ?>the debris that was once <?php |
21 | 21 | } |
22 | 22 | echo $TargetPlayer->getDisplayName(); |
23 | 23 | if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) { |
24 | - if(!$ShotHit) { |
|
24 | + if (!$ShotHit) { |
|
25 | 25 | ?> and misses<?php |
26 | - } else if($ActualDamage['TotalDamage'] == 0) { |
|
27 | - if($WeaponDamage['Shield'] > 0) { |
|
28 | - if($ActualDamage['HasCDs']) { |
|
26 | + } else if ($ActualDamage['TotalDamage'] == 0) { |
|
27 | + if ($WeaponDamage['Shield'] > 0) { |
|
28 | + if ($ActualDamage['HasCDs']) { |
|
29 | 29 | ?> which proves ineffective against their combat drones<?php |
30 | 30 | } else { |
31 | 31 | ?> which washes harmlessly over their hull<?php |
32 | 32 | } |
33 | - } else if($WeaponDamage['Armour'] > 0) { |
|
33 | + } else if ($WeaponDamage['Armour'] > 0) { |
|
34 | 34 | ?> which is deflected by their shields<?php |
35 | 35 | } else { |
36 | 36 | ?> but it cannot do any damage<?php |
@@ -38,94 +38,94 @@ discard block |
||
38 | 38 | } else { |
39 | 39 | ?> destroying <?php |
40 | 40 | $DamageTypes = 0; |
41 | - if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
42 | - if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
43 | - if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
41 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
42 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
43 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
44 | 44 | |
45 | - if($ActualDamage['Shield'] > 0) { |
|
45 | + if ($ActualDamage['Shield'] > 0) { |
|
46 | 46 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php |
47 | 47 | $this->doDamageTypeReductionDisplay($DamageTypes); |
48 | 48 | } |
49 | - if($ActualDamage['NumCDs'] > 0) { |
|
49 | + if ($ActualDamage['NumCDs'] > 0) { |
|
50 | 50 | ?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php |
51 | 51 | $this->doDamageTypeReductionDisplay($DamageTypes); |
52 | 52 | } |
53 | - if($ActualDamage['Armour'] > 0) { |
|
53 | + if ($ActualDamage['Armour'] > 0) { |
|
54 | 54 | ?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php |
55 | 55 | } |
56 | 56 | } |
57 | 57 | } ?>. |
58 | 58 | <br /><?php |
59 | 59 | if ($ShotHit && $ActualDamage['KillingShot']) { |
60 | - $this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$WeaponResults['KillResults'],'TargetPlayer'=>$TargetPlayer,'ShootingPlayer'=>$ShootingPlayer)); |
|
60 | + $this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPlayer'=>$TargetPlayer, 'ShootingPlayer'=>$ShootingPlayer)); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
64 | - if(isset($TraderResults['Drones'])) { |
|
65 | - $Drones =& $TraderResults['Drones']; |
|
66 | - $ActualDamage =& $Drones['ActualDamage']; |
|
67 | - $WeaponDamage =& $Drones['WeaponDamage']; |
|
68 | - $TargetPlayer =& $Drones['TargetPlayer']; |
|
64 | + if (isset($TraderResults['Drones'])) { |
|
65 | + $Drones = & $TraderResults['Drones']; |
|
66 | + $ActualDamage = & $Drones['ActualDamage']; |
|
67 | + $WeaponDamage = & $Drones['WeaponDamage']; |
|
68 | + $TargetPlayer = & $Drones['TargetPlayer']; |
|
69 | 69 | $DamageTypes = 0; |
70 | - if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
71 | - if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
72 | - if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
70 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
71 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
72 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
73 | 73 | |
74 | 74 | echo $ShootingPlayer->getDisplayName(); |
75 | - if($WeaponDamage['Launched'] == 0) { |
|
75 | + if ($WeaponDamage['Launched'] == 0) { |
|
76 | 76 | ?> fails to launch their combat drones<?php |
77 | 77 | } else { |
78 | 78 | ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php |
79 | - if($ActualDamage['TargetAlreadyDead']) { |
|
79 | + if ($ActualDamage['TargetAlreadyDead']) { |
|
80 | 80 | ?>the debris that was once <?php |
81 | 81 | } |
82 | 82 | echo $TargetPlayer->getDisplayName(); |
83 | - if(!$ActualDamage['TargetAlreadyDead']) { |
|
84 | - if($ActualDamage['TotalDamage'] == 0) { |
|
85 | - if($WeaponDamage['Shield'] > 0) { |
|
86 | - if($ActualDamage['HasCDs']) { |
|
83 | + if (!$ActualDamage['TargetAlreadyDead']) { |
|
84 | + if ($ActualDamage['TotalDamage'] == 0) { |
|
85 | + if ($WeaponDamage['Shield'] > 0) { |
|
86 | + if ($ActualDamage['HasCDs']) { |
|
87 | 87 | ?> which prove ineffective against their combat drones<?php |
88 | 88 | } else { |
89 | 89 | ?> which washes harmlessly over their hull<?php |
90 | 90 | } |
91 | 91 | } |
92 | - if($ActualDamage['Armour'] > 0) { |
|
92 | + if ($ActualDamage['Armour'] > 0) { |
|
93 | 93 | ?> which is deflected by their shields<?php |
94 | 94 | } else { |
95 | 95 | ?> but they cannot do any damage<?php |
96 | 96 | } |
97 | 97 | } else { |
98 | 98 | ?> destroying <?php |
99 | - if($ActualDamage['Shield'] > 0) { |
|
99 | + if ($ActualDamage['Shield'] > 0) { |
|
100 | 100 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php |
101 | 101 | $this->doDamageTypeReductionDisplay($DamageTypes); |
102 | 102 | } |
103 | - if($ActualDamage['NumCDs'] > 0) { |
|
103 | + if ($ActualDamage['NumCDs'] > 0) { |
|
104 | 104 | ?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']) ?></span> combat drones<?php |
105 | 105 | $this->doDamageTypeReductionDisplay($DamageTypes); |
106 | 106 | } |
107 | - if($ActualDamage['Armour'] > 0) { |
|
107 | + if ($ActualDamage['Armour'] > 0) { |
|
108 | 108 | ?><span class="red"><?php echo number_format($ActualDamage['Armour']) ?></span> plates of armour<?php |
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } ?>. |
113 | 113 | <br /><?php |
114 | - if($ActualDamage['KillingShot']) { |
|
115 | - $this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$Drones['KillResults'],'TargetPlayer'=>$TargetPlayer,'ShootingPlayer'=>$ShootingPlayer)); |
|
114 | + if ($ActualDamage['KillingShot']) { |
|
115 | + $this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$Drones['KillResults'], 'TargetPlayer'=>$TargetPlayer, 'ShootingPlayer'=>$ShootingPlayer)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | echo $ShootingPlayer->getDisplayName(); |
120 | - if($TotalDamage > 0) { |
|
120 | + if ($TotalDamage > 0) { |
|
121 | 121 | ?> hits for a total of <span class="red"><?php echo $TotalDamage ?></span> damage in this round of combat<?php |
122 | 122 | } else { |
123 | 123 | ?> does no damage this round.<?php |
124 | - if(!$TraderResults['DeadBeforeShot']) { |
|
124 | + if (!$TraderResults['DeadBeforeShot']) { |
|
125 | 125 | ?> Maybe they should go back to the academy<?php |
126 | 126 | } |
127 | 127 | } ?>.<br /><br /><?php |
128 | 128 | } |
129 | 129 | } |
130 | 130 | $TotalDamage = $TraderTeamCombatResults['TotalDamage']; ?> |
131 | -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 /> |
|
131 | +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 /> |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $CombatPlanet = $PlanetCombatResults['Planet']; |
3 | 3 | $TotalDamage = $PlanetCombatResults['TotalDamage']; |
4 | -if($MinimalDisplay) { |
|
4 | +if ($MinimalDisplay) { |
|
5 | 5 | echo $CombatPlanet->getCombatName(); |
6 | - if($TotalDamage > 0) { |
|
6 | + if ($TotalDamage > 0) { |
|
7 | 7 | ?> hit for a total of <span class="red"><?php echo $TotalDamage; ?></span> damage in this round of combat of which <span class="red"><?php echo $PlanetCombatResults['TotalDamagePerTargetPlayer'][$ThisPlayer->getAccountID()]; ?></span> was done to you<?php |
8 | 8 | } else { |
9 | 9 | ?> does no damage this round<?php |
10 | 10 | } ?>. <?php echo $AttackLogLink; |
11 | 11 | return; |
12 | 12 | } |
13 | -if(isset($PlanetCombatResults['Weapons']) && is_array($PlanetCombatResults['Weapons'])) { |
|
14 | - foreach($PlanetCombatResults['Weapons'] as $WeaponResults) { |
|
15 | - $ShootingWeapon =& $WeaponResults['Weapon']; |
|
16 | - $ShotHit =& $WeaponResults['Hit']; |
|
17 | - $ActualDamage =& $WeaponResults['ActualDamage']; |
|
18 | - $WeaponDamage =& $WeaponResults['WeaponDamage']; |
|
19 | - $TargetPlayer =& $WeaponResults['TargetPlayer']; |
|
13 | +if (isset($PlanetCombatResults['Weapons']) && is_array($PlanetCombatResults['Weapons'])) { |
|
14 | + foreach ($PlanetCombatResults['Weapons'] as $WeaponResults) { |
|
15 | + $ShootingWeapon = & $WeaponResults['Weapon']; |
|
16 | + $ShotHit = & $WeaponResults['Hit']; |
|
17 | + $ActualDamage = & $WeaponResults['ActualDamage']; |
|
18 | + $WeaponDamage = & $WeaponResults['WeaponDamage']; |
|
19 | + $TargetPlayer = & $WeaponResults['TargetPlayer']; |
|
20 | 20 | |
21 | - echo $CombatPlanet->getCombatName() ?> fires a <?php echo $ShootingWeapon->getName(); ?> at <?php if($ShotHit && $ActualDamage['TargetAlreadyDead']){ ?> the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
21 | + echo $CombatPlanet->getCombatName() ?> fires a <?php echo $ShootingWeapon->getName(); ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { ?> the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
22 | 22 | if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) { |
23 | - if(!$ShotHit) { |
|
23 | + if (!$ShotHit) { |
|
24 | 24 | ?> and misses<?php |
25 | - } else if($ActualDamage['TotalDamage'] == 0) { |
|
26 | - if($WeaponDamage['Shield'] > 0) { |
|
27 | - if($ActualDamage['HasCDs']) { |
|
25 | + } else if ($ActualDamage['TotalDamage'] == 0) { |
|
26 | + if ($WeaponDamage['Shield'] > 0) { |
|
27 | + if ($ActualDamage['HasCDs']) { |
|
28 | 28 | ?> which proves ineffective against their combat drones<?php |
29 | 29 | } else { |
30 | 30 | ?> which washes harmlessly over their hull<?php |
31 | 31 | } |
32 | - } else if($WeaponDamage['Armour'] > 0) { |
|
32 | + } else if ($WeaponDamage['Armour'] > 0) { |
|
33 | 33 | ?> which is deflected by their shields<?php |
34 | 34 | } else { |
35 | 35 | ?> but it cannot do any damage<?php |
@@ -37,81 +37,81 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | ?> destroying <?php |
39 | 39 | $DamageTypes = 0; |
40 | - if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
41 | - if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
42 | - if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
40 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
41 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
42 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
43 | 43 | |
44 | - if($ActualDamage['Shield'] > 0) { |
|
44 | + if ($ActualDamage['Shield'] > 0) { |
|
45 | 45 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']); ?></span> shields<?php |
46 | 46 | $this->doDamageTypeReductionDisplay($DamageTypes); |
47 | 47 | } |
48 | - if($ActualDamage['NumCDs'] > 0) { |
|
48 | + if ($ActualDamage['NumCDs'] > 0) { |
|
49 | 49 | ?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']); ?></span> combat drones<?php |
50 | 50 | $this->doDamageTypeReductionDisplay($DamageTypes); |
51 | 51 | } |
52 | - if($ActualDamage['Armour'] > 0) { |
|
52 | + if ($ActualDamage['Armour'] > 0) { |
|
53 | 53 | ?><span class="red"><?php echo number_format($ActualDamage['Armour']); ?></span> plates of armour<?php |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } ?>. |
57 | 57 | <br /><?php |
58 | 58 | if ($ShotHit && $ActualDamage['KillingShot']) { |
59 | - $this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$WeaponResults['KillResults'],'TargetPlayer'=>$TargetPlayer)); |
|
59 | + $this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPlayer'=>$TargetPlayer)); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
63 | -if(isset($PlanetCombatResults['Drones'])) { |
|
64 | - $Drones =& $PlanetCombatResults['Drones']; |
|
65 | - $ActualDamage =& $Drones['ActualDamage']; |
|
66 | - $WeaponDamage =& $Drones['WeaponDamage']; |
|
67 | - $TargetPlayer =& $Drones['TargetPlayer']; |
|
63 | +if (isset($PlanetCombatResults['Drones'])) { |
|
64 | + $Drones = & $PlanetCombatResults['Drones']; |
|
65 | + $ActualDamage = & $Drones['ActualDamage']; |
|
66 | + $WeaponDamage = & $Drones['WeaponDamage']; |
|
67 | + $TargetPlayer = & $Drones['TargetPlayer']; |
|
68 | 68 | $DamageTypes = 0; |
69 | - if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
70 | - if($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
71 | - if($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
69 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
70 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
71 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
72 | 72 | |
73 | 73 | echo $CombatPlanet->getCombatName(); |
74 | - if($WeaponDamage['Launched'] == 0) { |
|
74 | + if ($WeaponDamage['Launched'] == 0) { |
|
75 | 75 | ?> fails to launch it's combat drones<?php |
76 | 76 | } else { |
77 | - ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php if($ActualDamage['TargetAlreadyDead']){ ?>the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
78 | - if(!$ActualDamage['TargetAlreadyDead']) { |
|
79 | - if($ActualDamage['TotalDamage'] == 0) { |
|
80 | - if($WeaponDamage['Shield'] > 0) { |
|
81 | - if($ActualDamage['HasCDs']) { |
|
77 | + ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php if ($ActualDamage['TargetAlreadyDead']) { ?>the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
78 | + if (!$ActualDamage['TargetAlreadyDead']) { |
|
79 | + if ($ActualDamage['TotalDamage'] == 0) { |
|
80 | + if ($WeaponDamage['Shield'] > 0) { |
|
81 | + if ($ActualDamage['HasCDs']) { |
|
82 | 82 | ?> which prove ineffective against their combat drones<?php |
83 | 83 | } else { |
84 | 84 | ?> which washes harmlessly over their hull<?php |
85 | 85 | } |
86 | - } else if($WeaponDamage['Armour'] > 0) { |
|
86 | + } else if ($WeaponDamage['Armour'] > 0) { |
|
87 | 87 | ?> which is deflected by their shields<?php |
88 | 88 | } else { |
89 | 89 | ?> but they cannot do any damage<?php |
90 | 90 | } |
91 | 91 | } else { |
92 | 92 | ?> destroying <?php |
93 | - if($ActualDamage['Shield'] > 0) { |
|
93 | + if ($ActualDamage['Shield'] > 0) { |
|
94 | 94 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']); ?></span> shields<?php |
95 | 95 | $this->doDamageTypeReductionDisplay($DamageTypes); |
96 | 96 | } |
97 | - if($ActualDamage['NumCDs'] > 0) { |
|
97 | + if ($ActualDamage['NumCDs'] > 0) { |
|
98 | 98 | ?><span class="cds"><?php echo number_format($ActualDamage['NumCDs']); ?></span> combat drones<?php |
99 | 99 | $this->doDamageTypeReductionDisplay($DamageTypes); |
100 | 100 | } |
101 | - if($ActualDamage['Armour'] > 0) { |
|
101 | + if ($ActualDamage['Armour'] > 0) { |
|
102 | 102 | ?><span class="red"><?php echo number_format($ActualDamage['Armour']); ?></span> plates of armour<?php |
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } ?>. |
107 | 107 | <br /><?php |
108 | - if($ActualDamage['KillingShot']) { |
|
109 | - $this->includeTemplate('includes/TraderCombatKillMessage.inc',array('KillResults'=>$Drones['KillResults'],'TargetPlayer'=>$TargetPlayer)); |
|
108 | + if ($ActualDamage['KillingShot']) { |
|
109 | + $this->includeTemplate('includes/TraderCombatKillMessage.inc', array('KillResults'=>$Drones['KillResults'], 'TargetPlayer'=>$TargetPlayer)); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | echo $CombatPlanet->getCombatName(); |
114 | -if($TotalDamage > 0) { |
|
114 | +if ($TotalDamage > 0) { |
|
115 | 115 | ?> hit for a total of <span class="red"><?php echo $TotalDamage; ?></span> damage in this round of combat<?php |
116 | 116 | } else { |
117 | 117 | ?> does no damage this round. You call that a planet? It needs a better builder<?php |
@@ -3,10 +3,10 @@ |
||
3 | 3 | // Holds information linking the received message and the game data |
4 | 4 | class GameLink |
5 | 5 | { |
6 | - public $valid = false; // identifies if the message is linked to game data |
|
7 | - public $account; // SmrAccount instance |
|
8 | - public $alliance; // SmrAlliance instance |
|
9 | - public $player; // SmrPlayer instance |
|
6 | + public $valid = false; // identifies if the message is linked to game data |
|
7 | + public $account; // SmrAccount instance |
|
8 | + public $alliance; // SmrAlliance instance |
|
9 | + public $player; // SmrPlayer instance |
|
10 | 10 | |
11 | 11 | // $author can be either Discord\Parts\User\{User,Member} |
12 | 12 | function __construct(Discord\Parts\Channel\Channel $channel, $author) { |
@@ -10,22 +10,22 @@ discard block |
||
10 | 10 | |
11 | 11 | debug('Script started'); |
12 | 12 | define('SCRIPT_ID', $db->getInsertID()); |
13 | - $db->query('UPDATE npc_logs SET script_id='.SCRIPT_ID.' WHERE log_id='.SCRIPT_ID); |
|
13 | + $db->query('UPDATE npc_logs SET script_id=' . SCRIPT_ID . ' WHERE log_id=' . SCRIPT_ID); |
|
14 | 14 | |
15 | 15 | define('NPC_SCRIPT', true); |
16 | 16 | |
17 | 17 | $descriptorSpec = array( |
18 | - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
18 | + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
19 | 19 | 1 => array("pipe", "w") // stdout is a pipe that the child will write to |
20 | 20 | ); |
21 | 21 | $engine = proc_open(UCI_CHESS_ENGINE, $descriptorSpec, $pipes); |
22 | - $toEngine =& $pipes[0]; |
|
23 | - $fromEngine =& $pipes[1]; |
|
22 | + $toEngine = & $pipes[0]; |
|
23 | + $fromEngine = & $pipes[1]; |
|
24 | 24 | |
25 | 25 | function readFromEngine($block = true) { |
26 | 26 | global $fromEngine; |
27 | 27 | stream_set_blocking($fromEngine, $block == true ? 1 : 0); |
28 | - while(($s = fgets($fromEngine)) !== false) { |
|
28 | + while (($s = fgets($fromEngine)) !== false) { |
|
29 | 29 | debug('<-- ' . trim($s)); |
30 | 30 | stream_set_blocking($fromEngine, 0); |
31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | global $toEngine; |
35 | 35 | debug('--> ' . $s); |
36 | 36 | fputs($toEngine, $s . EOL); |
37 | - if($read === true) { |
|
37 | + if ($read === true) { |
|
38 | 38 | readFromEngine($block); |
39 | 39 | } |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | writeToEngine('isready'); |
46 | 46 | writeToEngine('ucinewgame', false); |
47 | 47 | |
48 | - while(true) { |
|
48 | + while (true) { |
|
49 | 49 | // The next "page request" must occur at an updated time. |
50 | 50 | SmrSession::updateTime(); |
51 | 51 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | writeToEngine('position fen ' . $chessGame->getFENString(), false); |
55 | 55 | writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false); |
56 | 56 | stream_set_blocking($fromEngine, 1); |
57 | - while(stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
57 | + while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
58 | 58 | debug('<-- ' . $move); |
59 | - if(stripos($move, 'Seg') === 0) { |
|
59 | + if (stripos($move, 'Seg') === 0) { |
|
60 | 60 | // Segfault |
61 | 61 | debug('UCI engine segfaulted?'); |
62 | 62 | exit; |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | fclose($toEngine); |
77 | 77 | fclose($fromEngine); |
78 | 78 | proc_close($engine); |
79 | -} catch(Throwable $e) { |
|
79 | +} catch (Throwable $e) { |
|
80 | 80 | logException($e); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | function debug($message, $debugObject = null) { |
84 | - global $account,$var,$db; |
|
85 | - echo date('Y-m-d H:i:s - ').$message.($debugObject!==null?EOL.var_export($debugObject,true):'').EOL; |
|
86 | - $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES ('.(defined('SCRIPT_ID')?SCRIPT_ID:0).', '.(is_object($account)?$account->getAccountID():0).',NOW(),'.$db->escapeString($message).','.$db->escapeString(var_export($debugObject,true)).','.$db->escapeString(var_export($var,true)).')'); |
|
84 | + global $account, $var, $db; |
|
85 | + echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ?EOL.var_export($debugObject, true) : '') . EOL; |
|
86 | + $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ?SCRIPT_ID:0) . ', ' . (is_object($account) ? $account->getAccountID() : 0) . ',NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject, true)) . ',' . $db->escapeString(var_export($var, true)) . ')'); |
|
87 | 87 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | try { |
122 | - $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE']; |
|
122 | + $TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE']; |
|
123 | 123 | debug('Action #' . $actions); |
124 | 124 | |
125 | 125 | //We have to reload player on each loop |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set. |
141 | - $TRADE_ROUTES =& findRoutes($player); |
|
142 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); |
|
141 | + $TRADE_ROUTES = & findRoutes($player); |
|
142 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if ($player->isDead()) { |
146 | 146 | debug('Some evil person killed us, let\'s move on now.'); |
147 | 147 | $previousContainer = null; //We died, we don't care what we were doing beforehand. |
148 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route |
|
148 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route |
|
149 | 149 | processContainer(create_container('death_processing.php')); |
150 | 150 | } |
151 | 151 | if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | processContainer(tradeGoods($goodID, $player, $port)); |
228 | 228 | } else { |
229 | 229 | //Move to next route or fed. |
230 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
230 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
231 | 231 | debug('Changing Route Failed'); |
232 | 232 | processContainer(plotToFed($player)); |
233 | 233 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | processContainer(tradeGoods($goodID, $player, $port)); |
255 | 255 | } else { |
256 | 256 | //Move to next route or fed. |
257 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
257 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
258 | 258 | debug('Changing Route Failed'); |
259 | 259 | processContainer(plotToFed($player)); |
260 | 260 | } else { |
@@ -586,9 +586,9 @@ discard block |
||
586 | 586 | return $false; |
587 | 587 | } |
588 | 588 | $routeKey = array_rand($tradeRoutes); |
589 | - $tradeRoute =& $tradeRoutes[$routeKey]; |
|
589 | + $tradeRoute = & $tradeRoutes[$routeKey]; |
|
590 | 590 | unset($tradeRoutes[$routeKey]); |
591 | - $GLOBALS['TRADE_ROUTE'] =& $tradeRoute; |
|
591 | + $GLOBALS['TRADE_ROUTE'] = & $tradeRoute; |
|
592 | 592 | debug('Switched route', $tradeRoute); |
593 | 593 | return $tradeRoute; |
594 | 594 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | /** |
269 | 269 | * Insert a new player into the database. Returns the new player object. |
270 | 270 | */ |
271 | - public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc=false) { |
|
271 | + public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc = false) { |
|
272 | 272 | $db = MySqlDatabase::getInstance(); |
273 | 273 | $db->lockTable('player'); |
274 | 274 | |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | create_error('The saved sector must be in the box!'); |
1704 | 1704 | } |
1705 | 1705 | |
1706 | - $storedDestinations =& $this->getStoredDestinations(); |
|
1706 | + $storedDestinations = & $this->getStoredDestinations(); |
|
1707 | 1707 | foreach ($storedDestinations as &$sd) { |
1708 | 1708 | if ($sd['SectorID'] == $sectorID) { |
1709 | 1709 | $sd['OffsetTop'] = $offsetTop; |
@@ -2030,13 +2030,13 @@ discard block |
||
2030 | 2030 | $this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL); |
2031 | 2031 | $this->HOF = array(); |
2032 | 2032 | while ($this->db->nextRecord()) { |
2033 | - $hof =& $this->HOF; |
|
2033 | + $hof = & $this->HOF; |
|
2034 | 2034 | $typeList = explode(':', $this->db->getField('type')); |
2035 | 2035 | foreach ($typeList as $type) { |
2036 | 2036 | if (!isset($hof[$type])) { |
2037 | 2037 | $hof[$type] = array(); |
2038 | 2038 | } |
2039 | - $hof =& $hof[$type]; |
|
2039 | + $hof = & $hof[$type]; |
|
2040 | 2040 | } |
2041 | 2041 | $hof = $this->db->getFloat('amount'); |
2042 | 2042 | } |
@@ -2115,8 +2115,8 @@ discard block |
||
2115 | 2115 | } |
2116 | 2116 | self::$HOFVis[$hofType] = $visibility; |
2117 | 2117 | |
2118 | - $hof =& $this->HOF; |
|
2119 | - $hofChanged =& $this->hasHOFChanged; |
|
2118 | + $hof = & $this->HOF; |
|
2119 | + $hofChanged = & $this->hasHOFChanged; |
|
2120 | 2120 | $new = false; |
2121 | 2121 | foreach ($typeList as $type) { |
2122 | 2122 | if (!isset($hofChanged[$type])) { |
@@ -2126,8 +2126,8 @@ discard block |
||
2126 | 2126 | $hof[$type] = array(); |
2127 | 2127 | $new = true; |
2128 | 2128 | } |
2129 | - $hof =& $hof[$type]; |
|
2130 | - $hofChanged =& $hofChanged[$type]; |
|
2129 | + $hof = & $hof[$type]; |
|
2130 | + $hofChanged = & $hofChanged[$type]; |
|
2131 | 2131 | } |
2132 | 2132 | if ($hofChanged == null) { |
2133 | 2133 | $hofChanged = self::HOF_CHANGED; |
@@ -2730,7 +2730,7 @@ discard block |
||
2730 | 2730 | } |
2731 | 2731 | |
2732 | 2732 | private function setupMissionStep($missionID) { |
2733 | - $mission =& $this->missions[$missionID]; |
|
2733 | + $mission = & $this->missions[$missionID]; |
|
2734 | 2734 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
2735 | 2735 | // Nothing to do if this mission is already completed |
2736 | 2736 | return; |
@@ -2779,7 +2779,7 @@ discard block |
||
2779 | 2779 | 'Starting Sector' => $this->getSectorID() |
2780 | 2780 | ); |
2781 | 2781 | |
2782 | - $this->missions[$missionID] =& $mission; |
|
2782 | + $this->missions[$missionID] = & $mission; |
|
2783 | 2783 | $this->setupMissionStep($missionID); |
2784 | 2784 | $this->rebuildMission($missionID); |
2785 | 2785 | |
@@ -2829,7 +2829,7 @@ discard block |
||
2829 | 2829 | |
2830 | 2830 | public function claimMissionReward($missionID) { |
2831 | 2831 | $this->getMissions(); |
2832 | - $mission =& $this->missions[$missionID]; |
|
2832 | + $mission = & $this->missions[$missionID]; |
|
2833 | 2833 | if ($mission === false) { |
2834 | 2834 | throw new Exception('Unknown mission: ' . $missionID); |
2835 | 2835 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
198 | 198 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
199 | 199 | } |
200 | - $damage =& $this->getModifiedDamage(); |
|
200 | + $damage = & $this->getModifiedDamage(); |
|
201 | 201 | return $damage; |
202 | 202 | } |
203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
207 | 207 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
208 | 208 | } |
209 | - $damage =& $this->getModifiedDamage(); |
|
209 | + $damage = & $this->getModifiedDamage(); |
|
210 | 210 | return $damage; |
211 | 211 | } |
212 | 212 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
216 | 216 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
217 | 217 | } |
218 | - $damage =& $this->getModifiedDamage(); |
|
218 | + $damage = & $this->getModifiedDamage(); |
|
219 | 219 | |
220 | 220 | $planetMod = self::PLANET_DAMAGE_MOD; |
221 | 221 | $damage['MaxDamage'] = ICeil($damage['MaxDamage'] * $planetMod); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
236 | 236 | return $return; |
237 | 237 | } |
238 | - $damage =& $this->getModifiedDamage(); |
|
238 | + $damage = & $this->getModifiedDamage(); |
|
239 | 239 | return $damage; |
240 | 240 | } |
241 | 241 |
@@ -361,26 +361,26 @@ |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | public function isNPC() : bool { |
364 | - if(!isset($this->npc)) { |
|
365 | - $this->db->query('SELECT login FROM npc_logins WHERE login = '.$this->db->escapeString($this->getLogin()).' LIMIT 1;'); |
|
364 | + if (!isset($this->npc)) { |
|
365 | + $this->db->query('SELECT login FROM npc_logins WHERE login = ' . $this->db->escapeString($this->getLogin()) . ' LIMIT 1;'); |
|
366 | 366 | $this->npc = $this->db->nextRecord(); |
367 | 367 | } |
368 | 368 | return $this->npc; |
369 | 369 | } |
370 | 370 | |
371 | 371 | protected function getHOFData() : void { |
372 | - if(!isset($this->HOF)) { |
|
372 | + if (!isset($this->HOF)) { |
|
373 | 373 | //Get Player HOF |
374 | 374 | $this->db->query('SELECT type,sum(amount) as amount FROM player_hof WHERE ' . $this->SQL . ' AND game_id IN (SELECT game_id FROM game WHERE ignore_stats = \'FALSE\') GROUP BY type'); |
375 | 375 | $this->HOF = array(); |
376 | - while($this->db->nextRecord()) { |
|
377 | - $hof =& $this->HOF; |
|
378 | - $typeList = explode(':',$this->db->getField('type')); |
|
379 | - foreach($typeList as $type) { |
|
380 | - if(!isset($hof[$type])) { |
|
376 | + while ($this->db->nextRecord()) { |
|
377 | + $hof = & $this->HOF; |
|
378 | + $typeList = explode(':', $this->db->getField('type')); |
|
379 | + foreach ($typeList as $type) { |
|
380 | + if (!isset($hof[$type])) { |
|
381 | 381 | $hof[$type] = array(); |
382 | 382 | } |
383 | - $hof =& $hof[$type]; |
|
383 | + $hof = & $hof[$type]; |
|
384 | 384 | } |
385 | 385 | $hof = $this->db->getFloat('amount'); |
386 | 386 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 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 | + $damage = & $this->getModifiedDamage(); |
|
136 | 136 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100); |
137 | 137 | $damage['Kamikaze'] = 0; |
138 | 138 | if ($weaponPlayer->isCombatDronesKamikazeOnMines()) { // If kamikaze then damage is same as MINE_ARMOUR |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
157 | 157 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
158 | 158 | } |
159 | - $damage =& $this->getModifiedDamage(); |
|
159 | + $damage = & $this->getModifiedDamage(); |
|
160 | 160 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100); |
161 | 161 | $damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']); |
162 | 162 | $damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
171 | 171 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
172 | 172 | } |
173 | - $damage =& $this->getModifiedDamage(); |
|
173 | + $damage = & $this->getModifiedDamage(); |
|
174 | 174 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100); |
175 | 175 | $planetMod = self::PLANET_DAMAGE_MOD; |
176 | 176 | $damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage'] * $planetMod); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
186 | 186 | return $return; |
187 | 187 | } |
188 | - $damage =& $this->getModifiedDamage(); |
|
188 | + $damage = & $this->getModifiedDamage(); |
|
189 | 189 | if ($targetPlayer->getShip()->hasDCS()) { |
190 | 190 | $damage['MaxDamage'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT; |
191 | 191 | $damage['Shield'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
204 | 204 | return $return; |
205 | 205 | } |
206 | - $damage =& $this->getModifiedDamage(); |
|
206 | + $damage = & $this->getModifiedDamage(); |
|
207 | 207 | |
208 | 208 | if ($targetPlayer->getShip()->hasDCS()) { |
209 | 209 | $damage['MaxDamage'] *= DCS_FORCE_DAMAGE_DECIMAL_PERCENT; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
224 | 224 | return $return; |
225 | 225 | } |
226 | - $damage =& $this->getModifiedDamage(); |
|
226 | + $damage = & $this->getModifiedDamage(); |
|
227 | 227 | |
228 | 228 | if ($targetPlayer->getShip()->hasDCS()) { |
229 | 229 | $damage['MaxDamage'] *= DCS_PORT_DAMAGE_DECIMAL_PERCENT; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
243 | 243 | return $return; |
244 | 244 | } |
245 | - $damage =& $this->getModifiedDamage(); |
|
245 | + $damage = & $this->getModifiedDamage(); |
|
246 | 246 | |
247 | 247 | if ($targetPlayer->getShip()->hasDCS()) { |
248 | 248 | $damage['MaxDamage'] *= DCS_PLANET_DAMAGE_DECIMAL_PERCENT; |