@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | */ |
14 | 14 | // ---------------------------------------------------------------------------------------------------------------- |
15 | 15 | function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) { |
16 | - foreach($unit_group as $unit_id) { |
|
17 | - if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
16 | + foreach ($unit_group as $unit_id) { |
|
17 | + if (($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
18 | 18 | $compress_data[$unit_id] = $unit_count; |
19 | 19 | } |
20 | 20 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | $classLocale = classLocale::$lang; |
25 | 25 | |
26 | 26 | $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>"; |
27 | - foreach(sn_get_groups($group_name) as $unit_id) { |
|
28 | - if(($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
27 | + foreach (sn_get_groups($group_name) as $unit_id) { |
|
28 | + if (($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
29 | 29 | $result .= "<tr><td align=\"left\" colspan=\"3\">{$classLocale['tech'][$unit_id]}</td><td align=\"right\">{$unit_amount}</td></tr>"; |
30 | 30 | } |
31 | 31 | |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | |
58 | 58 | $objFleet = $mission_data->fleet; |
59 | 59 | |
60 | - if(empty($target_user_row['id']) || empty($target_planet_row['id']) || empty($spying_user_row['id'])) { |
|
60 | + if (empty($target_user_row['id']) || empty($target_planet_row['id']) || empty($spying_user_row['id'])) { |
|
61 | 61 | $objFleet->markReturnedAndSave(); |
62 | 62 | |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $spy_probes = $objFleet->shipsGetTotalById(SHIP_SPY); |
67 | - if($spy_probes > 0) { |
|
67 | + if ($spy_probes > 0) { |
|
68 | 68 | $TargetSpyLvl = GetSpyLevel($target_user_row); |
69 | 69 | $CurrentSpyLvl = GetSpyLevel($spying_user_row); |
70 | 70 | $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl; |
@@ -82,26 +82,26 @@ discard block |
||
82 | 82 | $spy_message .= " ({$classLocale['Player_']} '{$target_user_row['username']}') {$classLocale['On_']} "; |
83 | 83 | $spy_message .= date(FMT_DATE_TIME, $objFleet->time_arrive_to_target); |
84 | 84 | $spy_message .= "</td></tr><tr>"; |
85 | - $spy_message .= "<td width=220>{$classLocale['sys_metal']}</td><td width=220 align=right>" . pretty_number($target_planet_row['metal']) . "</td>"; |
|
86 | - $spy_message .= "<td width=220>{$classLocale['sys_crystal']}</td></td><td width=220 align=right>" . pretty_number($target_planet_row['crystal']) . "</td>"; |
|
85 | + $spy_message .= "<td width=220>{$classLocale['sys_metal']}</td><td width=220 align=right>".pretty_number($target_planet_row['metal'])."</td>"; |
|
86 | + $spy_message .= "<td width=220>{$classLocale['sys_crystal']}</td></td><td width=220 align=right>".pretty_number($target_planet_row['crystal'])."</td>"; |
|
87 | 87 | $spy_message .= "</tr><tr>"; |
88 | - $spy_message .= "<td width=220>{$classLocale['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>"; |
|
89 | - $spy_message .= "<td width=220>{$classLocale['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>"; |
|
88 | + $spy_message .= "<td width=220>{$classLocale['sys_deuterium']}</td><td width=220 align=right>".pretty_number($target_planet_row['deuterium'])."</td>"; |
|
89 | + $spy_message .= "<td width=220>{$classLocale['sys_energy']}</td><td width=220 align=right>".pretty_number($target_planet_row['energy_max'])."</td>"; |
|
90 | 90 | $spy_message .= "</tr>"; |
91 | - if($spy_diff >= 2) { |
|
92 | - $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', classLocale::$lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>"; |
|
91 | + if ($spy_diff >= 2) { |
|
92 | + $spy_message .= "<div class='spy_medium'>".flt_spy_scan($target_planet_row, 'fleet', classLocale::$lang['tech'][UNIT_SHIPS], $target_user_row)."</div>"; |
|
93 | 93 | coe_compress_add_units(Fleet::$snGroupFleet, $target_planet_row, $combat_pack[0]); |
94 | 94 | } |
95 | - if($spy_diff >= 3) { |
|
96 | - $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', classLocale::$lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>"; |
|
95 | + if ($spy_diff >= 3) { |
|
96 | + $spy_message .= "<div class='spy_medium'>".flt_spy_scan($target_planet_row, 'defense', classLocale::$lang['tech'][UNIT_DEFENCE], $target_user_row)."</div>"; |
|
97 | 97 | coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]); |
98 | 98 | } |
99 | - if($spy_diff >= 5) { |
|
100 | - $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', classLocale::$lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>"; |
|
99 | + if ($spy_diff >= 5) { |
|
100 | + $spy_message .= "<div class='spy_long'>".flt_spy_scan($target_planet_row, 'structures', classLocale::$lang['tech'][UNIT_STRUCTURES], $target_user_row)."</div>"; |
|
101 | 101 | } |
102 | 102 | |
103 | - if($spy_diff_empire >= 0) { |
|
104 | - $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', classLocale::$lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>"; |
|
103 | + if ($spy_diff_empire >= 0) { |
|
104 | + $spy_message .= "<div class='spy_long'>".flt_spy_scan($target_planet_row, 'tech', classLocale::$lang['tech'][UNIT_TECHNOLOGIES], $target_user_row)."</div>"; |
|
105 | 105 | coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row); |
106 | 106 | } |
107 | 107 | // TODO: Наемники, губернаторы, артефакты и прочее имперское |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D'); |
110 | 110 | |
111 | 111 | $target_unit_list = 0; |
112 | - foreach(Fleet::$snGroupFleet as $unit_id) { |
|
112 | + foreach (Fleet::$snGroupFleet as $unit_id) { |
|
113 | 113 | $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true)); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl); |
117 | 117 | |
118 | - if(mt_rand(0, 99) > $spy_detected) { |
|
118 | + if (mt_rand(0, 99) > $spy_detected) { |
|
119 | 119 | $spy_outcome_str = sprintf(classLocale::$lang['sys_mess_spy_detect_chance'], $spy_detected); |
120 | 120 | $spy_detected = false; |
121 | 121 | } else { |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | |
133 | 133 | DBStaticMessages::msg_send_simple_message($spying_user_row['id'], '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_mess_qg'], classLocale::$lang['sys_mess_spy_report'], $spy_message); |
134 | 134 | |
135 | - $target_message = "{$classLocale['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3); |
|
136 | - $target_message .= " {$classLocale['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row); |
|
135 | + $target_message = "{$classLocale['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} ".uni_render_coordinates_href($spying_planet_row, '', 3); |
|
136 | + $target_message .= " {$classLocale['sys_mess_spy_seen_at']} {$target_planet_row['name']} ".uni_render_coordinates($target_planet_row); |
|
137 | 137 | |
138 | - if($spy_detected) { |
|
138 | + if ($spy_detected) { |
|
139 | 139 | $debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet']; |
140 | 140 | |
141 | 141 | $spy_cost = get_unit_param(SHIP_SPY, P_COST); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_mess_spy_control'], classLocale::$lang['sys_mess_spy_activity'], $target_message); |
158 | 158 | } |
159 | 159 | |
160 | - if($spy_detected) { |
|
160 | + if ($spy_detected) { |
|
161 | 161 | $objFleet->dbDelete(); |
162 | 162 | } else { |
163 | 163 | $objFleet->markReturnedAndSave(); |