Completed
Push — work-fleets ( 21e5a3...e0f70d )
by SuperNova.WS
05:07
created
jumpgate.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@  discard block
 block discarded – undo
14 14
 
15 15
 lng_include('fleet');
16 16
 
17
-if($TargetPlanet = sys_get_param_id('jmpto'))
17
+if ($TargetPlanet = sys_get_param_id('jmpto'))
18 18
 {
19 19
   sn_db_transaction_start();
20 20
   db_user_by_id($user['id'], true, 'id');
21 21
   $planetrow = db_planet_by_id($planetrow['id'], true);
22
-  if(!($NextJumpTime = uni_get_time_to_jump($planetrow)))
22
+  if (!($NextJumpTime = uni_get_time_to_jump($planetrow)))
23 23
   {
24 24
     $TargetGate = db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
25
-    if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
25
+    if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
26 26
     {
27
-      $NextDestTime = uni_get_time_to_jump ( $TargetGate );
28
-      if(!$NextDestTime)
27
+      $NextDestTime = uni_get_time_to_jump($TargetGate);
28
+      if (!$NextDestTime)
29 29
       {
30 30
         // $SubQueryOri = "";
31 31
         // $SubQueryDes = "";
32 32
         $ship_list = sys_get_param('ships');
33 33
         $db_changeset = array();
34
-        foreach($ship_list as $ship_id => $ship_count)
34
+        foreach ($ship_list as $ship_id => $ship_count)
35 35
         {
36
-          if(!in_array($ship_id, sn_get_groups('fleet')))
36
+          if (!in_array($ship_id, sn_get_groups('fleet')))
37 37
           {
38 38
             continue;
39 39
           }
40 40
 
41 41
           $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
42
-          if($ship_count)
42
+          if ($ship_count)
43 43
           {
44 44
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, -$ship_count, $user, $planetrow['id']);
45 45
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, $ship_count, $user, $TargetGate['id']);
46 46
           }
47 47
         }
48 48
         // Dit monsieur, y avait quelque chose a envoyer ???
49
-        if(!empty($db_changeset))
49
+        if (!empty($db_changeset))
50 50
         {
51 51
           db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
52 52
           db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
@@ -55,31 +55,31 @@  discard block
 block discarded – undo
55 55
           db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'");
56 56
 
57 57
           $planetrow['last_jump_time'] = SN_TIME_NOW;
58
-          $RetMessage = classLocale::$lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow));
58
+          $RetMessage = classLocale::$lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow));
59 59
         } else {
60 60
           $RetMessage = classLocale::$lang['gate_wait_data'];
61 61
         }
62 62
       } else {
63
-        $RetMessage = classLocale::$lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime);
63
+        $RetMessage = classLocale::$lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime);
64 64
       }
65 65
     } else {
66 66
       $RetMessage = classLocale::$lang['gate_no_dest_g'];
67 67
     }
68 68
   } else {
69
-    $RetMessage = classLocale::$lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime);
69
+    $RetMessage = classLocale::$lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
70 70
   }
71 71
   sn_db_transaction_commit();
72 72
   message($RetMessage, classLocale::$lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
73 73
 } else {
74 74
   $template = gettemplate('jumpgate', true);
75
-  if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
75
+  if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
76 76
   {
77 77
     $Combo = '';
78 78
     $MoonList = db_planet_list_moon_other($user['id'], $planetrow['id']);
79 79
     // while($CurMoon = db_fetch($MoonList))
80
-    foreach($MoonList as $CurMoon)
80
+    foreach ($MoonList as $CurMoon)
81 81
     {
82
-      if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
82
+      if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
83 83
       {
84 84
         $NextJumpTime = uni_get_time_to_jump($CurMoon);
85 85
         $template->assign_block_vars('moon', array(
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
       }
94 94
     }
95 95
 
96
-    foreach(sn_get_groups('fleet') as $Ship)
96
+    foreach (sn_get_groups('fleet') as $Ship)
97 97
     {
98
-      if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
98
+      if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
99 99
       {
100 100
         continue;
101 101
       }
Please login to merge, or discard this patch.
simulator.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
   $sym_defender = $unpacked['D'];
23 23
   $sym_attacker = $unpacked['A'];
24
-}
25
-else
24
+} else
26 25
 {
27 26
   $sym_defender = array(0 => $sym_defender);
28 27
   $sym_attacker = array(1 => $sym_attacker);
@@ -56,8 +55,7 @@  discard block
 block discarded – undo
56 55
   $template = gettemplate('ube_combat_report', true);
57 56
   $template->assign_recursive($template_result);
58 57
   display($template, '', false, '', false, false, true);
59
-}
60
-else
58
+} else
61 59
 {
62 60
   $template = gettemplate('simulator', true);
63 61
   $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if(sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG'))
5
+if (sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG'))
6 6
 {
7 7
   define('BE_DEBUG', true);
8 8
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $sym_defender = $_POST['defender'] ? $_POST['defender'] : array();
15 15
 $sym_attacker = $_POST['attacker'] ? $_POST['attacker'] : array();
16 16
 
17
-if($replay)
17
+if ($replay)
18 18
 {
19 19
   $unpacked = sn_ube_simulator_decode_replay($replay);
20 20
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
   $sym_attacker = array(1 => $sym_attacker);
28 28
 }
29 29
 
30
-if($_POST['submit'] || $execute)
30
+if ($_POST['submit'] || $execute)
31 31
 {
32 32
   $replay = sn_ube_simulator_encode_replay($sym_defender, 'D');
33 33
   $replay .= sn_ube_simulator_encode_replay($sym_attacker, 'A');
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
   $template = gettemplate('simulator', true);
41 41
   $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL);
42 42
 
43
-  foreach($techs_and_officers as $tech_id)
43
+  foreach ($techs_and_officers as $tech_id)
44 44
   {
45
-    if(!$sym_attacker[1][$tech_id])
45
+    if (!$sym_attacker[1][$tech_id])
46 46
     {
47 47
       $sym_attacker[1][$tech_id] = mrc_get_level($user, false, $tech_id);
48 48
     }
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
     UNIT_GOVERNORS => array(MRC_FORTIFIER),
57 57
     UNIT_DEFENCE => sn_get_groups('defense_active'),
58 58
   );
59
-  foreach($show_groups as $unit_group_id => $unit_group)
59
+  foreach ($show_groups as $unit_group_id => $unit_group)
60 60
   {
61 61
     $template->assign_block_vars('simulator', array(
62 62
       'GROUP' => $unit_group_id,
63 63
       'NAME' => $lang['tech'][$unit_group_id],
64 64
     ));
65 65
 
66
-    foreach($unit_group as $unit_id)
66
+    foreach ($unit_group as $unit_id)
67 67
     {
68 68
       $tab++;
69 69
 
Please login to merge, or discard this patch.
login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
 include('includes/init.' . substr(strrchr(__FILE__, '.'), 1));
17 17
 // die();
18
-if($template_result[F_USER_IS_AUTHORIZED]) {
18
+if ($template_result[F_USER_IS_AUTHORIZED]) {
19 19
   sys_redirect('index' . DOT_PHP_EX);
20 20
 }
21 21
 lng_include('login');
Please login to merge, or discard this patch.
market.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $newstock = $stock;
27 27
 $intError = MARKET_DEAL;
28 28
 
29
-switch($mode)
29
+switch ($mode)
30 30
 {
31 31
   case MARKET_RESOURCES: // Resource trader
32 32
     require('includes/includes/market_trader.inc');
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 }
83 83
 
84 84
 $message_id = sys_get_param_int('message');
85
-if($message_id != MARKET_NOTHING)
85
+if ($message_id != MARKET_NOTHING)
86 86
 {
87 87
   $template->assign_block_vars('result', array('MESSAGE' => $lang['eco_mrk_errors'][$message_id]));
88 88
 }
89 89
 
90
-if($message)
90
+if ($message)
91 91
 {
92 92
   $template->assign_block_vars('result', array('MESSAGE' => $message));
93 93
 }
Please login to merge, or discard this patch.
language/en/system.mo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -961,7 +961,7 @@
 block discarded – undo
961 961
     REGISTER_ERROR_USERNAME_WRONG => 'Некорректное имя игрока',
962 962
     REGISTER_ERROR_ACCOUNT_NAME_EXISTS => 'Имя учётной записи уже занято. Попробуйте войти с этим именем и вашим паролем или воспользоваться сбросом пароля',
963 963
     REGISTER_ERROR_PASSWORD_INSECURE => 'Неправильный пароль. Пароль должен состоять минимум из ' . PASSWORD_LENGTH_MIN . ' символов',
964
-    REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из ' . LOGIN_LENGTH_MIN. ' символов',
964
+    REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из ' . LOGIN_LENGTH_MIN . ' символов',
965 965
     REGISTER_ERROR_PASSWORD_DIFFERENT => 'Пароль и проверочный пароль не совпадают. Проверьте правильность ввода',
966 966
     REGISTER_ERROR_EMAIL_EMPTY => 'Е-Мейл не может быть пустым',
967 967
     REGISTER_ERROR_EMAIL_WRONG => 'Введенный Е-Мейл не является допустимым адресом электронной почты. Проверьте написание Е-Мейла или используйте другой адрес почтового ящика',
Please login to merge, or discard this patch.
admin/planet_compensate.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('INSIDE'  , true);
3
-define('INSTALL' , false);
2
+define('INSIDE', true);
3
+define('INSTALL', false);
4 4
 define('IN_ADMIN', true);
5 5
 
6 6
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
7 7
 
8
-if($user['authlevel'] < 3)
8
+if ($user['authlevel'] < 3)
9 9
 {
10 10
   AdminMessage(classLocale::$lang['adm_err_denied']);
11 11
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $username_unsafe = sys_get_param_str_unsafe('username');
26 26
 $username = sys_get_param_escaped('username');
27 27
 
28
-if($galaxy_src)
28
+if ($galaxy_src)
29 29
 {
30 30
   sn_db_transaction_start();
31 31
   $errors = array();
@@ -35,41 +35,41 @@  discard block
 block discarded – undo
35 35
   $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW);
36 36
   $que    = $planet['que'];
37 37
   $planet = $planet['planet'];
38
-  if(!$planet)
38
+  if (!$planet)
39 39
   {
40 40
     $errors[] = classLocale::$lang['adm_pl_comp_err_0'];
41 41
   }
42 42
 
43
-  if($planet['destruyed'])
43
+  if ($planet['destruyed'])
44 44
   {
45 45
     $errors[] = classLocale::$lang['adm_pl_comp_err_1'];
46 46
   }
47 47
 
48
-  if($planet['id_owner'] != $owner['id'] || !$username)
48
+  if ($planet['id_owner'] != $owner['id'] || !$username)
49 49
   {
50 50
     $errors[] = classLocale::$lang['adm_pl_comp_err_4'];
51 51
   }
52 52
 
53 53
   $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW);
54 54
   $destination = $destination['planet'];
55
-  if(!$destination)
55
+  if (!$destination)
56 56
   {
57 57
     $errors[] = classLocale::$lang['adm_pl_comp_err_2'];
58 58
   }
59 59
 
60
-  if($planet['id'] == $destination['id'])
60
+  if ($planet['id'] == $destination['id'])
61 61
   {
62 62
     $errors[] = classLocale::$lang['adm_pl_comp_err_5'];
63 63
   }
64 64
 
65
-  if($planet['id_owner'] != $destination['id_owner'])
65
+  if ($planet['id_owner'] != $destination['id_owner'])
66 66
   {
67 67
     $errors[] = classLocale::$lang['adm_pl_comp_err_3'];
68 68
   }
69 69
 
70
-  if(!empty($errors))
70
+  if (!empty($errors))
71 71
   {
72
-    foreach($errors as $error)
72
+    foreach ($errors as $error)
73 73
     {
74 74
       $template->assign_block_vars('error', array(
75 75
         'TEXT' => $error,
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
     killer_add_planet($planet);
84 84
 
85 85
     $moon = db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true);
86
-    if($moon)
86
+    if ($moon)
87 87
     {
88 88
       $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW);
89 89
       $moon = $moon['planet'];
90 90
       killer_add_planet($moon);
91 91
     }
92 92
 
93
-    foreach(sn_get_groups('resources_loot') as $resource_id)
93
+    foreach (sn_get_groups('resources_loot') as $resource_id)
94 94
     {
95 95
       $resource_name = pname_resource_name($resource_id);
96 96
       $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
       $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]);
99 99
     }
100 100
 
101
-    if($_GET['btn_confirm'])
101
+    if ($_GET['btn_confirm'])
102 102
     {
103 103
       $time = SN_TIME_NOW + PERIOD_DAY;
104 104
 
105 105
       db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']);
106 106
       db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}");
107
-      if($moon)
107
+      if ($moon)
108 108
       {
109 109
         db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']);
110 110
         db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}");
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   'username' => $username,
132 132
 ));
133 133
 
134
-display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true );
134
+display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true);
135 135
 
136 136
 function killer_add_planet($planet)
137 137
 {
@@ -146,34 +146,34 @@  discard block
 block discarded – undo
146 146
   }
147 147
   */
148 148
 
149
-  foreach(sn_get_groups('structures') as $unit_id)
149
+  foreach (sn_get_groups('structures') as $unit_id)
150 150
   {
151 151
     $build_level = mrc_get_level($user, $planet, $unit_id, true, true);
152
-    if($build_level > 0)
152
+    if ($build_level > 0)
153 153
     {
154 154
       $unit_cost = get_unit_param($unit_id, 'cost');
155 155
       $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor'];
156
-      foreach($sn_group_resources_loot as $resource_id)
156
+      foreach ($sn_group_resources_loot as $resource_id)
157 157
       {
158 158
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0;
159 159
       }
160 160
     }
161 161
   }
162 162
 
163
-  foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id)
163
+  foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id)
164 164
   {
165 165
     $unit_count = mrc_get_level($user, $planet, $unit_id, true, true);
166
-    if($unit_count > 0)
166
+    if ($unit_count > 0)
167 167
     {
168 168
       $unit_cost = get_unit_param($unit_id, 'cost');
169
-      foreach($sn_group_resources_loot as $resource_id)
169
+      foreach ($sn_group_resources_loot as $resource_id)
170 170
       {
171 171
         $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0;
172 172
       }
173 173
     }
174 174
   }
175 175
 
176
-  foreach($sn_group_resources_loot as $resource_id)
176
+  foreach ($sn_group_resources_loot as $resource_id)
177 177
   {
178 178
     $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true));
179 179
   }
Please login to merge, or discard this patch.
includes/functions/flt_mission_missile.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
   $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET);
15 15
   $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100));
16
-  foreach($structures as $key => $structure)
16
+  foreach ($structures as $key => $structure)
17 17
   {
18 18
     $unit_info = get_unit_param($key);
19 19
     $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1;
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
   {
32 32
     //attacking only selected structure
33 33
     $damageDone = $structures[$targetedStructure][$damageTo];
34
-    $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] );
34
+    $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]);
35 35
     $structures[$targetedStructure][0] -= $structsDestroyed;
36
-    $MIPDamage -= $structsDestroyed*$damageDone;
36
+    $MIPDamage -= $structsDestroyed * $damageDone;
37 37
   }
38 38
   else
39 39
   {
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
     do
45 45
     {
46 46
       // finding is there any structure that can be damaged with leftovers of $MIPDamage
47
-      foreach($can_be_damaged as $key => $unit_id)
47
+      foreach ($can_be_damaged as $key => $unit_id)
48 48
       {
49 49
 //debug($structures[$unit_id][0]);
50 50
 //debug($structures[$unit_id][$damageTo], $MIPDamage);
51
-        if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
51
+        if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
52 52
         {
53 53
           unset($can_be_damaged[$key]);
54 54
         }
55 55
       }
56
-      if(empty($can_be_damaged))
56
+      if (empty($can_be_damaged))
57 57
       {
58 58
         break;
59 59
       }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 //debug($destroyed, 'Actually destroyed');
73 73
 
74 74
 //print('<hr>');
75
-    } while($MIPDamage > 0 && !empty($can_be_damaged));
75
+    } while ($MIPDamage > 0 && !empty($can_be_damaged));
76 76
 //debug($MIPDamage, 'MIPDamage left');
77 77
   }
78 78
 //debug($structures);//die();
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
     $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4;
88 88
   }
89 89
 
90
-  $return['structures'] = $structures;     // Structures left after attack
91
-  $return['metal']      = floor($metal);   // Metal scraps
90
+  $return['structures'] = $structures; // Structures left after attack
91
+  $return['metal']      = floor($metal); // Metal scraps
92 92
   $return['crystal']    = floor($crystal); // Crystal scraps
93 93
 
94 94
   return $return;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
   $iraks = db_missile_list_by_arrival();
114 114
 
115
-  while($fleetRow = db_fetch($iraks)) {
115
+  while ($fleetRow = db_fetch($iraks)) {
116 116
     set_time_limit(15);
117 117
     $db_changeset = array();
118 118
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
     $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true);
130 130
 
131
-    if($target_planet_row['id']) {
131
+    if ($target_planet_row['id']) {
132 132
       $planetDefense = array();
133
-      foreach(sn_get_groups('defense_active') as $unit_id) {
133
+      foreach (sn_get_groups('defense_active') as $unit_id) {
134 134
         $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true));
135 135
       }
136 136
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $message = classLocale::$lang['mip_all_destroyed'];
142 142
         $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']);
143 143
       } else {
144
-        if($interceptors) {
144
+        if ($interceptors) {
145 145
           $message = sprintf(classLocale::$lang['mip_destroyed'], $interceptors);
146 146
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']);
147 147
         }
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 
150 150
         $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']);
151 151
 
152
-        foreach($attackResult['structures'] as $key => $structure) {
152
+        foreach ($attackResult['structures'] as $key => $structure) {
153 153
           $destroyed = $planetDefense[$key][0] - $structure[0];
154
-          if($destroyed) {
154
+          if ($destroyed) {
155 155
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($key, -$destroyed, $targetUser, $target_planet_row['id']);
156 156
 
157 157
             $message .= "&nbsp;&nbsp;{$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>";
158 158
           }
159 159
         }
160 160
 
161
-        if(!empty($message)) {
161
+        if (!empty($message)) {
162 162
           $message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>";
163 163
 
164 164
           db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}");
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
       empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false;
179 179
       // empty($message) && ($message = $lang['mip_no_defense']);
180 180
 
181
-      msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message );
182
-      msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message );
181
+      msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message);
182
+      msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message);
183 183
     }
184 184
     db_missile_delete($fleetRow);
185 185
   }
Please login to merge, or discard this patch.
includes/functions/int_banner_create.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
   }
31 31
   $size = getimagesize(SN_ROOT_PHYSICAL . $img_name);
32 32
   $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name);
33
-  $image = imagecreatetruecolor($size[0],$size[1]);
34
-  imagecopy($image,$im,0,0,0,0,$size[0],$size[1]);
33
+  $image = imagecreatetruecolor($size[0], $size[1]);
34
+  imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]);
35 35
   imagedestroy($im);
36 36
 
37 37
   // Colors
38 38
   $color = "FFFFFF";
39
-  $red = hexdec(substr($color,0,2));
40
-  $green = hexdec(substr($color,2,4));
41
-  $blue = hexdec(substr($color,4,6));
42
-  $select = imagecolorallocate($image,$red,$green,$blue);
39
+  $red = hexdec(substr($color, 0, 2));
40
+  $green = hexdec(substr($color, 2, 4));
41
+  $blue = hexdec(substr($color, 4, 6));
42
+  $select = imagecolorallocate($image, $red, $green, $blue);
43 43
   $txt_shadow = imagecolorallocatealpha($image, 255, 255, 255, 255);
44 44
   $txt_color = imagecolorallocatealpha($image, 255, 255, 255, 2);
45 45
   $txt_shadow2 = imagecolorallocatealpha($image, 255, 255, 255, 255);
46 46
   $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40);
47 47
 
48
-  $fonts = array (
48
+  $fonts = array(
49 49
     'userbar' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_userbar_font,
50 50
     'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontUniverse,
51 51
     'raids' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontRaids,
52 52
     'info' => SN_ROOT_PHYSICAL . "design/fonts/" . $config->int_banner_fontInfo,
53 53
   );
54 54
 
55
-  if($id)
55
+  if ($id)
56 56
   {
57 57
     // Querys
58 58
     $user = db_user_by_id($id);
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     $b_user = $user['username'];
63 63
     $b_ally = $user['ally_name'];
64 64
     $b_planet = $planet_row['name'];
65
-    $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]";
66
-    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : $config->users_amount) ."/{$config->users_amount}";
65
+    $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]";
66
+    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : $config->users_amount) . "/{$config->users_amount}";
67 67
   }
68 68
   else
69 69
   {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
       imagettftext($image, 11, 0, 8, 26, $txt_shadow, $fonts['info'], $b_user);
86 86
       imagettftext($image, 11, 0, 6, 23, $txt_color, $fonts['info'], $b_user);
87 87
 
88
-      if($id)
88
+      if ($id)
89 89
       {
90 90
         // Player level - right-alligned
91 91
         $is = imagettfbbox(11, 0, $fonts['info'], $b_lvl);
@@ -94,37 +94,37 @@  discard block
 block discarded – undo
94 94
 
95 95
         // Ally name
96 96
         $is = imagettfbbox(9, 0, $fonts['info'], $b_ally);
97
-        imagettftext($image, 9, 0, 412-$is[2], 37, $txt_shadow, $fonts['info'], $b_ally);
98
-        imagettftext($image, 9, 0, 410-$is[2], 35, $txt_color, $fonts['info'], $b_ally);
97
+        imagettftext($image, 9, 0, 412 - $is[2], 37, $txt_shadow, $fonts['info'], $b_ally);
98
+        imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally);
99 99
 
100 100
         // Player b_planet
101
-        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz);
102
-        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz);
101
+        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz);
102
+        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz);
103 103
 
104 104
         //StatPoint
105
-        $b_points = classLocale::$lang['ov_points'].": ".pretty_number($user['total_points']);
105
+        $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number($user['total_points']);
106 106
         $is = imagettfbbox(8, 0, $fonts['info'], $b_points);
107
-        imagettftext($image, 8, 0, 412-$is[2], 11, $txt_shadow, $fonts['info'], $b_points);
108
-        imagettftext($image, 8, 0, 410-$is[2], 9, $txt_color, $fonts['info'], $b_points);
107
+        imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points);
108
+        imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points);
109 109
 
110 110
         //Raids Total
111 111
         imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
112 112
         imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
113
-        $b_points = ": ".pretty_number($user['raids']);
113
+        $b_points = ": " . pretty_number($user['raids']);
114 114
         imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points);
115 115
         imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points);
116 116
 
117 117
         //Raids Won
118 118
         imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']);
119 119
         imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']);
120
-        $b_points = ": ".pretty_number($user['raidswin']);
120
+        $b_points = ": " . pretty_number($user['raidswin']);
121 121
         imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points);
122 122
         imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points);
123 123
 
124 124
         //Raids Lost
125 125
         imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
126 126
         imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
127
-        $b_points = ": ".pretty_number($user['raidsloose']);
127
+        $b_points = ": " . pretty_number($user['raidsloose']);
128 128
         imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points);
129 129
         imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points);
130 130
       }
@@ -137,25 +137,25 @@  discard block
 block discarded – undo
137 137
       $is = imagettfbbox(9, 0, $fonts['userbar'], $b_univ);
138 138
       $is = $size[0] - $is[2] - 2;
139 139
       imagettftext($image, 9, 0, $is, $size[1] - 3, $txt_shadow, $fonts['userbar'], $b_univ);
140
-      imagettftext($image, 9, 0, $is-1, $size[1] - 5, $txt_color, $fonts['userbar'], $b_univ);
141
-      imagettftext($image, 22, 0, $is-8, $size[1], $txt_color, $fonts['userbar'], '/');
140
+      imagettftext($image, 9, 0, $is - 1, $size[1] - 5, $txt_color, $fonts['userbar'], $b_univ);
141
+      imagettftext($image, 22, 0, $is - 8, $size[1], $txt_color, $fonts['userbar'], '/');
142 142
 
143 143
       // Player name
144 144
       imagettftext($image, 9, 0, 4, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_user);
145 145
       imagettftext($image, 9, 0, 2, $size[1] - 6, $txt_color, $fonts['userbar'], $b_user);
146 146
 
147
-      if($id)
147
+      if ($id)
148 148
       {
149 149
         // Player level - right-alligned
150 150
         $isp = imagettfbbox(9, 0, $fonts['userbar'], $b_lvl);
151
-        imagettftext($image, 9, 0, $is-$isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl);
152
-        imagettftext($image, 9, 0, $is-$isp[2] - 10 - 1, $size[1] - 4 - 1, $txt_color, $fonts['userbar'], $b_lvl);
151
+        imagettftext($image, 9, 0, $is - $isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl);
152
+        imagettftext($image, 9, 0, $is - $isp[2] - 10 - 1, $size[1] - 4 - 1, $txt_color, $fonts['userbar'], $b_lvl);
153 153
       }
154 154
   }
155 155
 
156 156
   //And now convert it back to PNG-8
157
-  $im_result = imagecreate($size[0],$size[1]);
158
-  imagecopy($im_result,$image,0,0,0,0,$size[0],$size[1]);
157
+  $im_result = imagecreate($size[0], $size[1]);
158
+  imagecopy($im_result, $image, 0, 0, 0, 0, $size[0], $size[1]);
159 159
   imagedestroy($image);
160 160
   //And save it
161 161
   $imagetypes = imagetypes();
Please login to merge, or discard this patch.
includes/classes/Bonus.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
   /**
25 25
    * Добавляет юнит к списку бонусов
26 26
    *
27
-   * @param $unit_id
27
+   * @param integer $unit_id
28 28
    * @param $unit_level
29 29
    */
30 30
   public function add_unit_by_snid($unit_id, $unit_level) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
    *
68 68
    * Выдает финальный бонус в виде множителя
69 69
    *
70
-   * @param string|int $param - ИД бонуса
70
+   * @param string $param - ИД бонуса
71 71
    *
72 72
    * @return float
73 73
    */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
    * @param $unit_level
29 29
    */
30 30
   public function add_unit_by_snid($unit_id, $unit_level) {
31
-    if(!$unit_level) {
31
+    if (!$unit_level) {
32 32
       return;
33 33
     }
34 34
 
35
-    foreach(static::$_bonus_group as $param_name => $unit_list) {
36
-      if(!empty($unit_list[$unit_id])) {
35
+    foreach (static::$_bonus_group as $param_name => $unit_list) {
36
+      if (!empty($unit_list[$unit_id])) {
37 37
         // Простейший вариант - мультипликатор по базе
38 38
         // Общий мультипликатор добавляется в конец
39 39
         $this->grants[$param_name][$unit_id] = $unit_level;
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 //    $this->grants[$param_name][$unit_id] = $unit_level * get_unit_param($unit_id, P_BONUS_VALUE) / 100;;
83 83
     $value_add = floatval($base_value);
84 84
     $cumulative = 1.0; // Для случая BONUS_PERCENT
85
-    if(!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
-      foreach($this->grants[$param] as $unit_id => $unit_level) {
85
+    if (!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
+      foreach ($this->grants[$param] as $unit_id => $unit_level) {
87 87
         $unit_bonus = 0;
88
-        if($unit_id < 0) {
88
+        if ($unit_id < 0) {
89 89
           // Meta-unit - leave as is
90 90
         } else {
91 91
           // TODO - Подумать, что будет при смешивании разных бонусов и как этого избежать
92 92
           $bonus_value = get_unit_param($unit_id, P_BONUS_VALUE);
93 93
           $bonus_type = get_unit_param($unit_id, P_BONUS_TYPE);
94
-          switch($bonus_type) {
94
+          switch ($bonus_type) {
95 95
             case BONUS_PERCENT:
96 96
               $unit_bonus = $unit_level * $bonus_value / 100;
97 97
               $cumulative += $unit_bonus;
Please login to merge, or discard this patch.