Completed
Push — work-fleets ( ff9274...a405f7 )
by SuperNova.WS
06:32
created
includes/includes/flt_page5.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 *
13 13
 **/
14 14
 
15
-if(SN_IN_FLEET !== true) {
15
+if (SN_IN_FLEET !== true) {
16 16
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
   $planet_list = array();
27 27
 
28
-  if(is_array($resources_taken))
28
+  if (is_array($resources_taken))
29 29
   {
30 30
     $query = implode(',', array_keys($resources_taken));
31 31
     $query = " AND `destruyed` = 0 AND `id` IN ({$query})";
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
     $query = '';
34 34
   }
35 35
 
36
-  foreach(sn_get_groups('flt_transports') as $transport_id) {
36
+  foreach (sn_get_groups('flt_transports') as $transport_id) {
37 37
     $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY);
38 38
   }
39 39
   arsort($transports);
40 40
 
41 41
   $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query);
42 42
   !is_array($planets_db_list) ? $planets_db_list = array() : false;
43
-  foreach($planets_db_list as $planet_db_data) {
43
+  foreach ($planets_db_list as $planet_db_data) {
44 44
   // begin planet loop
45
-    if(!$query) {
45
+    if (!$query) {
46 46
       $resources_taken[$planet_db_data['id']] = 1;
47 47
     }
48 48
     sn_db_transaction_start();
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     $planet_id = $planet_db_data['id'];
55 55
 
56 56
     $planet_resources = 0;
57
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
58
-      if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
57
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
58
+      if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
59 59
         $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]);
60 60
       }
61 61
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     $fleet_capacity = 0;
87 87
     $ship_loadout = array();
88 88
     $fleet = array();
89
-    foreach($transports as $ship_id => $ship_capacity) {
90
-      if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
89
+    foreach ($transports as $ship_id => $ship_capacity) {
90
+      if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
91 91
         $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity;
92 92
         $ship_loadout[$ship_id]['taken'] = 0;
93 93
         $fleet_capacity += $ship_loadout[$ship_id]['capacity'];
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
     $will_take = min($planet_resources, $fleet_capacity);
100 100
 
101
-    foreach($ship_loadout as $ship_id => &$planet_ship) {
101
+    foreach ($ship_loadout as $ship_id => &$planet_ship) {
102 102
       $can_take = min($will_take, $planet_ship['capacity']);
103
-      if($can_take <= 0) {
103
+      if ($can_take <= 0) {
104 104
         continue;
105 105
       }
106 106
       $planet_ship['capacity'] -= $can_take;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
       $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]);
109 109
 
110 110
       $will_take -= $can_take;
111
-      if($will_take <= 0) {
111
+      if ($will_take <= 0) {
112 112
         break;
113 113
       }
114 114
     }
115 115
 
116
-    if(!empty($fleet)) {
116
+    if (!empty($fleet)) {
117 117
       $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10);
118 118
       $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed'];
119 119
       $planet_data['DISTANCE']    = $travel_data['distance'];
120 120
       $planet_data['DURATION']    = $travel_data['duration'];
121 121
       $planet_data['CONSUMPTION'] = $travel_data['consumption'];
122 122
 
123
-      if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
123
+      if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
124 124
         $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION'];
125 125
 
126
-        foreach(sn_get_groups('resources_loot') as $resource_id) {
127
-          if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
126
+        foreach (sn_get_groups('resources_loot') as $resource_id) {
127
+          if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
128 128
             continue;
129 129
           }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
           $fleet[$resource_id] = min($will_take, $resource_amount);
134 134
           $will_take -= $resource_amount;
135 135
 
136
-          if($will_take <= 0) {
136
+          if ($will_take <= 0) {
137 137
             break;
138 138
           }
139 139
         }
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 
158 158
 $resources_taken = sys_get_param('resources');
159 159
 
160
-if(!empty($resources_taken))  { // begin processing parameters
160
+if (!empty($resources_taken)) { // begin processing parameters
161 161
   $planet_list = flt_build_gathering($resources_taken);
162 162
 
163
-  foreach($planet_list as $planet_id => $planet_data) {
164
-    if($planet_data['RESULT'] == FLIGHT_ALLOWED) {
163
+  foreach ($planet_list as $planet_id => $planet_data) {
164
+    if ($planet_data['RESULT'] == FLIGHT_ALLOWED) {
165 165
       $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT);
166 166
     }
167 167
 
168 168
     $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']];
169 169
 
170 170
     $template->assign_block_vars('results', $planet_data);
171
-    if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
-      foreach($planet_data['FLEET'] as $unit_id => $amount) {
171
+    if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
+      foreach ($planet_data['FLEET'] as $unit_id => $amount) {
173 173
         $template->assign_block_vars('results.units', array(
174 174
           'ID'     => $unit_id,
175 175
           'NAME'   => classLocale::$lang['tech'][$unit_id],
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 // Building list of own planets & moons
184 184
 $planet_list = flt_build_gathering();
185
-foreach($planet_list as $planet_data) {
185
+foreach ($planet_list as $planet_data) {
186 186
   $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel'];
187 187
   $template->assign_block_vars('colonies', $planet_data);
188 188
 }
Please login to merge, or discard this patch.
includes/functions/int_fleet_events.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
   $fleet_events = array();
7 7
   $fleet_number = 0;
8 8
 
9
-  if($objFleetList->count() <= 0) {
9
+  if ($objFleetList->count() <= 0) {
10 10
     return;
11 11
   }
12 12
 
13
-  foreach($objFleetList->_container as $objFleet) {
13
+  foreach ($objFleetList->_container as $objFleet) {
14 14
     $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET;
15 15
     $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name');
16 16
     $objFleet->fleet_start_name = $planet_start['name'];
17 17
 
18 18
     $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET;
19
-    if($objFleet->fleet_end_planet > Vector::$knownPlanets) {
19
+    if ($objFleet->fleet_end_planet > Vector::$knownPlanets) {
20 20
       $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration'];
21
-    } elseif($objFleet->mission_type == MT_COLONIZE) {
21
+    } elseif ($objFleet->mission_type == MT_COLONIZE) {
22 22
       $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization'];
23 23
     } else {
24 24
       $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name');
25 25
       $objFleet->fleet_end_name = $planet_end['name'];
26 26
     }
27 27
 
28
-    if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
28
+    if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
29 29
       ($planet_scanned === false
30 30
         ||
31 31
         (
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
       $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type);
40 40
     }
41 41
 
42
-    if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
42
+    if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
43 43
       $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type);
44 44
     }
45 45
 
46
-    if(
46
+    if (
47 47
       $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) &&
48 48
       (
49 49
         ($planet_scanned === false && $objFleet->playerOwnerId == $user['id'])
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
       $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type);
60 60
     }
61 61
 
62
-    if($objFleet->mission_type == MT_MISSILE) {
62
+    if ($objFleet->mission_type == MT_MISSILE) {
63 63
       $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type);
64 64
     }
65 65
   }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
   $is_this_planet = false;
81 81
 
82
-  switch($objFleet->ov_label = $ov_label) {
82
+  switch ($objFleet->ov_label = $ov_label) {
83 83
     case 0:
84 84
       $objFleet->event_time = $objFleet->time_arrive_to_target;
85 85
       $is_this_planet = (
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
   }
112 112
 
113
-  $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false;
113
+  $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false;
114 114
 
115
-  if($objFleet->playerOwnerId == $user['id']) {
115
+  if ($objFleet->playerOwnerId == $user['id']) {
116 116
     $user_data = $user;
117 117
   } else {
118 118
     $user_data = db_user_by_id($objFleet->playerOwnerId);
Please login to merge, or discard this patch.
fleet.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 // TODO - Переместить это куда-нибудь
9 9
 $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode'));
10
-if($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) {
10
+if ($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) {
11 11
   define('IN_AJAX', true);
12
-  if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
12
+  if (!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
13 13
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
14 14
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
15 15
     classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 $objFleet5->initDefaults($user, $planetrow, $targetVector, $target_mission, $ships, $fleet_group_mr, $speed_percent);
43 43
 
44 44
 
45
-switch($fleet_page) {
45
+switch ($fleet_page) {
46 46
   case 1:
47 47
     $objFleet5->fleetPage1();
48 48
   break;
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($unit_crossfire_result as $key => $value)
64
+  foreach ($unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
includes/vars/vars_mission_checks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
   'checkSpeedPercentOld'       => FLIGHT_FLEET_SPEED_WRONG,
11 11
   'checkTargetInUniverse'      => FLIGHT_VECTOR_BEYOND_UNIVERSE,
12 12
   'checkTargetNotSource'       => FLIGHT_VECTOR_SAME_SOURCE,
13
-  'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN,  // tODO
13
+  'checkSenderNoVacation'      => FLIGHT_PLAYER_VACATION_OWN, // tODO
14 14
   'checkTargetNoVacation'      => FLIGHT_PLAYER_VACATION,
15 15
   'checkFleetNotEmpty'         => FLIGHT_SHIPS_NO_SHIPS,
16 16
   // 'checkUnitsPositive'         => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class
Please login to merge, or discard this patch.
includes/vars/vars_structures.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
       'factor' => 1.5,
16 16
     ),
17 17
     P_UNIT_PRODUCTION => array(
18
-      RES_METAL     => function ($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
19
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
18
+      RES_METAL     => function($level, $production_factor, $user, $planet_row) {return  40 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
19
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
20 20
     ),
21 21
     P_MINING_IS_MANAGED => true,
22 22
   ),
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
       'factor' => 1.6,
34 34
     ),
35 35
     P_UNIT_PRODUCTION => array(
36
-      RES_CRYSTAL   => function ($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
37
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
36
+      RES_CRYSTAL   => function($level, $production_factor, $user, $planet_row) {return  32 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
37
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
38 38
     ),
39 39
     P_MINING_IS_MANAGED => true,
40 40
   ),
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
       'factor' => 1.5,
52 52
     ),
53 53
     P_UNIT_PRODUCTION => array(
54
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);},
55
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
54
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return  10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); },
55
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
56 56
     ),
57 57
     P_MINING_IS_MANAGED => true,
58 58
   ),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
       'factor' => 1.5,
70 70
     ),
71 71
     P_UNIT_PRODUCTION => array(
72
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);},
72
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); },
73 73
     ),
74 74
     P_MINING_IS_MANAGED => true,
75 75
   ),
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
       'factor' => 1.8,
88 88
     ),
89 89
     P_UNIT_PRODUCTION => array(
90
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);},
91
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);},
90
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
91
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) {return  30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); },
92 92
     ),
93 93
     P_MINING_IS_MANAGED => true,
94 94
   ),
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
       'factor' => 2,
106 106
     ),
107 107
     'storage' => array(
108
-      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
108
+      RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
109 109
     ),
110 110
   ),
111 111
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
       'factor' => 2,
122 122
     ),
123 123
     'storage' => array(
124
-      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
124
+      RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
125 125
     ),
126 126
   ),
127 127
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       'factor' => 2,
138 138
     ),
139 139
     'storage' => array(
140
-      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);},
140
+      RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); },
141 141
     ),
142 142
   ),
143 143
 
Please login to merge, or discard this patch.
includes/vars/vars_combats.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     'shield' => 10,
36 36
     'armor' => 400,
37 37
     'attack' => 5,
38
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
38
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
39 39
   ),
40 40
   SHIP_CARGO_BIG => array(
41 41
     'name' => 'big_ship_cargo',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     'shield' => 25,
56 56
     'armor' => 1200,
57 57
     'attack' => 5,
58
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
58
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
59 59
     'engine' => array(
60 60
       array(
61 61
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     'shield' => 50,
84 84
     'armor' => 3000,
85 85
     'attack' => 10,
86
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
86
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
87 87
     'engine' => array(
88 88
       array(
89 89
         'tech' => TECH_ENGINE_ION,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     'shield' => 200,
112 112
     'armor' => 70000,
113 113
     'attack' => 50,
114
-    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250, ),
114
+    'amplify' => array(SHIP_SPY => 100, SHIP_SATTELITE_SOLAR => 250,),
115 115
     'engine' => array(
116 116
       array(
117 117
         'tech' => TECH_ENGINE_HYPER,
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     'shield' => 100,
141 141
     'armor' => 3000,
142 142
     'attack' => 50,
143
-    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
143
+    'amplify' => array(SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
144 144
     'engine' => array(
145 145
       array(
146 146
         'tech' => TECH_ENGINE_ION,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     'shield' => 10,
169 169
     'armor' => 1600,
170 170
     'attack' => 1,
171
-    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050, ),
171
+    'amplify' => array(SHIP_SPY => 500.05, SHIP_SATTELITE_SOLAR => 1050,),
172 172
     'engine' => array(
173 173
       array(
174 174
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'shield' =>  0.01,
197 197
     'armor' => 100,
198 198
     'attack' =>  0.01,
199
-    'amplify' => array( SHIP_SPY => 1,),
199
+    'amplify' => array(SHIP_SPY => 1,),
200 200
     'engine' => array(
201 201
       array(
202 202
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
       'factor' => 1,
221 221
     ),
222 222
     P_UNIT_PRODUCTION => array(
223
-      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor);},
223
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); },
224 224
     ),
225 225
     P_MINING_IS_MANAGED => true,
226 226
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     'shield' => 10,
230 230
     'armor' => 200,
231 231
     'attack' => 1,
232
-    'amplify' => array(SHIP_SPY => 1, ),
232
+    'amplify' => array(SHIP_SPY => 1,),
233 233
     'engine' => array(
234 234
       array(
235 235
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     'shield' => 10,
262 262
     'armor' => 400,
263 263
     'attack' => 50,
264
-    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21, ),
264
+    'amplify' => array(SHIP_CARGO_SMALL => 16.4, SHIP_SPY => 10.001, SHIP_SATTELITE_SOLAR => 21,),
265 265
     'engine' => array(
266 266
       array(
267 267
         'tech' => TECH_ENGINE_CHEMICAL,
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     'shield' => 25,
291 291
     'armor' => 1000,
292 292
     'attack' => 150,
293
-    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7, ),
293
+    'amplify' => array(SHIP_CARGO_SMALL => 8.2, SHIP_SPY => 3.33367, SHIP_SATTELITE_SOLAR => 7,),
294 294
     'engine' => array(
295 295
       array(
296 296
         'tech' => TECH_ENGINE_ION,
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     'shield' =>  50,
350 350
     'armor' => 2700,
351 351
     'attack' => 400,
352
-    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5, ),
352
+    'amplify' => array(SHIP_SMALL_FIGHTER_LIGHT => 6.15, SHIP_SPY => 1.25013, SHIP_SATTELITE_SOLAR => 2.625, UNIT_DEF_TURRET_MISSILE => 5.5,),
353 353
     'engine' => array(
354 354
       array(
355 355
         'tech' => TECH_ENGINE_ION,
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     'shield' =>  200,
409 409
     'armor' =>  6000,
410 410
     'attack' => 1000,
411
-    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76, ),
411
+    'amplify' => array(SHIP_SPY => 0.50005, SHIP_SATTELITE_SOLAR => 1.05, UNIT_DEF_TURRET_MISSILE => 1.76,),
412 412
     'engine' => array(
413 413
       array(
414 414
         'tech' => TECH_ENGINE_HYPER,
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     'shield' =>  500,
505 505
     'armor' => 11000,
506 506
     'attack' => 2000,
507
-    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125, ),
507
+    'amplify' => array(SHIP_SPY => 0.25003, SHIP_SATTELITE_SOLAR => 0.525, SHIP_LARGE_BATTLESHIP => 7.4, UNIT_DEF_TURRET_LASER_SMALL => 1.125,),
508 508
     'engine' => array(
509 509
       array(
510 510
         'tech' => TECH_ENGINE_HYPER,
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     'shield' => 20,
609 609
     'armor' => 200,
610 610
     'attack' => 80,
611
-    'amplify' => array(SHIP_SPY => 7, ),
611
+    'amplify' => array(SHIP_SPY => 7,),
612 612
   ),
613 613
   UNIT_DEF_TURRET_LASER_SMALL => array(
614 614
     'name' => 'small_laser',
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     'shield' => 25,
627 627
     'armor' => 200,
628 628
     'attack' => 100,
629
-    'amplify' => array(SHIP_SPY => 5, ),
629
+    'amplify' => array(SHIP_SPY => 5,),
630 630
   ),
631 631
   UNIT_DEF_TURRET_LASER_BIG => array(
632 632
     'name' => 'big_laser',
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     'shield' => 100,
645 645
     'armor' => 800,
646 646
     'attack' => 250,
647
-    'amplify' => array(SHIP_SPY => 2, ),
647
+    'amplify' => array(SHIP_SPY => 2,),
648 648
   ),
649 649
   UNIT_DEF_TURRET_GAUSS => array(
650 650
     'name' => 'gauss_canyon',
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
     'armor' => 3500,
663 663
     'shield' => 200,
664 664
     'attack' => 1100,
665
-    'amplify' => array(SHIP_SPY => 0.5, ),
665
+    'amplify' => array(SHIP_SPY => 0.5,),
666 666
   ),
667 667
   UNIT_DEF_TURRET_ION => array(
668 668
     'name' => 'ionic_canyon',
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     'shield' => 500,
681 681
     'armor' => 800,
682 682
     'attack' => 150,
683
-    'amplify' => array(SHIP_SPY => 3.3, ),
683
+    'amplify' => array(SHIP_SPY => 3.3,),
684 684
   ),
685 685
   UNIT_DEF_TURRET_PLASMA => array(
686 686
     'name' => 'buster_canyon',
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
     'shield' => 300,
699 699
     'armor' => 10000,
700 700
     'attack' => 3000,
701
-    'amplify' => array(SHIP_SPY => 0.17, ),
701
+    'amplify' => array(SHIP_SPY => 0.17,),
702 702
   ),
703 703
 
704 704
   UNIT_DEF_SHIELD_SMALL => array(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     'shield' => 2000,
719 719
     'armor' => 2000,
720 720
     'attack' => 1,
721
-    'amplify' => array(SHIP_SPY => 500, ),
721
+    'amplify' => array(SHIP_SPY => 500,),
722 722
   ),
723 723
   UNIT_DEF_SHIELD_BIG => array(
724 724
     'name' => 'big_protection_shield',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     'shield' => 2000,
738 738
     'armor' => 10000,
739 739
     'attack' => 1,
740
-    'amplify' => array(SHIP_SPY => 500, ),
740
+    'amplify' => array(SHIP_SPY => 500,),
741 741
   ),
742 742
   UNIT_DEF_SHIELD_PLANET => array(
743 743
     'name'      => 'planet_protector',
Please login to merge, or discard this patch.
includes/alliance/ali_external_search.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7 7
 $template = gettemplate('ali_search', true);
8 8
 
9 9
 $ali_search_text = sys_get_param_str('searchtext');
10
-if($ali_search_text) {
10
+if ($ali_search_text) {
11 11
   $template->assign_var('SEARCH_TEXT', $ali_search_text);
12 12
 
13 13
   $search = DBStaticAlly::db_ally_search_by_name_or_tag($ali_search_text);
14
-  if(classSupernova::$db->db_num_rows($search)) {
15
-    while($ally_row = db_fetch($search)) {
14
+  if (classSupernova::$db->db_num_rows($search)) {
15
+    while ($ally_row = db_fetch($search)) {
16 16
       $template->assign_block_vars('alliances', array(
17 17
         'ID'          => $ally_row['id'],
18 18
         'TAG'         => $ally_row['ally_tag'],
Please login to merge, or discard this patch.
includes/includes/market_trader.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
3
+if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) {
4 4
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
   // $dm_db_name = pname_resource_name(RES_DARK_MATTER);
28 28
   $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0;
29
-  if($exchangeTo && is_array($tradeList = $_POST['spend'])) {
29
+  if ($exchangeTo && is_array($tradeList = $_POST['spend'])) {
30 30
     $value = 0;
31 31
 
32 32
     sn_db_transaction_start();
33
-    if($planetrow['id_owner']) {
33
+    if ($planetrow['id_owner']) {
34 34
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
35 35
       $planetrow = $global_data['planet'];
36 36
     }
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     $fields = array();
43
-    foreach(sn_get_groups('resources_trader') as $resource_id) {
43
+    foreach (sn_get_groups('resources_trader') as $resource_id) {
44 44
       $amount = floatval($tradeList[$resource_id]);
45
-      if($amount < 0) {
45
+      if ($amount < 0) {
46 46
         classSupernova::$debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305);
47 47
       }
48 48
 
49
-      if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
49
+      if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) {
50 50
         continue;
51 51
       }
52 52
 
53 53
       $sign = '+';
54
-      if($exchangeTo == RES_DARK_MATTER) {
54
+      if ($exchangeTo == RES_DARK_MATTER) {
55 55
         $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]);
56 56
         $value += $amount;
57 57
       } else {
58 58
         $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]);
59
-        if($resource_id == RES_DARK_MATTER) {
59
+        if ($resource_id == RES_DARK_MATTER) {
60 60
           $amount = 0;
61 61
         } else {
62
-          if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
62
+          if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) {
63 63
             $intError = MARKET_NO_RESOURCES;
64 64
             break;
65 65
           }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
       }
70 70
 
71
-      if($amount) {
71
+      if ($amount) {
72 72
         $fields[pname_resource_name($resource_id)] = "{$sign} {$amount}";
73 73
       }
74 74
     }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
     $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError;
79 79
     $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError;
80 80
 
81
-    if($intError == MARKET_DEAL) {
82
-      if($exchangeTo != RES_DARK_MATTER) {
81
+    if ($intError == MARKET_DEAL) {
82
+      if ($exchangeTo != RES_DARK_MATTER) {
83 83
         $amountExchangeTo = floor($value);
84 84
         $fields[pname_resource_name($exchangeTo)] = $amountExchangeTo;
85 85
       }
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
     'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo,
116 116
   ));
117 117
 
118
-  foreach(sn_get_groups('resources_trader') as $resource_id) {
119
-    if($resource_id == RES_DARK_MATTER) {
118
+  foreach (sn_get_groups('resources_trader') as $resource_id) {
119
+    if ($resource_id == RES_DARK_MATTER) {
120 120
       $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - classSupernova::$config->rpg_cost_trader);
121 121
     } else {
122 122
       $amount = floor(mrc_get_level($user, $planetrow, $resource_id));
Please login to merge, or discard this patch.