1 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,484 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+define('DEBUG', FALSE); |
|
4 |
+//a faire en fonction de la variable DEBUG, avec ou sans message d'erreurs de la BDD |
|
5 |
+define('BD_ADRESSE', 'localhost'); |
|
6 |
+define('BD_USER', 'root'); |
|
7 |
+define('BD_PASS', ''); |
|
8 |
+define('BD_NOM', 'villededragons'); |
|
9 |
+ |
|
10 |
+function connectionBDD(){ |
|
11 |
+ $bdd = @mysql_connect(BD_ADRESSE,BD_USER,BD_PASS) or exit('erreur de connection...'); |
|
12 |
+ @mysql_select_db(BD_NOM)or exit('pb de Base de donn�es...'); |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function check_id($login,$pass){ |
|
16 |
+ connectionBDD(); |
|
17 |
+ $login = addslashes($login); |
|
18 |
+ $pass = addslashes($pass); |
|
19 |
+ |
|
20 |
+ $resultat = mysql_query("SELECT id_login FROM login WHERE login = '".$login."' AND password = '".$pass."'")or exit('Erreur ' . mysql_errno() . ' : ' . mysql_error()); |
|
21 |
+ if(mysql_num_rows($resultat) == 0){ |
|
22 |
+ $usr_id=-1; |
|
23 |
+ }else{ |
|
24 |
+ $tableauReponse = mysql_fetch_assoc($resultat); |
|
25 |
+ $usr_id = $tableauReponse['id_login']; |
|
26 |
+ } |
|
27 |
+ mysql_close(); |
|
28 |
+ return $usr_id; |
|
29 |
+} |
|
30 |
+ |
|
31 |
+function creation_id($login,$pass){ |
|
32 |
+ connectionBDD(); |
|
33 |
+ $login = addslashes($login); |
|
34 |
+ $pass = addslashes($pass); |
|
35 |
+ $date = date("Y-m-d"); |
|
36 |
+ |
|
37 |
+ mysql_query("INSERT INTO login(login,password,Date_creation) VALUES('".$login."','".$pass."','".$date."')")or exit('Erreur ' . mysql_errno() . ' : ' . mysql_error()); |
|
38 |
+ mysql_close(); |
|
39 |
+} |
|
40 |
+ |
|
41 |
+function creationSorcier(){} |
|
42 |
+ |
|
43 |
+ |
|
44 |
+function existe_Log($login){ |
|
45 |
+ connectionBDD(); |
|
46 |
+ $login = addslashes($login); |
|
47 |
+ $resultat = mysql_query("SELECT id_login FROM login WHERE login = '".$login."'")or exit('Erreur ' . mysql_errno() . ' : ' . mysql_error()); |
|
48 |
+ if(mysql_num_rows($resultat) == 0){ |
|
49 |
+ $existe = false; |
|
50 |
+ }else{ |
|
51 |
+ $existe = true; |
|
52 |
+ } |
|
53 |
+ mysql_close(); |
|
54 |
+ return $existe; |
|
55 |
+ |
|
56 |
+} |
|
57 |
+ |
|
58 |
+function check_session(){ |
|
59 |
+ if(!session_is_registered("user_id")){ |
|
60 |
+ header("location: index.php"); |
|
61 |
+ } |
|
62 |
+} |
|
63 |
+ |
|
64 |
+function check_ChaineDeCaracteres($chaine){ |
|
65 |
+ set_magic_quotes_runtime(0); |
|
66 |
+ //1er caractere en majuscule |
|
67 |
+ $chaineMaj = ucfirst($chaine); |
|
68 |
+ //verificatitions des balises HTML |
|
69 |
+ $pos = strpos($chaineMaj,'<'); |
|
70 |
+ if($pos !== FALSE){ |
|
71 |
+ return(0); |
|
72 |
+ }else{ |
|
73 |
+ //test sur la configuration du serveur pour l'utilisation de l'echappement avec les antiSlash |
|
74 |
+ if (get_magic_quotes_gpc() == 1){ |
|
75 |
+ return $chaine; |
|
76 |
+ }else{ |
|
77 |
+ $chaineBonneGuillemets = addslashes($chaine); |
|
78 |
+ return ($chaineBonneGuillemets); |
|
79 |
+ } |
|
80 |
+ } |
|
81 |
+} |
|
82 |
+ |
|
83 |
+function HTML_ChaineDeCaracteres($chaine){ |
|
84 |
+ return (htmlspecialchars($chaine,ENT_QUOTES)); |
|
85 |
+} |
|
86 |
+/****************************************************************************************************************/ |
|
87 |
+/************************************** FONCTIONS PROPRES AU JEU **********************************************/ |
|
88 |
+/****************************************************************************************************************/ |
|
89 |
+function ChangementEnergie($nb,$retrait){ |
|
90 |
+ if($retrait == 0){ |
|
91 |
+ $_SESSION['FatigueActuelle'] += $nb; |
|
92 |
+ if($_SESSION['FatigueActuelle']>$_SESSION['FatigueMax']){ |
|
93 |
+ $_SESSION['FatigueActuelle']=$_SESSION['FatigueMax']; |
|
94 |
+ } |
|
95 |
+ }else{ |
|
96 |
+ $_SESSION['FatigueActuelle'] -= $nb; |
|
97 |
+ if($_SESSION['FatigueActuelle']<0){ |
|
98 |
+ $_SESSION['FatigueActuelle']=0; |
|
99 |
+ header("location: fatigue.php"); |
|
100 |
+ } |
|
101 |
+ } |
|
102 |
+} |
|
103 |
+function ChangementVie($nb,$retrait){ |
|
104 |
+ if($retrait == 0){ |
|
105 |
+ $_SESSION['VitActuelleAug'] += $nb; |
|
106 |
+ $_SESSION['VitActuelle'] += $nb; |
|
107 |
+ if($_SESSION['VitActuelleAug']>$_SESSION['VitAug']){ |
|
108 |
+ $_SESSION['VitActuelleAug']=$_SESSION['VitAug']; |
|
109 |
+ } |
|
110 |
+ if($_SESSION['VitActuelle']>$_SESSION['Vit']){ |
|
111 |
+ $_SESSION['VitActuelle']=$_SESSION['Vit']; |
|
112 |
+ } |
|
113 |
+ }else{ |
|
114 |
+ $_SESSION['VitActuelleAug'] -= $nb; |
|
115 |
+ $_SESSION['VitActuelle'] -= $nb; |
|
116 |
+ if($_SESSION['VitActuelle']<0){ |
|
117 |
+ $_SESSION['VitActuelle']=0; |
|
118 |
+ } |
|
119 |
+ if($_SESSION['VitActuelleAug']<0){ |
|
120 |
+ $_SESSION['VitActuelleAug']=0; |
|
121 |
+ header("location: mort.php"); |
|
122 |
+ } |
|
123 |
+ } |
|
124 |
+} |
|
125 |
+function ChangementEnergieCombat($nb,$retrait,$lequel){ |
|
126 |
+ if($lequel==0){ |
|
127 |
+ //on enleve de l'energie a l'ennemi |
|
128 |
+ if($retrait == 0){ |
|
129 |
+ $_SESSION['ennemiFatigue'] += $nb; |
|
130 |
+ if($_SESSION['ennemiFatigue']>$_SESSION['ennemiFatigueMax']){ |
|
131 |
+ $_SESSION['ennemiFatigue']=$_SESSION['ennemiFatigueMax']; |
|
132 |
+ } |
|
133 |
+ }else{ |
|
134 |
+ $_SESSION['ennemiFatigue'] -= $nb; |
|
135 |
+ if($_SESSION['ennemiFatigue']<0){ |
|
136 |
+ $_SESSION['ennemiFatigue']=0; |
|
137 |
+ } |
|
138 |
+ } |
|
139 |
+ }else{ |
|
140 |
+ //on enleve de l'energie au perso |
|
141 |
+ if($retrait == 0){ |
|
142 |
+ $_SESSION['FatigueActuelle'] += $nb; |
|
143 |
+ if($_SESSION['FatigueActuelle']>$_SESSION['FatigueMax']){ |
|
144 |
+ $_SESSION['FatigueActuelle']=$_SESSION['FatigueMax']; |
|
145 |
+ } |
|
146 |
+ }else{ |
|
147 |
+ $_SESSION['FatigueActuelle'] -= $nb; |
|
148 |
+ if($_SESSION['FatigueActuelle']<0){ |
|
149 |
+ $_SESSION['FatigueActuelle']=0; |
|
150 |
+ } |
|
151 |
+ } |
|
152 |
+ } |
|
153 |
+} |
|
154 |
+function ChangementPoids($AlimentTresNutritif){ |
|
155 |
+ if($AlimentTresNutritif == 0){ |
|
156 |
+ $_SESSION['Poids']++; |
|
157 |
+ }elseif($AlimentTresNutritif == 1){ |
|
158 |
+ $_SESSION['Poids']--; |
|
159 |
+ } |
|
160 |
+ if($_SESSION['Poids']>5){ |
|
161 |
+ $_SESSION['Poids']=5; |
|
162 |
+ }else if($_SESSION['Poids']<1){ |
|
163 |
+ $_SESSION['Poids']=1; |
|
164 |
+ } |
|
165 |
+} |
|
166 |
+function ChangementOr($combien,$retrait){ |
|
167 |
+ if($retrait==0){ |
|
168 |
+ $_SESSION['Or'] += $combien; |
|
169 |
+ }else{ |
|
170 |
+ $_SESSION['Or'] -= $combien; |
|
171 |
+ } |
|
172 |
+} |
|
173 |
+function ChangementVariableHistoire($laquelle,$valeur){ |
|
174 |
+ mysql_query("UPDATE histoire SET ".$laquelle."='".$valeur."' WHERE id = '".$_SESSION['id']."'")or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
175 |
+} |
|
176 |
+ |
|
177 |
+function ChangementHeureJournee(){ |
|
178 |
+ //raz des encas qui font changer de journee |
|
179 |
+ $_SESSION['enCas'] = 1; |
|
180 |
+ //augmentation du compteur de l'heure de la journ�e |
|
181 |
+ $_SESSION['repas']++; |
|
182 |
+ //test pour savoir si on change de journ�e |
|
183 |
+ if($_SESSION['repas']>3){ |
|
184 |
+ $_SESSION['repas']=0; |
|
185 |
+ $_SESSION['Age']++; |
|
186 |
+ $_SESSION['couple']=0; |
|
187 |
+ } |
|
188 |
+} |
|
189 |
+ |
|
190 |
+function SauvegardeHistoire(){ |
|
191 |
+ $chaine = check_ChaineDeCaracteres($_SESSION['passeHeroique']); |
|
192 |
+ $req = 'UPDATE sorcier SET passeHeroiqueSorcier = "'.$chaine.'" WHERE id = "'.$_SESSION["id"].'"'; |
|
193 |
+ mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
194 |
+} |
|
195 |
+ |
|
196 |
+function Sauvegarde($endroit){ |
|
197 |
+ //remise a zero des compteurs encas et boissons |
|
198 |
+ $_SESSION['biereBu'] = 0; |
|
199 |
+ if($endroit==1){ |
|
200 |
+ //ca ne marche que pour le moment ou l'on dort dans la taverne... |
|
201 |
+ ChangementHeureJournee(); |
|
202 |
+ } |
|
203 |
+ CalculAugmentationCarac(); |
|
204 |
+ //insertion des nouvelles caracteristiques |
|
205 |
+ $req = "UPDATE sorcier SET Niveau = '".$_SESSION['Niveau']."' ," |
|
206 |
+ ."Intelligence = '".$_SESSION['Int']."' ," |
|
207 |
+ ."Vitalite = '".$_SESSION['Vit']."' ," |
|
208 |
+ ."Forc = '".$_SESSION['For']."' ," |
|
209 |
+ ."Charisme = '".$_SESSION['Cha']."' ," |
|
210 |
+ ."Dexterite = '".$_SESSION['Dex']."' ," |
|
211 |
+ ."Sagesse = '".$_SESSION['Sag']."' ," |
|
212 |
+ ."VitActuelle = '".$_SESSION['VitActuelle']."' ," |
|
213 |
+ ."FatigueMax = '".$_SESSION['FatigueMax']."' ," |
|
214 |
+ ."FatigueActuelle = '".$_SESSION['FatigueActuelle']."' ," |
|
215 |
+ ."PiecesOr = '".$_SESSION['Or']."' ," |
|
216 |
+ ."Poids = '".$_SESSION['Poids']."' ," |
|
217 |
+ ."Age = '".$_SESSION['Age']."' ," |
|
218 |
+ ."Dieu = '".$_SESSION['Dieu']."' ," |
|
219 |
+ ."Heure= '".$_SESSION['repas']."' ," |
|
220 |
+ ."N_pomme = '".$_SESSION['N_pomme']."' ," |
|
221 |
+ ."N_viandeSeche = '".$_SESSION['N_viandeSeche']."' ," |
|
222 |
+ ."N_orange = '".$_SESSION['N_orange']."' ," |
|
223 |
+ ."N_pain = '".$_SESSION['N_pain']."' ," |
|
224 |
+ ."N_chocolat = '".$_SESSION['N_chocolat']."' ," |
|
225 |
+ ."N_lait = '".$_SESSION['N_lait']."' ," |
|
226 |
+ ."experience = '".$_SESSION['xp']."' ," |
|
227 |
+ ."experienceMax = '".$_SESSION['xpMax']."'" |
|
228 |
+ ." WHERE id = '".$_SESSION['id']."'"; |
|
229 |
+ CalculCaractAugmentee(TRUE); |
|
230 |
+ //insertion des nouvelles valeurs de l'histoire |
|
231 |
+ $req2 = "UPDATE histoire SET taverne= '".$_SESSION['taverne']."' ," |
|
232 |
+ ."taverneRumeur= '".$_SESSION['taverneRumeur']."'," |
|
233 |
+ ."taverneRat= '".$_SESSION['taverneRat']."' ," |
|
234 |
+ ."arrivee= '".$_SESSION['arrivee']."' ," |
|
235 |
+ ."erudit= '".$_SESSION['erudit']."' ," |
|
236 |
+ ."pretre= '".$_SESSION['pretre']."' ," |
|
237 |
+ ."egliseRumeur= '".$_SESSION['egliseRumeur']."' ," |
|
238 |
+ ."egliseZombis= '".$_SESSION['egliseZombis']."' ," |
|
239 |
+ ."joueurs= '".$_SESSION['joueurs']."' ," |
|
240 |
+ ."nains= '".$_SESSION['nains']."' ," |
|
241 |
+ ."nainsHumeur= '".$_SESSION['nainsHumeur']."' ," |
|
242 |
+ ."nudite= '".$_SESSION['nudite']."' ," |
|
243 |
+ ."couple= '".$_SESSION['couple']."' ," |
|
244 |
+ ."bagueMaisonCouple= '".$_SESSION['bagueMaisonCouple']."' ," |
|
245 |
+ ."tavernier= '".$_SESSION['tavernier']."' ," |
|
246 |
+ ."forgeron= '".$_SESSION['forgeron']."' ," |
|
247 |
+ ."Sauvegarde= '".$endroit."'" |
|
248 |
+ ." WHERE id = '".$_SESSION['id']."'"; |
|
249 |
+ //insertion des nouveaux ou anciens objets |
|
250 |
+ $req3 = "UPDATE sac SET id_objets1 = '".$_SESSION['objets1']."' ," |
|
251 |
+ ."id_objets2 = '".$_SESSION['objets2']."' ," |
|
252 |
+ ."id_objets3 = '".$_SESSION['objets3']."' ," |
|
253 |
+ ."id_objets4 = '".$_SESSION['objets4']."'" |
|
254 |
+ ."WHERE id_sorcier = '".$_SESSION['id']."'"; |
|
255 |
+ //insertion des nouveaux ou anciens equipement |
|
256 |
+ $req4 = "UPDATE equipement SET id_tete = '".$_SESSION['tete']."' ," |
|
257 |
+ ."id_mainGauche = '".$_SESSION['mainGauche']."' ," |
|
258 |
+ ."id_mainDroite = '".$_SESSION['mainDroite']."' ," |
|
259 |
+ ."id_corps = '".$_SESSION['corps']."' ," |
|
260 |
+ ."id_mains = '".$_SESSION['mains']."' ," |
|
261 |
+ ."id_jambes = '".$_SESSION['jambes']."' ," |
|
262 |
+ ."id_pieds = '".$_SESSION['pieds']."' ," |
|
263 |
+ ."id_doigt1 = '".$_SESSION['doigt1']."' ," |
|
264 |
+ ."id_doigt2 = '".$_SESSION['doigt2']."' ," |
|
265 |
+ ."Sac = '".$_SESSION['sac']."'" |
|
266 |
+ ."WHERE id_sorcier = '".$_SESSION['id']."'"; |
|
267 |
+ |
|
268 |
+ mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
269 |
+ mysql_query($req2)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
270 |
+ mysql_query($req3)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
271 |
+ mysql_query($req4)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
272 |
+ |
|
273 |
+} |
|
274 |
+function AfficheBarreDEtat($pageactuelle){ |
|
275 |
+ echo "<table border='0' cellspacing='0' cellpadding='0' align='center'>" |
|
276 |
+ ."<tr>" |
|
277 |
+ ."<td align='center' width= '225'><B>POINTS DE VIE: </B>".$_SESSION['VitActuelleAug']."/".$_SESSION['VitAug']." "; |
|
278 |
+ AfficheImgBarre(0,$_SESSION['VitActuelleAug'],$_SESSION['VitAug']); |
|
279 |
+ echo "</td>" |
|
280 |
+ ."<td align='center' width= '225'><B>FATIGUE: </B>".$_SESSION['FatigueActuelle']."/".$_SESSION['FatigueMax']." "; |
|
281 |
+ AfficheImgBarre(1,$_SESSION['FatigueActuelle'],$_SESSION['FatigueMax']); |
|
282 |
+ echo "</td>" |
|
283 |
+ ."<td align='center' width='225'><B>OR: </B>".$_SESSION['Or']." pi�ces.<BR>"; |
|
284 |
+ if($pageactuelle==0){ |
|
285 |
+ echo "<A href=FicheDEtat.php>Fiche De ".$_SESSION['Prenom']."</a>"; |
|
286 |
+ } |
|
287 |
+ echo "</td>" |
|
288 |
+ ."</tr>" |
|
289 |
+ ."</table>"; |
|
290 |
+} |
|
291 |
+function AfficheImgBarre($QuelleBarre,$Actuel,$Max){ |
|
292 |
+ switch($QuelleBarre){ |
|
293 |
+ case 0: |
|
294 |
+ $image="images/barreHP.gif"; |
|
295 |
+ break; |
|
296 |
+ case 1: |
|
297 |
+ $image="images/barreFatigue.gif"; |
|
298 |
+ break; |
|
299 |
+ case 2: |
|
300 |
+ $image="images/barreXp.gif"; |
|
301 |
+ break; |
|
302 |
+ } |
|
303 |
+ echo "<table border='0' cellspacing='0' cellpadding='0' align='center'>" |
|
304 |
+ ."<tr>"; |
|
305 |
+ $nbVie= round((100*$Actuel)/$Max)*2; |
|
306 |
+ echo "<td>" |
|
307 |
+ ."<img src=".$image." width='".$nbVie."px' height='9px'>" |
|
308 |
+ ."</td>"; |
|
309 |
+ $nbMort= (200-$nbVie); |
|
310 |
+ echo "<td>" |
|
311 |
+ ."<img src=images/barre.gif width='".$nbMort."px' height='9px'>" |
|
312 |
+ ."</td>"; |
|
313 |
+ echo "</tr>" |
|
314 |
+ ."</table>"; |
|
315 |
+} |
|
316 |
+function typeAliment($nbAliment){ |
|
317 |
+ switch($nbAliment){ |
|
318 |
+ case 1: |
|
319 |
+ return("fruit"); |
|
320 |
+ break; |
|
321 |
+ case 2: |
|
322 |
+ return("prot�ine"); |
|
323 |
+ break; |
|
324 |
+ case 3: |
|
325 |
+ return("agrume"); |
|
326 |
+ break; |
|
327 |
+ case 4: |
|
328 |
+ return("feculent"); |
|
329 |
+ break; |
|
330 |
+ case 5: |
|
331 |
+ return("gourmandise"); |
|
332 |
+ break; |
|
333 |
+ case 6: |
|
334 |
+ return("laitage"); |
|
335 |
+ break; |
|
336 |
+ } |
|
337 |
+ |
|
338 |
+} |
|
339 |
+function CalculAugmentationCarac(){ |
|
340 |
+ //mise a zero des augmentation de caracteristiques |
|
341 |
+ $_SESSION['Aug_Int'] = 0; |
|
342 |
+ $_SESSION['Aug_For'] = 0; |
|
343 |
+ $_SESSION['Aug_Vit'] = 0; |
|
344 |
+ $_SESSION['Aug_Cha'] = 0; |
|
345 |
+ $_SESSION['Aug_Dex'] = 0; |
|
346 |
+ $_SESSION['Aug_Sag'] = 0; |
|
347 |
+ //ajout des augmentation des caracteristiques |
|
348 |
+ //sur le corps |
|
349 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM corps WHERE id_corps='".$_SESSION['corps']."'"; |
|
350 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
351 |
+ |
|
352 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
353 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
354 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
355 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
356 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
357 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
358 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
359 |
+ //sur les doigts de la main gauche |
|
360 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM doigt WHERE id_doigt='".$_SESSION['doigt1']."'"; |
|
361 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
362 |
+ |
|
363 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
364 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
365 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
366 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
367 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
368 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
369 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
370 |
+ //sur les doigts de la main droite |
|
371 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM doigt WHERE id_doigt='".$_SESSION['doigt2']."'"; |
|
372 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
373 |
+ |
|
374 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
375 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
376 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
377 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
378 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
379 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
380 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
381 |
+ //sur les jambes |
|
382 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM jambes WHERE id_jambes='".$_SESSION['jambes']."'"; |
|
383 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
384 |
+ |
|
385 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
386 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
387 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
388 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
389 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
390 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
391 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
392 |
+ //sur la main Droite |
|
393 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM maindroite WHERE id_maindroite='".$_SESSION['mainDroite']."'"; |
|
394 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
395 |
+ |
|
396 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
397 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
398 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
399 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
400 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
401 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
402 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
403 |
+ //sur la main gauche |
|
404 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM maingauche WHERE id_maingauche='".$_SESSION['mainGauche']."'"; |
|
405 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
406 |
+ |
|
407 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
408 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
409 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
410 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
411 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
412 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
413 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
414 |
+ //sur les mains |
|
415 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM mains WHERE id_mains='".$_SESSION['mains']."'"; |
|
416 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
417 |
+ |
|
418 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
419 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
420 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
421 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
422 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
423 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
424 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
425 |
+ //sur les pieds |
|
426 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM pieds WHERE id_pieds='".$_SESSION['pieds']."'"; |
|
427 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
428 |
+ |
|
429 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
430 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
431 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
432 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
433 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
434 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
435 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
436 |
+ //sur la tete |
|
437 |
+ |
|
438 |
+ $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM tete WHERE id_tete='".$_SESSION['tete']."'"; |
|
439 |
+ $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
440 |
+ |
|
441 |
+ $tableauReponse=mysqli_fetch_assoc($resultat); |
|
442 |
+ $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; |
|
443 |
+ $_SESSION['Aug_For'] += $tableauReponse['aug_For']; |
|
444 |
+ $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; |
|
445 |
+ $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; |
|
446 |
+ $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; |
|
447 |
+ $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; |
|
448 |
+ |
|
449 |
+} |
|
450 |
+function CalculCaractAugmentee($var){ |
|
451 |
+ $_SESSION['IntAug'] = $_SESSION['Aug_Int'] + $_SESSION['Int']; |
|
452 |
+ $_SESSION['VitAug'] = $_SESSION['Aug_Vit'] + $_SESSION['Vit']; |
|
453 |
+ $_SESSION['ForAug'] = $_SESSION['Aug_For'] + $_SESSION['For']; |
|
454 |
+ $_SESSION['SagAug'] = $_SESSION['Aug_Sag'] + $_SESSION['Sag']; |
|
455 |
+ $_SESSION['ChaAug'] = $_SESSION['Aug_Cha'] + $_SESSION['Cha']; |
|
456 |
+ $_SESSION['DexAug'] = $_SESSION['Aug_Dex'] + $_SESSION['Dex']; |
|
457 |
+ if($var == TRUE){ |
|
458 |
+ $_SESSION['VitActuelleAug'] = $_SESSION['Aug_Vit'] + $_SESSION['VitActuelle']; |
|
459 |
+ } |
|
460 |
+} |
|
461 |
+function maxCent($variable){ |
|
462 |
+ if ($variable> 100){ |
|
463 |
+ return(100); |
|
464 |
+ }else if($variable<1){ |
|
465 |
+ return(1); |
|
466 |
+ }else{ |
|
467 |
+ return($variable); |
|
468 |
+ } |
|
469 |
+} |
|
470 |
+function recuperationNomObjetLaisser($id){ |
|
471 |
+ $req = "SELECT nom FROM objets WHERE id_objets='".$id."'"; |
|
472 |
+ $sql = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); |
|
473 |
+ $data = mysql_fetch_row($sql); |
|
474 |
+ return $data[0]; |
|
475 |
+} |
|
476 |
+ |
|
477 |
+function ChangementTexteSexe($homme,$femme){ |
|
478 |
+ if($_SESSION['Sexe']==1){ |
|
479 |
+ return $homme; |
|
480 |
+ }else{ |
|
481 |
+ return $femme; |
|
482 |
+ } |
|
483 |
+} |
|
484 |
+?> |