-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflottes_bbcode.php
More file actions
294 lines (252 loc) · 12.7 KB
/
flottes_bbcode.php
File metadata and controls
294 lines (252 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
/***************************************************************************
* filename : flottes_bbcode.php
* desc. : 1.06
* Author :
* created :
* modified : AirBAT
* last modif. : correct Ion and Gauss
***************************************************************************/
if (!defined('IN_SPYOGAME')) {
die("Hacking attempt");
}
// def de qq variable
//define("TABLE_MOD_FLOTTES", $table_prefix."mod_flottes");
// insertion des fonctions flotte
require_once("./mod/flottes/function_flottes.php");
require_once("./mod/flottes/flottes_inc.php");
require_once("./mod/flottes/flottes_lang.php");
global $CF, $CFO, $CFU, $CFP, $CFA, $CB1, $CB2, $CB3, $CB4, $CB5, $GA;
buttons_bar($pub_subaction);
global $nbj;
$nb_planete = find_nb_planete_user($user_data["user_id"]);
// total points
$total = 0;
$i = 1;
$request = "SELECT ";
foreach ($mod_flottes_lang as $key => $value) {
if (($key != "planet_name") & ($key != "coordinates") & ($key != "planet_id")) {
$request .= "(SUM(" . $key . ") * " . $vaisseaux[$i][1] . " / 1000 ) + ";
$i++;
}
}
$request = substr($request, 0, strlen($request) - 2);
$request .= " as tot FROM " . TABLE_MOD_FLOTTES . " WHERE user_id=" . $user_data['user_id'];
if ($result = $db->sql_query($request)) {
$total = $db->sql_fetch_row($result);
if ($total[0] == '') {
$total = 0;
} else {
$total = $total[0];
}
}
/////////////////////////////////////////////////////////
// Total flotte joueur
$request = "SELECT ";
foreach ($mod_flottes_lang as $key => $value) {
if (($key != "planet_name") & ($key != "coordinates") & ($key != "planet_id")) {
$request .= "SUM(" . $key . ") as " . $key . ", ";
}
}
$request = substr($request, 0, strlen($request) - 2);
$request .= " FROM " . TABLE_MOD_FLOTTES . " WHERE user_id=" . $user_data['user_id'];
/////////////////////////////////////////////////
if ($result = $db->sql_query($request)) {
while ($ligne = $db->sql_fetch_row($result)) {
$PT = $ligne[0];
$GT = $ligne[1];
$CLE = $ligne[2];
$CLO = $ligne[3];
$CR = $ligne[4];
$VB = $ligne[5];
$VC = $ligne[6];
$REC = $ligne[7];
$SE = $ligne[8];
$BMD = $ligne[9];
$DST = $ligne[10];
$EDLM = $ligne[11];
$TRA = $ligne[12];
$sat = $ligne[13];
}
// On initialise tout à 0
$mic = $mip = $pb = $gb = $lm = $lle = $llo = $cg = $ai = $lp = 0;
// Boucle pour les planètes
for ($i = 101; $i <= ($nb_planete + 100); $i++) {
$mic += $user_defence[$i][$mic_lang];
$mip += $user_defence[$i][$mip_lang];
$pb += $user_defence[$i][$pb_lang];
$gb += $user_defence[$i][$gb_lang];
$lm += $user_defence[$i][$lm_lang];
$lle += $user_defence[$i][$lle_lang];
$llo += $user_defence[$i][$llo_lang];
$cg += $user_defence[$i][$cg_lang];
$ai += $user_defence[$i][$ai_lang];
$lp += $user_defence[$i][$lp_lang];
}
// Boucle pour les lunes
for ($i = 201; $i <= ($nb_planete + 100); $i++) {
$mic += $user_defence[$i][$mic_lang];
$mip += $user_defence[$i][$mip_lang];
$pb += $user_defence[$i][$pb_lang];
$gb += $user_defence[$i][$gb_lang];
$lm += $user_defence[$i][$lm_lang];
$lle += $user_defence[$i][$lle_lang];
$llo += $user_defence[$i][$llo_lang];
$cg += $user_defence[$i][$cg_lang];
$ai += $user_defence[$i][$ai_lang];
$lp += $user_defence[$i][$lp_lang];
}
////// Nom du joueur In Game
$joueur = $user_data['user_stat_name'];
//// heure locale
$date = date('d M Y');
/////// si le nom du joueur est pas null alors on va chercher ses statistiques flottes
if ($joueur != '') {
////// dernière date de Stat
$out = "";
$dated = 1;
$fp = 0;
$fr = 0;
$query = "SELECT max(datadate) FROM " . TABLE_RANK_PLAYER_MILITARY . " WHERE player='" . $joueur . "'";
if ($result = $db->sql_query($query)) {
if ($val = $db->sql_fetch_row($result)) {
$dated = $val[0];
} else {
$out = "Pas de lecture date";
}
} else {
$out = "erreur base date";
}
$lastmodified = date('d/M/Y H:i', intval($dated));
// echo "dated :".$dated." - ".$lastmodified;
if (isset($dated)) {
$query = "SELECT rank, points FROM " . TABLE_RANK_PLAYER_MILITARY . " WHERE datadate=" . $dated . " AND player='" . $joueur . "'";
if ($result = $db->sql_query($query)) {
if ($val = $db->sql_fetch_row($result)) {
$fr = $val[0]; // le classement flotte
// $fp = $val[1]; // les points flotte
} else {
$out .= " - Pas de lecture stat " . $dated;
$fr = 0;
}
} else {
$out = " - erreur base stat";
$fr = 0;
}
} else {
$out .= " - Pas de lecture stat dated";
$fr = 0;
}
// echo $out;
} else {
$joueur = $user_data['user_name'];
$lastmodified = $date;
$dated = 0;
$fr = 0;
}
// fin total joueur
//////////////////////////////////////////////////
$header = '[center][color=' . $CB1 . '][b][i][u]Flotte:[/color][/u][/i][/b]';
$footer = '[color=' . $CB3 . ']Statut de la flotte de [/color][color=' . $CB2 . ']' . $joueur . '[/color][color=' . $CB3 . '] réalisé par le Mod Flottes d\'' . $GA . ' le ' . $date . '[/color][/i][/center]';
$conv = $header . "\n";
$conv .= "\n";
if ($fr != 0) {
$conv .= '[i][color=' . $CB1 . ']Classement Militaire: [/color][color=' . $CB2 . ']' . $fr . ' [/color][color=' . $CB1 . ']ème au [/color][color=' . $CB2 . ']' . $lastmodified . ' [/color][color=' . $CB1 . ']heure[/color][color=' . $CB3 . '] [/color][/i]' . "\n";
$conv .= "\n";
} else {
$conv .= '[i][color=' . $CB1 . ']Joueur non classé ou classement par Vaisseaux inexistant[/color][color=' . $CB3 . '] [/color][/i]' . "\n";
$conv .= "\n";
}
$conv .= '[b][color=' . $CB4 . ']Vaisseaux de Guerre[/color][/b]' . "\n";
$conv .= "\n";
$conv .= '[i][color=' . $CB2 . ']' . $CLE . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["CLE"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $CLO . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["CLO"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $CR . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["CR"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $VB . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["VB"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $BMD . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["BMD"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $DST . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["DST"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $EDLM . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["EDLM"] . '[/color]' . "\n";
if ($GA == 'OGAME') {
$conv .= '[color=' . $CB2 . ']' . $TRA . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["TRA"] . '[/color][/i]' . "\n";
}
$conv .= "\n";
$conv .= '[b][color=' . $CB4 . ']Vaisseaux de Transport[/color][/b]' . "\n";
$conv .= "\n";
$conv .= '[i][color=' . $CB2 . ']' . $PT . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["PT"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $GT . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["GT"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $REC . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["REC"] . '[/color][/i]' . "\n";
$conv .= "\n";
$conv .= '[b][color=' . $CB4 . ']Vaisseaux divers[/color][/b]' . "\n";
$conv .= "\n";
$conv .= '[i][color=' . $CB2 . ']' . $VC . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["VC"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $SE . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["SE"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $sat . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["SAT"] . '[/color][/i]' . "\n";
if ($GA == 'UNIVERS') {
$conv .= '[color=' . $CB2 . ']' . $TRA . '[/color] [color=' . $CB5 . ']' . $mod_flottes_lang["TRA"] . '[/color][/i]' . "\n";
}
$conv .= "\n";
$conv .= '[b][color=' . $CB4 . ']Missiles[/color][/b]' . "\n";
$conv .= "\n";
$conv .= '[i][color=' . $CB2 . ']' . $mic . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_AntiBallisticMissiles"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $mip . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_InterplanetaryMissiles"] . '[/color][/i]' . "\n";
$conv .= "\n";
$conv .= '[b][color=' . $CB4 . ']Défenses[/color][/b]' . "\n";
$conv .= "\n";
$conv .= '[i][color=' . $CB2 . ']' . $lm . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_RocketLauncher"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $lle . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_LightLaser"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $llo . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_HeavyLaser"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $ai . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_IonCannon"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $cg . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_GaussCannon"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $lp . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_PlasmaTuret"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $pb . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_SmallShield"] . '[/color]' . "\n";
$conv .= '[color=' . $CB2 . ']' . $gb . '[/color] [color=' . $CB5 . ']' . $LANG["ogame_LargeShield"] . '[/color][/i]' . "\n";
$conv .= "\n";
$conv .= '[color=' . $CB1 . ']Soit un total de [/color][color=' . $CB2 . ']' . number_format($total, 0, ',', ' ') . '[/color][color=' . $CB1 . '] points ou [/color][color=' . $CB2 . ']' . number_format($total * 1000, 0, ',', ' ') . '[/color][color=' . $CB1 . '] ressources investies dans les vaisseaux[/color].' . "\n";
$conv .= "\n";
$conv .= $footer;
// echo 'Rapport converti<br><textarea rows=\'10\' cols=\'10\'>'.$conv.'</textarea>';
?>
<form action='' method='POST' name='flottes'>
<input type='hidden' name='action' value='flottes'>
<input type='hidden' name='permit' value='change'>
<table width="100%">
<tr align="center">
<!-- <td colspan='18'></td> -->
<td class='c' colspan='18'><b>Export BBCode</b></td><br>
</tr>
<tr align="center">
<th colspan='18'>
<?php
echo "<textarea name='flottes_conv' rows='30' id='flottes_conv' >" . $conv . "</textarea><br>";
?>
<div style="background-color : transparent; width: 49%; text-align : center; float: left;">
<input type="button" name="apercu" onClick="preview()" title="Aperçu (ne fonctionne pas bien avec LDU)" value="Aperçu">
</div>
<td></td>
</th>
</tr>
<!-- fin BBcode -->
</table>
</form>
<div style="border: 1px ridge white; padding: 5px; overflow: auto; visibility: hidden; position: absolute; width: 470px; height: 960px; top: 10px; left: 50%; margin-left: -235px; background-color: #000000;" id="message">
<table width="100%">
<tbody>
<tr>
<td><b id="note0">Aperçu</b></td>
<td align="right"><input type="button" name="fermer" onClick="closeMessage()" value="Fermer"></td>
</tr>
</tbody>
</table>
<div id="preview" style="background-color: #2e2e2e; padding: 10px; font-size : 12px; text-align: left;"> </div>
<table width="100%">
<tbody>
<tr>
<td align="left">Thanks to <a href="https://www.takanacity.com/" title="website of Takana's OGame Tools">Takana's Team</a> for this preview !</td>
<td align="right"><input type="button" name="fermer" onClick="closeMessage()" value="Fermer"></td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>