$_SESSION['FatigueMax']){ $_SESSION['FatigueActuelle']=$_SESSION['FatigueMax']; } }else{ $_SESSION['FatigueActuelle'] -= $nb; if($_SESSION['FatigueActuelle']<0){ $_SESSION['FatigueActuelle']=0; header("location: fatigue.php"); } } } function ChangementVie($nb,$retrait){ if($retrait == 0){ $_SESSION['VitActuelleAug'] += $nb; $_SESSION['VitActuelle'] += $nb; if($_SESSION['VitActuelleAug']>$_SESSION['VitAug']){ $_SESSION['VitActuelleAug']=$_SESSION['VitAug']; } if($_SESSION['VitActuelle']>$_SESSION['Vit']){ $_SESSION['VitActuelle']=$_SESSION['Vit']; } }else{ $_SESSION['VitActuelleAug'] -= $nb; $_SESSION['VitActuelle'] -= $nb; if($_SESSION['VitActuelle']<0){ $_SESSION['VitActuelle']=0; } if($_SESSION['VitActuelleAug']<0){ $_SESSION['VitActuelleAug']=0; header("location: mort.php"); } } } function ChangementEnergieCombat($nb,$retrait,$lequel){ if($lequel==0){ //on enleve de l'energie a l'ennemi if($retrait == 0){ $_SESSION['ennemiFatigue'] += $nb; if($_SESSION['ennemiFatigue']>$_SESSION['ennemiFatigueMax']){ $_SESSION['ennemiFatigue']=$_SESSION['ennemiFatigueMax']; } }else{ $_SESSION['ennemiFatigue'] -= $nb; if($_SESSION['ennemiFatigue']<0){ $_SESSION['ennemiFatigue']=0; } } }else{ //on enleve de l'energie au perso if($retrait == 0){ $_SESSION['FatigueActuelle'] += $nb; if($_SESSION['FatigueActuelle']>$_SESSION['FatigueMax']){ $_SESSION['FatigueActuelle']=$_SESSION['FatigueMax']; } }else{ $_SESSION['FatigueActuelle'] -= $nb; if($_SESSION['FatigueActuelle']<0){ $_SESSION['FatigueActuelle']=0; } } } } function ChangementPoids($AlimentTresNutritif){ if($AlimentTresNutritif == 0){ $_SESSION['Poids']++; }elseif($AlimentTresNutritif == 1){ $_SESSION['Poids']--; } if($_SESSION['Poids']>5){ $_SESSION['Poids']=5; }else if($_SESSION['Poids']<1){ $_SESSION['Poids']=1; } } function ChangementOr($combien,$retrait){ if($retrait==0){ $_SESSION['Or'] += $combien; }else{ $_SESSION['Or'] -= $combien; } } function ChangementVariableHistoire($laquelle,$valeur){ mysql_query("UPDATE histoire SET ".$laquelle."='".$valeur."' WHERE id = '".$_SESSION['id']."'")or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); } function ChangementHeureJournee(){ //raz des encas qui font changer de journee $_SESSION['enCas'] = 1; //augmentation du compteur de l'heure de la journée $_SESSION['repas']++; //test pour savoir si on change de journée if($_SESSION['repas']>3){ $_SESSION['repas']=0; $_SESSION['Age']++; $_SESSION['couple']=0; } } function SauvegardeHistoire(){ $chaine = check_ChaineDeCaracteres($_SESSION['passeHeroique']); $req = 'UPDATE sorcier SET passeHeroiqueSorcier = "'.$chaine.'" WHERE id = "'.$_SESSION["id"].'"'; mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); } function Sauvegarde($endroit){ //remise a zero des compteurs encas et boissons $_SESSION['biereBu'] = 0; if($endroit==1){ //ca ne marche que pour le moment ou l'on dort dans la taverne... ChangementHeureJournee(); } CalculAugmentationCarac(); //insertion des nouvelles caracteristiques $req = "UPDATE sorcier SET Niveau = '".$_SESSION['Niveau']."' ," ."Intelligence = '".$_SESSION['Int']."' ," ."Vitalite = '".$_SESSION['Vit']."' ," ."Forc = '".$_SESSION['For']."' ," ."Charisme = '".$_SESSION['Cha']."' ," ."Dexterite = '".$_SESSION['Dex']."' ," ."Sagesse = '".$_SESSION['Sag']."' ," ."VitActuelle = '".$_SESSION['VitActuelle']."' ," ."FatigueMax = '".$_SESSION['FatigueMax']."' ," ."FatigueActuelle = '".$_SESSION['FatigueActuelle']."' ," ."PiecesOr = '".$_SESSION['Or']."' ," ."Poids = '".$_SESSION['Poids']."' ," ."Age = '".$_SESSION['Age']."' ," ."Dieu = '".$_SESSION['Dieu']."' ," ."Heure= '".$_SESSION['repas']."' ," ."N_pomme = '".$_SESSION['N_pomme']."' ," ."N_viandeSeche = '".$_SESSION['N_viandeSeche']."' ," ."N_orange = '".$_SESSION['N_orange']."' ," ."N_pain = '".$_SESSION['N_pain']."' ," ."N_chocolat = '".$_SESSION['N_chocolat']."' ," ."N_lait = '".$_SESSION['N_lait']."' ," ."experience = '".$_SESSION['xp']."' ," ."experienceMax = '".$_SESSION['xpMax']."'" ." WHERE id = '".$_SESSION['id']."'"; CalculCaractAugmentee(TRUE); //insertion des nouvelles valeurs de l'histoire $req2 = "UPDATE histoire SET taverne= '".$_SESSION['taverne']."' ," ."taverneRumeur= '".$_SESSION['taverneRumeur']."'," ."taverneRat= '".$_SESSION['taverneRat']."' ," ."arrivee= '".$_SESSION['arrivee']."' ," ."erudit= '".$_SESSION['erudit']."' ," ."pretre= '".$_SESSION['pretre']."' ," ."egliseRumeur= '".$_SESSION['egliseRumeur']."' ," ."egliseZombis= '".$_SESSION['egliseZombis']."' ," ."joueurs= '".$_SESSION['joueurs']."' ," ."nains= '".$_SESSION['nains']."' ," ."nainsHumeur= '".$_SESSION['nainsHumeur']."' ," ."nudite= '".$_SESSION['nudite']."' ," ."couple= '".$_SESSION['couple']."' ," ."bagueMaisonCouple= '".$_SESSION['bagueMaisonCouple']."' ," ."tavernier= '".$_SESSION['tavernier']."' ," ."forgeron= '".$_SESSION['forgeron']."' ," ."Sauvegarde= '".$endroit."'" ." WHERE id = '".$_SESSION['id']."'"; //insertion des nouveaux ou anciens objets $req3 = "UPDATE sac SET id_objets1 = '".$_SESSION['objets1']."' ," ."id_objets2 = '".$_SESSION['objets2']."' ," ."id_objets3 = '".$_SESSION['objets3']."' ," ."id_objets4 = '".$_SESSION['objets4']."'" ."WHERE id_sorcier = '".$_SESSION['id']."'"; //insertion des nouveaux ou anciens equipement $req4 = "UPDATE equipement SET id_tete = '".$_SESSION['tete']."' ," ."id_mainGauche = '".$_SESSION['mainGauche']."' ," ."id_mainDroite = '".$_SESSION['mainDroite']."' ," ."id_corps = '".$_SESSION['corps']."' ," ."id_mains = '".$_SESSION['mains']."' ," ."id_jambes = '".$_SESSION['jambes']."' ," ."id_pieds = '".$_SESSION['pieds']."' ," ."id_doigt1 = '".$_SESSION['doigt1']."' ," ."id_doigt2 = '".$_SESSION['doigt2']."' ," ."Sac = '".$_SESSION['sac']."'" ."WHERE id_sorcier = '".$_SESSION['id']."'"; mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); mysql_query($req2)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); mysql_query($req3)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); mysql_query($req4)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); } function AfficheBarreDEtat($pageactuelle){ echo "" ."" ."" ."" ."" ."" ."
POINTS DE VIE: ".$_SESSION['VitActuelleAug']."/".$_SESSION['VitAug']." "; AfficheImgBarre(0,$_SESSION['VitActuelleAug'],$_SESSION['VitAug']); echo "FATIGUE: ".$_SESSION['FatigueActuelle']."/".$_SESSION['FatigueMax']." "; AfficheImgBarre(1,$_SESSION['FatigueActuelle'],$_SESSION['FatigueMax']); echo "OR: ".$_SESSION['Or']." pièces.
"; if($pageactuelle==0){ echo "Fiche De ".$_SESSION['Prenom'].""; } echo "
"; } function AfficheImgBarre($QuelleBarre,$Actuel,$Max){ switch($QuelleBarre){ case 0: $image="images/barreHP.gif"; break; case 1: $image="images/barreFatigue.gif"; break; case 2: $image="images/barreXp.gif"; break; } echo "" .""; $nbVie= round((100*$Actuel)/$Max)*2; echo ""; $nbMort= (200-$nbVie); echo ""; echo "" ."
" ."" ."" ."" ."
"; } function typeAliment($nbAliment){ switch($nbAliment){ case 1: return("fruit"); break; case 2: return("protéine"); break; case 3: return("agrume"); break; case 4: return("feculent"); break; case 5: return("gourmandise"); break; case 6: return("laitage"); break; } } function CalculAugmentationCarac(){ //mise a zero des augmentation de caracteristiques $_SESSION['Aug_Int'] = 0; $_SESSION['Aug_For'] = 0; $_SESSION['Aug_Vit'] = 0; $_SESSION['Aug_Cha'] = 0; $_SESSION['Aug_Dex'] = 0; $_SESSION['Aug_Sag'] = 0; //ajout des augmentation des caracteristiques //sur le corps $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM corps WHERE id_corps='".$_SESSION['corps']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur les doigts de la main gauche $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM doigt WHERE id_doigt='".$_SESSION['doigt1']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur les doigts de la main droite $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM doigt WHERE id_doigt='".$_SESSION['doigt2']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur les jambes $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM jambes WHERE id_jambes='".$_SESSION['jambes']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur la main Droite $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM maindroite WHERE id_maindroite='".$_SESSION['mainDroite']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur la main gauche $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM maingauche WHERE id_maingauche='".$_SESSION['mainGauche']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur les mains $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM mains WHERE id_mains='".$_SESSION['mains']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur les pieds $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM pieds WHERE id_pieds='".$_SESSION['pieds']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; //sur la tete $req = "SELECT aug_Int,aug_For,aug_Vit,aug_Cha,aug_Dex,aug_Sag FROM tete WHERE id_tete='".$_SESSION['tete']."'"; $resultat = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $tableauReponse=mysqli_fetch_assoc($resultat); $_SESSION['Aug_Int'] += $tableauReponse['aug_Int']; $_SESSION['Aug_For'] += $tableauReponse['aug_For']; $_SESSION['Aug_Vit'] += $tableauReponse['aug_Vit']; $_SESSION['Aug_Cha'] += $tableauReponse['aug_Cha']; $_SESSION['Aug_Dex'] += $tableauReponse['aug_Dex']; $_SESSION['Aug_Sag'] += $tableauReponse['aug_Sag']; } function CalculCaractAugmentee($var){ $_SESSION['IntAug'] = $_SESSION['Aug_Int'] + $_SESSION['Int']; $_SESSION['VitAug'] = $_SESSION['Aug_Vit'] + $_SESSION['Vit']; $_SESSION['ForAug'] = $_SESSION['Aug_For'] + $_SESSION['For']; $_SESSION['SagAug'] = $_SESSION['Aug_Sag'] + $_SESSION['Sag']; $_SESSION['ChaAug'] = $_SESSION['Aug_Cha'] + $_SESSION['Cha']; $_SESSION['DexAug'] = $_SESSION['Aug_Dex'] + $_SESSION['Dex']; if($var == TRUE){ $_SESSION['VitActuelleAug'] = $_SESSION['Aug_Vit'] + $_SESSION['VitActuelle']; } } function maxCent($variable){ if ($variable> 100){ return(100); }else if($variable<1){ return(1); }else{ return($variable); } } function recuperationNomObjetLaisser($id){ $req = "SELECT nom FROM objets WHERE id_objets='".$id."'"; $sql = mysql_query($req)or exit('Erreur ' . mysqli_errno() . ' : ' . mysqli_error()); $data = mysql_fetch_row($sql); return $data[0]; } function ChangementTexteSexe($homme,$femme){ if($_SESSION['Sexe']==1){ return $homme; }else{ return $femme; } } ?>