403Webshell
Server IP : 109.234.162.214  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64
User : carpe ( 1178)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/carpe/public_html/CURSED/V3/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/carpe/public_html/CURSED/V3/cursedV3save.php
<?php

session_start();
if(isset($_SESSION['login'])){
    
}else{
    header("Location: first.php");
}

if(isset($_POST['decon_x'])){
    echo "heeeeeeeee";
    if (isset($_SESSION['login'])) {
        unset($_SESSION['login']);
        session_destroy();
        header("Location: first.php");
    }
}


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CURSED</title>
    <link rel="icon" type="image/png" href="images/coin2.png">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap" rel="stylesheet">
    
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&family=VT323&display=swap" rel="stylesheet">
<style>
    body{
        width:100%;
        height:100vh;
        background:url('images/texture.png');
        background-size:cover;
        margin:0;
        padding:0;
        font-family: "Pixelify Sans", serif;
        font-optical-sizing: auto;
        font-weight: <weight>;
        font-style: normal;
        position:fixed;
    }
    
    #menu_principal{
        width:28%;
        height:100%;
        position:relative;
        z-index:10;
        min-width:450px;
        background:url('images/texture.png');
        background-size:cover;
        box-shadow: 8px 0px 2px 1px rgba(0, 0, 0, 0.5);
    }
    
    
    
    #canvas{
        position:absolute;
        width:1200px;
        height:780px;
        top:50%;
        left:60%;
        transform:translate(-50%,-50%);
        background-image:url('images/skyV2.png');
    	background-size:cover;
    	background-position:center;
    	image-rendering: pixelated;
    	overflow:hidden;
    	border:4px #543626 solid;
    	box-shadow: 8px 8px 2px 1px rgba(0, 0, 0, 0.5);
    }
    
    #eau{
        position:absolute;
        left:0;
        width:100%;
        z-index:2;
        bottom:0px;
    }
    
    #radeau{
        width:220px;
        height:120px;
        position:absolute;
        bottom:70px;
        z-index:4;
        left:400px;
    }
    

    
    #texture_map{
        width:97%;
        height:100%;
        background:#BCA489;
        
    }
    .logo{
        position:relative;
        left:42px;
        top:10px;
        width:80%;
    }
    
    .titre1{
        position:relative;
        left:35px;
        text-decoration:underline;
        color:#543626;
    }
    
    #infos_perso{
        margin-left:30px;
        margin-right:30px;
        display:flex;
        align-items:center;
        justify-content:space-between;
        gap:20px;
    }
    
    #infos_right{
        display:flex;
        flex-wrap:wrap;
        gap:15px;
    }
    
    .infos{
        display:flex;
        align-items:center;
        margin:0;
        width:100%;
        gap:5px;
    }
    
    .infos img{
        width:25px;
    }
    
    .infos h2{
        margin:0;
        padding:0;
        color:#543626;
    }
    
    .infos_cont{
        display:flex;
        justify-content:space-between;
        align-items:center;
        width:100%;
    }
    
    #inventaire{
        padding-left:35px;
        margin:50px;
        margin-top:0px;
        width:73%;
        height:160px;
        background:url('images/texture_inv.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        padding-top:30px;
        position:relative;
        display:flex;
        flex-wrap:wrap;
        gap:25px;
        align-items:start;
        overflow:auto;
        padding-bottom:40px;
        margin-bottom:0;
    }
    
    #titre_inv{
        background:url('images/texture_texte.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        display:inline;
        padding:5px 15px 5px 15px;
        color:#543626;
        position:relative;
        top:10px;
        left:30%;
        transform:translate(-50%);
        z-index:1001;
    }
    
    #inventaire div .hey{
        width:100%;
    }
    
    #inventaire div{
        background:url('images/case.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        width:25%;
        height:80px;
        display:flex;
        justify-content:center;
        align-items:center;
        position:relative;
        cursor:pointer;
        transition:.5s all;
    }
    #inventaire div:hover{
        transform:scale(1.05);
        transition:.5s all;
    }
    
    #bip{
        position:absolute;
        left:400px;
        z-index:1002;
    }
    
    .fishing_astuce img{
        width:40px;
        z-index:1003;
        position:relative;
        top:-10px;
    }
    
    .fishing_astuce p{
        width:300px;
        color:#543626;
        background:#BCA489;
        padding:10px 15px 10px 15px;
         background:url('images/texture_texte.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        position:absolute;
        top:-10px;
        left:20px;
        z-index:1002;
        display:none;
    }
    
    #info_bateau{
        width:160px;
    }
    
    #error_message{
        display:none;
    }
    
    #error_mess{
        display:none;
    }
    
    #money{
        margin-left:40px;
        margin-right:40px;
        margin-top:10px;
        display:flex;
        align-items:center;
        gap:20px;
        justify-content:center;
        width:80%;
        color:#543626;
    }
    
    #quests{
        margin-left:40px;
        width:84%;

        color:#543626;
    }
    
    #quests div{
        display:flex;
        justify-content:space-around;
        align-items:center;
        margin:10px;
        gap:10px;
    }
    
    #quests div h3{
        margin:0;
        padding:0;
    }
    
    #sauvegarder{
        background:url('images/save.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        display:inline;
        position:relative;
        left:24%;
        transform:translate(-50%);
        color:#BCA489;
        text-decoration:underline;
        padding:10px 20px 10px 20px;
        top:20px;
        cursor:pointer;
        transition:.5s all;
    }
    
    #sauvegarder:hover{
        font-size:2.1rem;
    }
    
    @media screen and (max-width: 1100px) {
        #responsive{
            width:100%;
            height:100%;
            z-index:999;
            backdrop-filter: blur(3px);
            background: rgba(255, 255, 255, 0.2);
            position:absolute;
            display:flex;
            justify-content:center;
            align-items:center;
        }
        
        #error_message{
            display:block;
            background:red;
            margin:30px;
            text-align:center;
            height:30%;
            display:flex;
            flex-wrap:wrap;
            justify-content:center;
            align-items:center;
            background:url('images/bg.png');
            background-size: 100% 100%;
            background-repeat: no-repeat; /* Pour éviter la répétition */
            background-position: center;
            padding:10px;
            color:#543626;
            position:relative;
        }
        
        #error_mess{
            display:block;
            position:absolute;
            z-index:1000;
            top:-10px;
            right:-10px;
            width:50Px;
        }
        
        body{
            position:fixed;
        }
    }
    
    #deco{
        position:absolute;
        bottom:35px;
        left:35px;
        z-index:1003;
        width:50px;
        
    }

    
    #bip2{

        left:340px;
        position:relative;
        bottom:30px;
        
        display:none;
    }
    
    #golds{
        font-family: "VT323", serif;
          font-weight: 1200;
          font-style: normal;
          font-size:2.6rem;
          margin:0;
          padding:0;
    }
    
    #fishing_road{
        position:absolute;
        z-index:100;
        left:584px;
        bottom:65px;
        width:130px;
        display:none;
    }
    #fishing_road0{
        position:absolute;
        z-index:100;
        left:584px;
        bottom:65px;
        width:130px;
        display:none;
        transition:.5s bottom;
    }
    
    #fished{
        position:absolute;
        bottom:20px;
        left:45%;
        transform:translate(-50%);
        z-index:101;
        font-size:1.3rem;
        background-image:url('images/texture_texte.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        padding:10px 15px 15px 15px;
        text-align:center;
        color:#50321d;
        cursor:pointer;
        transition:.5s all;
        display:none;
    }
    
    .quant{
        position:absolute;
        top:-10px;
        left:-10px;
        width:30px;
        z-index:1;
    }

    .quantite{
        position:absolute;
        top:-7px;
        left:0px;
        z-index:2;
        margin:0;
        padding:0;
        color:#50321d;
        font-family: "VT323", serif;
          font-weight: 1200;
          font-style: normal;
          font-size:1.6rem;
    }  
    
    .quantite2{
        position:absolute;
        top:-7px;
        left:-3px;
        z-index:2;
        margin:0;
        padding:0;
        color:#50321d;
        font-family: "VT323", serif;
          font-weight: 1200;
          font-style: normal;
          font-size:1.6rem;
    }    
    
    #clouds{
        position:absolute;
        top:-100px;
    }
    
    #clouds2{
        position:absolute;
        left:1200px;
        top:-100px;
    }
    
    #map2{
        width:70%;
        position:absolute;
        z-index:100;
        left:50%;
        top:50%;
        transform:translate(-50%,-50%);
        display:none;
    }
    
    #notifs{
        position:absolute;
        bottom:20px;
        font-size:1.6rem;
        left:55%;
        transform:translate(-50%);
        color:#986623;
        
    }
    
    #ile{
        width:600px;
        position:absolute;
        bottom:125px;
        z-index:2;
        left:1200px;
    }
    
    #menu_ile{
        width:25%;
        height:100%;
        position:absolute;
        z-index:10;
        min-width:400px;
        right:0;
        background:url('images/texture.png');
        background-size:cover;
        box-shadow: -8px 0px 2px 1px rgba(0, 0, 0, 0.5);
        display:none;
    }
    
    #ile_name{
        color:#BCA489;
        text-decoration:underline;
        margin:20px;
        font-size:3rem;
    }
    
    #ile_desc{
        margin:20px;
        width:80%;
        background-image:url('images/texture_ile_1.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        padding:15px;
        color:#543626;
        font-weight:600;
    }
    
    #menu_buy{
        margin-left:22px;
        margin-top:10px;
    }
    
    #titres_buy{
        display:flex;
        margin:0;
    }
    
    #contain_buy{
        padding-top:20px;
        width:356px;
        height:180px;
         background-image:url('images/contain_buy.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        z-index:3;
        position:relative;
        bottom:25px;
        display:flex;
        overflow:auto;
        flex-wrap:wrap;
        gap:25px;
        align-items:start;
        padding-bottom:30px;
        padding-left:15px;

    }
    
    .contain1{
        display:flex;
        align-items:start;
        gap:20px;
        color:#543626;
        width:95%;
        position:relative;
    }
    
    .achet{
        color:#BCA489;
        text-decoration:none;
        cursor:pointer;
        background:url('images/save.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        text-align:center;
    }
    
    .vend{
        color:#BCA489;
        text-decoration:none;
        cursor:pointer;
        background:url('images/save.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        text-align:center;
    }
    
    .contain2{
    }
    
    .contain2 div{
        display:flex;
        gap:5px;
    }
    
    .contain1 h2{
        margin:0;
        padding:0;
        
        text-decoration:underline
    }
    
    .contain1 h3{
        margin:0;
        padding:0;
    }
    .g{
        cursor:pointer;
    }
    
    .d{
        cursor:pointer;
    }
    
    #contain_buy div img{
        width:100px;
        height:100px;
        background-image:url('images/case_buy.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
    }
    
#contain_sell div img{
        width:100px;
        height:100px;
        background-image:url('images/case_sell.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
    }


    
 #contain_sell{
        padding-top:20px;
        width:356px;
        height:180px;
         background-image:url('images/contain_sell.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        z-index:3;
        position:relative;
        bottom:25px;
        display:flex;
        overflow:auto;
        flex-wrap:wrap;
        gap:25px;
        align-items:start;
        padding-bottom:30px;
        padding-left:15px;
        display:none;

    }
    
    #buy{
        margin:0;
        background-image:url('images/buy.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        padding:5px 30px 25px 30px;
        color:#543626;
        text-decoration:underline;
        z-index:2;
        position:relative;
        cursor:pointer;
    }
    
    #sell{

        margin:0;
        background-image:url('images/sell.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        padding:5px 35px 30px 39px;
        color:#543626;
        text-decoration:underline;
        z-index:1;
        position:relative;
        right:10px;
        cursor:pointer;
    }
    
    #repair{
        color:#D7B68F;
        text-decoration:underline;
        margin-left:25px;
        cursor:pointer;
    }
    
    #contain_repair{
        display:flex;
        align-items:center;
        gap:10px;
        color:#D7B68F;
    }
    
    #contain_repair img{
        width:30px;
    }
    
    #talk{
        color:#D7B68F;
        text-decoration:underline;
        margin-left:25px;
        cursor:pointer;
        margin-top:0;
    }
    
    #talk_div{
        margin-left:22px;
        width:87%;
        height:130px;
        background-image:url('images/talk_case.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        display:flex;
        gap:20px;
        align-items:end;
        justify-content:space-around;
    }
    
    #talk_div img{
        width:auto;
        height:100px;
        cursor:pointer;
    }
    
    #leave{
        background:url('images/leave_bg.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        display:inline;
        position:relative;
        left:20%;
        transform:translate(-50%);
        color:#543626;
        text-decoration:underline;
        padding:10px 20px 10px 20px;
        top:35px;
        cursor:pointer;
        transition:.5s all;

    }
    
    #leave:hover{
        font-size:2.1rem;
    }
    
    .div_select{
        position:absolute;
        bottom:-30px;
        right:-10px;
        color:#543626;
        width:auto;
        display:flex;
    }
    
    .h2g{
        cursor:pointer;
    }
    
    .h2d{
        cursor:pointer;
    }

    #notif{
        background-image:url('images/notif2.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        width:600px;
        position:absolute;
        top:110Px;
        z-index:999;
        left:59%;
        transform:translate(-50%);
        padding-bottom:15px;
        display:none;
    }
    
    #notif img{
        width:40px;
        position:absolute;
        top:-15px;
        left:-15px;
    }
    
    #notif h2{
        color:#543626;
        text-decoration:underline;
        margin:0;
        padding:0;
        margin-top:10px;
        margin-left:20Px;
    }
    
    #notif p{
        color:#543626;
        margin:0;
        padding:0;
        margin-top:10px;
        margin-left:20Px;
        font-weight:600;
    }
    
    #dialogue{
        position:absolute;
        background-image:url('images/dialogue.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        width:600px;
        left:38%;
        top:50%;
        transform:translate(-50%,-50%);
        z-index:100;
        display:flex;
        align-items:center;
        padding:50px;
        gap:20px;
        display:none;
    }
    
    #ancre{
        position:absolute;
        background-image:url('images/dialogue.png');
        background-size: 100% 100%;
        background-repeat: no-repeat; /* Pour éviter la répétition */
        background-position: center;
        width:600px;
        left:38%;
        top:50%;
        transform:translate(-50%,-50%);
        z-index:101;
        padding:30px;
        padding-top:10px;
        padding-bottom:10px;
        display:none;
    }
    
    #ancre h1{
        color:#543626;
        text-align:center;
        text-decoration:underline;
    }
    
    #ancre h2{
        color:#543626;
        margin-left:20px;
        cursor:pointer;
    }
    
    
    
    #bord{
        height:65%;
    }
    
    #left{
        color:#543626;
        text-align:center;
        
    }
    
    #nom{
        margin:0;
        padding:0;
        text-decoration:underline;
    }
    
    #metier{
        margin:0;
        padding:0;
    }
    
    #left img{
        width:200px;
    }
    
    #right{
        color:#543626;
        position:relative;
        height:300px;
    }
    
    #right a{
        text-decoration:underline;
        font-weight:500;
    }
    
    #vous{
        position:absolute;
        bottom:10px;
    }
    
    #vous a{
        margin:0;
        padding:0;
    }
    
    #vous p{
        margin:0;
        margin-top:3px;
        padding:0;
        cursor:pointer;
    }
    
    #vous p:hover{
        text-decoration:underline;
    }
    
    .outside{
        position:absolute;
        top:-23px;
        right:-15px;
        cursor:pointer;
        z-index:1003;
        width:50px;
    }
    
    
    

</style>
<body>
    <form method='post' action='cursedV3.php'>
        <input id='deco' type='image' name='decon' src='images/deco.png'>
    </form>
    <div id='responsive'>
        <div id='error_message'>
            <h2>Désolé... Le jeu n’est encore pas disponible pour votre format d’écran. </h2>
            <h2>Il est recommandé de jouer sur un ordinateur, </h2>
            <img id='error_mess' src='images/error.png'>
        </div>
    </div>
    <div id='menu_ile'>
        <h1 id='ile_name'>Seavy Bay</h1>
        <h3 id='ile_desc'>1ère ile du jeu, elle constitue la 1ère île de l’archipel. La plupart des voyageurs s’arrêtent ici pour se réapprovisionner, avant de s’en aller vers la capitale.</h3>
        <div id='contain_repair'>
            <h2 id='repair'>- Améliorer le bateau</h2>
            <h2 id='prix5'>100</h2>
            <img src='images/coin2.png'>
        </div>
        <div id='menu_buy'>
            <div id='titres_buy'>
                <h1 id='buy'>Acheter</h1>
                <h1 id='sell'>Vendre</h1>
            </div>
            <div id='contain_buy'>
                
                
            </div>
            <div id='contain_sell'>

            </div>
        </div>
        <h2 id='talk'>- Discuter</h2>
        <div id='talk_div'>
            
        </div>
        <h1 id='leave'>Lever l'ancre</h1>
    </div>
    <div id='menu_principal'>
        <div id='texture_map'>
            <img class='logo' src='images/logo2.png'> 
            <h1 class='titre1'>Informations :</h1>
            <div id='infos_perso'>
                <img id='info_bateau' src='images/radeau.png'>
                <div id='infos_right'>
                    <div class='infos'>
                        <img class='icon' src='images/heart2.png'>
                        <div class='infos_cont'>
                            <h2>- Vie</h2>
                            <h2 id='life'>100%</h2>
                        </div>
                    </div>
                    <div class='infos'>
                        <img class='icon' src='images/food.png'>
                        <div class='infos_cont'>
                            <h2>- Vivres</h2>
                            <h2 id='food'>100%</h2>
                        </div>
                    </div>
                </div>
            </div>
            <div id='money'>
                <img src='images/coin2.png'>
                <h1 id='golds'>100</h1>
                <h1>pièces d'or</h1>
            </div>
            <h1 id='titre_inv'>Inventaire</h1>
            <div id='bip' class='fishing_astuce'>
                <img src='images/error.png'>
                <p>
                    Cliquer sur un des objets de l'inventaire pour intéragir avec.
                </p>
            </div>
            
            <div id='inventaire'>
                
            </div>
            <h1 class='titre1'>Quetes :</h1>
            <div id='quests'>
                <div>
                    <img src='images/case2.png'>
                    <h3>Fouillez votre inventaire pour comprendre ce qui vous est arrivé</h3>
                </div>

            </div>
            <h1 id='sauvegarder'>Sauvegarder</h1>
            <div id='bip2' class='fishing_astuce'>
                <img src='images/error.png'>
                <p>
                    Permet de sauvegarder votre progression (position, vie, or, inventaire, etc...)
                </p>
            </div>
        </div>
    </div>
    <img src='images/map.png' id='map2'>
    <div id='canvas'>
        <div id='ancre'>
            <h1>Lever l'ancre</h1>
            <img class='outside' id='outside1' src='images/deco.png'>
            <h2>Seavy Bay</h2>
            <h2>The Last Outpost</h2>
            <h2>East Prison</h2>
            <h2>Loadly Ridges</h2>
            <h2>End Valley</h2>
        </div>
        <div id='dialogue'>
            <img class='outside' id='outside' src='images/deco.png'>
            <div id='left'>
                <img src='images/pirate1.png'>
                <h2 id='nom'>Halls Brook</h2>
                <h2 id='metier'>Barman</h2>
            </div>
            <img src='images/bord.png' id='bord'>
            <div id='right'>
                <p><a>Halls Brook :</a> 1ère ile du jeu, elle constitue la 1ère île de l’archipel. La plupart des voyageurs s’arrêtent ici pour se réapprovisionner, avant de s’en aller vers la capitale.</p>
                <div id='vous'>
                    <a>Vous :</a>
                    <p> - l’archipel. La plupart des voyageurs s’arrêtent ici pour se réapprovisionner, avant</p>
                    <p> - l’archipel. La plupart des voyageurs s’arrêtent ici pour se réapprovisionner, avant</p>
                </div>
            </div>
        </div>
        <img id='eau' src='../aie/Untitled00086401.png'>
        <img src='images/clouds3.png' id='clouds'>
        <img src='images/clouds3.png' id='clouds2'>
        <img src='../images/ile1.png' id='ile'>
        <img id='radeau' class='boat' src='../images/bateau1.png'>
        <img id='fishing_road' class='boat' src='../images/fishing_road11.png'>
        <img id='fishing_road0' class='boat' src='../images/fishing_road0.png'>
        <h2 id='fished'>Pécher le poisson</h2>
    </div>
    <div id='notifs'>
        
    </div>
    <div id='notif'>
        <img src='images/error.png'>
        <h2>Notification :</h2>
        <p id='edit'>Vous avez attrapé un poisson !</p>
    </div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>


/**
Seavy Bay = ile 1
The Last Outpost = ile 2;
Loadly Ridges = ile 3;
East prison = ile 4;
End Valley = ile 5;

Seavy Bay -> The last Outpost = 6
Seavy Bay -> Loadly Ridges = 7;
The Last Outpost -> Seavy Bay = 8;
The Last Outpost -> Loadly Ridges = 9;
The Last Outpost -> East Prison = 10;
Loadly Ridges -> Seavy Bay = 11;
Loadly Ridges -> The last Outpost -> 12;
Loadly Ridges -> End Valley -> 13;

 **/


$('#outside').on('click',function(){
    $('#dialogue').css('display','none')
})


$('#outside1').on('click',function(){
    $('#ancre').css('display','none')
})

$('#sell').on('click',function(){
    $('#buy').css('z-index','1');
    $('#sell').css('z-index','2');
    $('#contain_buy').css('display','none');
    $('#contain_sell').css('display','flex')
})

$('#buy').on('click',function(){
    $('#buy').css('z-index','2');
    $('#sell').css('z-index','1');
    $('#contain_buy').css('display','flex');
    $('#contain_sell').css('display','none')
})

var touche_peche = false;
var touche_lettre=false;

var stop=false;

function menu_vendre(obj,quantite2,ile){
    
    const contain1 = document.createElement('div');
    contain1.classList.add('contain1');
    
    // Création de l'image
    const img = document.createElement('img');
    img.src = 'images/'+ obj +'.png';
    contain1.appendChild(img);
    
    // Création de la div interne
    const contain2 = document.createElement('div');
    contain2.classList.add('contain2');
    
    // Création du titre
    const title = document.createElement('h2');
    title.textContent = obj;
    contain2.appendChild(title);
    
    var prix=0;
        if(ile ==1){
            //console.log('oh')
            if(obj == "bar"){
                prix = 10;
                
            }
            if(obj == "saumon"){
                prix = 10;
            }
            if(obj == "thon"){
                prix = 10;
            }
    
        }
    //console.log(prix)
    // Création de la div pour le prix
    const priceDiv = document.createElement('div');
    const priceLabel = document.createElement('h3');
    priceLabel.textContent = 'Prix : ';
    const priceValue = document.createElement('h3');
    priceValue.textContent = prix + 'or';
    priceDiv.appendChild(priceLabel);
    priceDiv.appendChild(priceValue);
    contain2.appendChild(priceDiv);
    
    // Création de la div pour la quantité
    const quantityDiv = document.createElement('div');
    const quantityLabel = document.createElement('h3');
    quantityLabel.textContent = 'Quantite : ';
    const decreaseBtn = document.createElement('h3');
    decreaseBtn.classList.add('g');
    decreaseBtn.textContent = '<';
    const quantityValue = document.createElement('h3');
    quantityValue.textContent = quantite2;
    const increaseBtn = document.createElement('h3');
    increaseBtn.classList.add('d');
    increaseBtn.textContent = '>';
    
    decreaseBtn.addEventListener('click',function(){
        var quantite = parseInt(quantityValue.textContent, 10);
        if(quantite > 0){
            quantite--;
        }
        quantityValue.textContent = quantite;
    
        
    })
    
    increaseBtn.addEventListener('click',function(){
        var quantite = parseInt(quantityValue.textContent, 10);
        quantite++;
        quantityValue.textContent = quantite;
    })
    
    quantityDiv.appendChild(quantityLabel);
    quantityDiv.appendChild(decreaseBtn);
    quantityDiv.appendChild(quantityValue);
    quantityDiv.appendChild(increaseBtn);
    contain2.appendChild(quantityDiv);
    
    // Création du bouton d'achat
    const buyBtn = document.createElement('h2');
    buyBtn.classList.add('vend');
    buyBtn.textContent = 'Vendre';
    contain2.appendChild(buyBtn);
    
    buyBtn.addEventListener('click',function(){
        var quantite = parseInt(quantityValue.textContent, 10);
        //console.log(quantite)
        supp(obj,quantite)
        
        var sous = $('#golds').text();
        sous = parseInt(sous, 10);
        sous = sous + prix;
        $('#golds').text(sous);
        
        //supprimer dans la div;
        
        
        
        /**
        var sous = $('#golds').text();
        console.log(prix)
        var result = sous - prix;
        if(result >= 0){
            var quantite = parseInt(quantityValue.textContent, 10);
            sous = sous - prix * quantite;
            $('#golds').text(sous)
            
            //ajouter quant à l'inventaire 
            
            add(obj,quantite)
        }else{
            notif("Vous n'avez pas assez d'argent !")
        }
        **/
    })
    
    // Ajout de contain2 à contain1
    contain1.appendChild(contain2);
    
    
    $('#contain_sell').append(contain1)
}

///

function pop_ile(num){
    var vendez = document.getElementById('#contain_sell');
    if(vendez)
    vendez.remove();
        
    var achetez = document.getElementById('#contain_buy');
    if(achetez)
    achetez.remove();
        
        
    if(bateau > 1){
        $('#contain_repair').css('display','none');
        $('#radeau').attr('src','images/b.png');
        $('#radeau').css('height','auto')
        $('#radeau').css('width','400px');
        $('#radeau').css('left','300px');
        $('#radeau').css('bottom','20px')

    }
    if(num == 1){
        var div = document.createElement('div');
        var img = document.createElement('img');
        img.setAttribute('src', 'images/pirate1.png');
        div.appendChild(img)
        $('#talk_div').append(div)
        
        var div = document.createElement('div');
        var img = document.createElement('img');
        img.setAttribute('src', 'images/pirate1.png');
        div.appendChild(img)
        $('#talk_div').append(div)
        
        var div = document.createElement('div');
        var img = document.createElement('img');
        img.setAttribute('src', 'images/pirate1.png');
        div.appendChild(img)
        $('#talk_div').append(div)
        
        var h2s = document.querySelectorAll('#ancre h2');
        h2s.forEach(item => {
            if (item.textContent.trim() === "Seavy Bay") {
                item.style.display = "none";
            }
            if (item.textContent.trim() === "End Valley") {
                item.style.display = "none";
            }
            if (item.textContent.trim() === "East Prison") {
                item.style.display = "none";
            }
        });

        
    }
    
    if(num == 2){
        var h2s = document.querySelectorAll('#ancre h2');
            h2s.forEach(item => {
                    item.style.display = "block";
            });
        //console.log('The Last Outpost')
        h2s.forEach(item => {
            if (item.textContent.trim() === "End Valley") {
                item.style.display = "none";
            }
            if (item.textContent.trim() === "The Last Outpost") {
                item.style.display = "none";
            }
        });
    }
    
    if(num == 3){
        var h2s = document.querySelectorAll('#ancre h2');
            h2s.forEach(item => {
                    item.style.display = "block";
            });
        //console.log('Loadly Ridges')
        h2s.forEach(item => {
            if (item.textContent.trim() === "Loadly Ridges") {
                item.style.display = "none";
            }
            if (item.textContent.trim() === "East Prison") {
                item.style.display = "none";
            }
        });
    }
    
    
    
    if(quest==2){
        quest++;
        $('#quests > div > h3').css('text-decoration', 'line-through');
        setTimeout(function(){
            update_quest(quest);
        },2000)
    }
    
    if(num == 1){
        //$('#radeau').css('display','none');
        stop=true;
        $('#menu_ile').css('display','block')
        //gérer le menu vendre ici..
        
        setTimeout(function(){
            var objs = document.querySelectorAll('#inventaire > div');
            objs.forEach(item =>{
                let title = item.getAttribute("title");
                let h2Text = item.querySelector("h3").textContent;
                menu_vendre(title,h2Text,num)
            })
        },1000)
        
        add_market("bar",1,1);
        add_market("item_map",1,1);
        add_market("item_journal",1,1);
        add_market("item_marchandises",1,1);
    }
    
    if(num == 3){
        //$('#radeau').css('display','none');
        stop=true;
        $('#menu_ile').css('display','block');
        
        $('#ile_name').text('Loadly Ridges')

        setTimeout(function(){
            var objs = document.querySelectorAll('#inventaire > div');
            objs.forEach(item =>{
                let title = item.getAttribute("title");
                let h2Text = item.querySelector("h3").textContent;
                menu_vendre(title,h2Text,num)
            })
        },1000)
    }
    
    if(num == 2){
        //$('#radeau').css('display','none');
        stop=true;
        $('#menu_ile').css('display','block');
        
        $('#ile_name').text('The Last Outpost')

        setTimeout(function(){
            var objs = document.querySelectorAll('#inventaire > div');
            objs.forEach(item =>{
                let title = item.getAttribute("title");
                let h2Text = item.querySelector("h3").textContent;
                menu_vendre(title,h2Text,num)
            })
        },1000)
    }
    
    
    
    $('#leave').on('click',function(){
        $('#dialogue').css('display','none');
        //regarder si une carte est dans l'inventaire, si le bateau est niv2
        var items = document.querySelectorAll('#inventaire div');
        var index_carte = 0;
        items.forEach(item=>{
            if(item.title == "item_map"){
                index_carte++;
            }
        })
        
        
        if(index_carte == 0){
            notif("Vous ne pouvez pas reprendre la mer avant d'avoir acheter une carte...")
        }else if(bateau < 2){
            notif("Améliorez votre bateau avant de reprendre la mer")
            }else{
            $('#ancre').css('display','block')
        }
        
        var h2s = document.querySelectorAll('#ancre h2')
        h2s.forEach(item=>{
            //gérer le départ / click ici
            item.addEventListener('click',function(){
                if(item.textContent == "The Last Outpost"){
                    monde = 6;
                }
                if(item.textContent == "Loadly Ridges"){
                    monde = 7;
                }
                
                $('#radeau').css('display','block');
                stop=false;
                $('#menu_ile').css('display','none')
                $('#dialogue').css('display','none')
                $('#ancre').css('display','none')
        
                gestion_ile(monde);

            })
        })
        
        
        
    });
    
    $('#repair').on('click',function(){
        var or2 = $('#golds').text();
        or2 = parseInt(or2.match(/\d+/)[0], 10)
        var prix = $('#prix5').text();
        prix = parseInt(prix.match(/\d+/)[0], 10)
        if(or2 >= prix){
            or('moins',prix);
            $('#contain_repair').css('display','none');
            bateau++;

            $('#radeau').attr('src','images/b.png');
            $('#radeau').css('height','auto')
            $('#radeau').css('width','400px');
            $('#radeau').css('left','300px');
            $('#radeau').css('bottom','20px');
        }else{
            notif("Vous n'avez pas assez d'argent")
        }
        
        
    })
    
    /**
    $('#leave').on('click',function(){
        monde++;
        
        $('#radeau').css('display','block');
        stop=false;
        $('#menu_ile').css('display','none')
        $('#dialogue').css('display','none')

        gestion_ile(monde);
    })
    **/
    
    var persos = document.querySelectorAll('#talk_div img');
    persos.forEach(item =>{
        item.addEventListener('click',function(){
            $('#dialogue').css('display','flex');
            $('#ancre').css('display','none');
            
            var h2s = document.querySelectorAll('#ancre h2');
            h2s.forEach(item => {
                    item.style.display = "block";
            });
        })
    })
    
}

function update_quest(quest){
    //console.log('oh')
    var quetes = document.querySelectorAll('#quests div');
    quetes.forEach(item => {
        //$('#quests > div > h3').css('text-decoration', 'line-through');
        
        //changer LIMAGE POUR un BAIL BARRE ICI

            item.remove();
            
            if(quest==2){
                creer_quete("Se laisser dériver jusqu'a l'ile la plus proche pour en savoir plus")
                
                //afficher l'ile ici
                
                intervalId = setInterval(function(){
                        if(stop==false){
                            
                            var leftValue_bg = parseFloat($('#ile').css('left'));
                            var nouvelleValeurbg = leftValue_bg - 2 - vitesse;
                            //console.log(nouvelleValeurbg)
                            $('#ile').css('left', nouvelleValeurbg + 'px');
                            
                            if(nouvelleValeurbg < 220){
                                monde = 1;
                                pop_ile(1);
                                $('#ile').css('left','220px');
                                clearInterval(intervalId);
                                //GERER LE STOP + LAFIN DE LILE
                                //stop=true;
                                
                                //chercher l'inventaire et le foutre dans le market sell avec une autre mise en forme
                                
                                //$('#radeau').css('display','none');
                                
                            }
                        }
                    },40)


            }
            
            if(quest == 3){
                creer_quete("Chercher des informations sur la lettre")
            }
        
    })
    
}

function gestion_ile(monde){
    if(monde !== 6 && monde !== 7) return;

    $('#ile').css('left', '220px');

    let intervalId2 = setInterval(() => {
        if (!stop) {
            let leftValue_bg = parseFloat($('#ile').css('left'));
            let nouvelleValeurbg = leftValue_bg - 2 - vitesse;
            $('#ile').css('left', nouvelleValeurbg + 'px');
        }
    }, 40);

    let compteur = 0;
    let intervalId = setInterval(() => {
        compteur += 1 + vitesse;

        if (compteur > 500 && compteur < 800 && !stop) {
            $('#ile').css('left', '1200px');
            clearInterval(intervalId2);
        }

        if (compteur > 1200 && !stop) {
            let leftValue_bg = parseFloat($('#ile').css('left'));
            let nouvelleValeurbg = leftValue_bg - 1 - vitesse;

            $('#ile').css('left', nouvelleValeurbg + 'px');

            if (nouvelleValeurbg < 220) {
                let ileId = monde === 6 ? 2 : 3;
                pop_ile(ileId);
                $('#ile').css('left', '220px');
                clearInterval(intervalId);
            }
        }
    }, 40);
}


function creer_quete(desc){
    var img = document.createElement('img');
    var h3 = document.createElement('h3');
    img.src = 'images/case2.png';
    h3.textContent = desc;
    var div = document.createElement('div')
    div.appendChild(img)
    div.appendChild(h3);
    $('#quests').append(div)
}

var intervalId2 = setInterval(function () {
    if(touche_peche && touche_lettre && quest == 1){
        //clearInterval après
        clearInterval(intervalId2);
        quest++;
        $('#quests > div > h3').css('text-decoration', 'line-through');
        setTimeout(function(){
            update_quest(quest);
        },2000)
        
    }
},40)

/**
function notif(texte){
    $('#notifs').text(texte)
    setTimeout(function(){
        $('#notifs').text('')
    },2000)
}
**/

function notif(texte){
    var menu = $('#menu_ile').css('display');
    if(menu == 'none'){
        $('#notif').css('left','59%')
    }else{
        $('#notif').css('left','50%')
    }
    $('#notif').css('display','block')
    $('#edit').text(texte)
    setTimeout(function(){
        $('#notif').css('display','none')
    },2000)
}

setInterval(function(){
        var leftValue_bg = parseFloat($('#clouds').css('left'));
        var nouvelleValeurbg = leftValue_bg - 1;
        var leftValue_bg2 = parseFloat($('#clouds2').css('left'));
        var nouvelleValeurbg2 = leftValue_bg2 - 1;
        
        if(nouvelleValeurbg<-1200){
            nouvelleValeurbg = 1200;
        }
        
        if(nouvelleValeurbg2<-1200){
            nouvelleValeurbg2 = 1200;
        }
        //console.log(nouvelleValeurbg)
        $('#clouds').css('left', nouvelleValeurbg + 'px');
        $('#clouds2').css('left', nouvelleValeurbg2 + 'px');
},40)


////

var monde = 0;
var quest = 0;
var niv = 0;
var bateau = 0;
var mess=0;

var index10 = 0;
setInterval(function(){
    index10++
    $('#fishing_road').attr('src','../images/fishing_road1' + index10 + '.png')
    if(index10 ==4){
        index10=0;
    }
},400)

function or(plus,nb){
    var or = $('#golds').text();
    or = parseInt(or.match(/\d+/)[0], 10)
    if(plus == 'plus'){
        $('#golds').text(or + nb)
    }else{
        $('#golds').text(or - nb)
    }
}

$('#sauvegarder').on('click',function(){
    save();
})

function save(){
    var cause2 = "give";
    
    var vie4 = $('#life').text();
    vie4 = parseInt(vie4.match(/\d+/)[0], 10)
    var vivres4 = $('#food').text();
    vivres4 = parseInt(vivres4.match(/\d+/)[0], 10)
    
    var gold4 = $('#golds').text();
    //var gold5 = parseInt(gold4.match(/\d+/)[0], 10)
    
    //var niv2 = $('#niv').text();
    //var niv3 = parseInt(niv2.match(/\d+/)[0], 10)
    
    //var bateau_src = $('#radeau').attr('src');
    //var id_bateau = parseInt(bateau_src.match(/\d+/)[0], 10);
    

    
    $.ajax({
        url:'../data.php',
        data:{cause:cause2,vie:vie4,vivres:vivres4,gold:gold4,monde:monde,quest:quest,niv:niv,bateau:bateau,mess:mess},
        type:'POST',
        success: function(res){
                //console.log(res)
        }
    })
        
    cause2 = 'send2';
    let enfants = $('#inventaire').children();
    Array.from(enfants).forEach(enfant => {
        let img = enfant.querySelector('.hey');
        if (img) {
            var nom = img.src.split('/').pop().replace('.png', '');
        }
        let h3 = enfant.querySelector('.quantite');
                
        if (h3) {
            quantite = h3.textContent;
            quantite = parseInt(quantite.match(/\d+/)[0]);
            //ICI MODIFIER EN INT
            //console.log(nom)
            //console.log(quantite)
        }

        $.ajax({
            url:'../inv.php',
            data:{cause2:cause2,nom:nom,quantite:quantite},
            type:'POST',
            success: function(res){
                notif('Sauvegarde effectuée avec succès')
                //console.log(res)
            }
        })
            
    });
}



//detecter le click sur un des objets de l'inventaire

setTimeout(mise_en_place, 500);
var pechee = false;

//add('map',1)

$('#map2').on('click',function(){
    $('#map2').css('display','none')
})

function mise_en_place(){
    //console.log('oh')
    var obj = document.querySelectorAll('#inventaire > div');
    obj.forEach(item => {
        var img = item.querySelector('img');
        //console.log(img.src)
        if (img && img.src.includes("fishing_road")) {
            
            item.addEventListener('click', handleClick); // Ajoute l'écouteur d'événement
        }
        if (img && img.src.includes("item_map")) {
            
            item.addEventListener('click', handleClickmap); // Ajoute l'écouteur d'événement
        }
        if (img && img.src.includes("lettre")) {
            
            item.addEventListener('click', handleClicklettre); // Ajoute l'écouteur d'événement
        }
        
    });
    
    function handleClicklettre(){
        if(!stop){
            touche_lettre = true;
        }
    }
    
    function handleClickmap(){
            if(monde == 1){
                $('#map2').attr('src','images/map1.png');
            }
            if(monde == 2){
                $('#map2').attr('src','images/map2.png');
            }
            if(monde == 3){
                $('#map2').attr('src','images/map3.png');
            }
            if(monde == 4){
                $('#map2').attr('src','images/map4.png');
            }
            if(monde == 5){
                $('#map2').attr('src','images/map5.png');
            }
            if(monde == 6){
                $('#map2').attr('src','images/map6.png');
            }
            if(monde == 7){
                $('#map2').attr('src','images/map7.png');
            }
            if(monde == 8){
                $('#map2').attr('src','images/map6.png');
            }
            if(monde == 9){
                $('#map2').attr('src','images/map9.png');
            }
            if(monde == 10){
                $('#map2').attr('src','images/map10.png');
            }
            if(monde == 11){
                $('#map2').attr('src','images/map7.png');
            }
            if(monde == 12){
                $('#map2').attr('src','images/map9.png');
            }
            if(monde == 13){
                $('#map2').attr('src','images/map13.png');
            }
            
            /**
Seavy Bay = ile 1
The Last Outpost = ile 2;
Loadly Ridges = ile 3;
East prison = ile 4;
End Valley = ile 5;

Seavy Bay -> The last Outpost = 6
Seavy Bay -> Loadly Ridges = 7;
The Last Outpost -> Seavy Bay = 8;
The Last Outpost -> Loadly Ridges = 9;
The Last Outpost -> East Prison = 10;
Loadly Ridges -> Seavy Bay = 11;
Loadly Ridges -> The last Outpost -> 12;
Loadly Ridges -> End Valley -> 13;

 **/
            
            
            var check = $('#map2').css('display');
            if(check == 'none'){
                $('#map2').css('display','block')
            }else{
                $('#map2').css('display','none')
            }

    }
    
    function handleClick(){
        if(!stop){
            touche_peche = true;
            //console.log('odazadzh')
            if(pechee == false){
                $('#radeau').attr('src', '../images/fishing1.png');
                $('#fishing_road').css('display', 'block');
                $('#fishing_road0').css('display', 'block');
                pechee = true;
                peche();
            }else{
                stopFishing();
                pechee=false;
            }
        }
        
        
    }
}

//add('Carte', '1');

function stopFishing() {
    //console.log('soluce')
    // Réinitialise tout l'état lié à la pêche
    isRunning = false;
    clearInterval(montee);
    clearInterval(descente);
    clearTimeout(timeoutId);
    
    
    index9 = 65; // Remet la position à l'état initial
    $('#radeau').attr('src', 'images/bateau1.png');
    $('#fishing_road').css('display', 'none');
    $('#fishing_road0').css('display', 'none');
    $('#fished').css('display', 'none');
    clearTimeout(timeoutId);
    $('#fishing_road0').css('bottom','65px');
    $('#fishing_road0').css('opacity', 1);
}

var descente; // Variable pour stocker l'intervalle de descente
var montee;
var timeoutId;

    
function poisson() {
    //console.log('pb4')
    var index9 = 65; // Position initiale
    var isClicable = false; // Permet de contrôler si un clic est possible
     // Variable pour stocker l'intervalle de montée
     // Variable pour stocker l'identifiant du setTimeout
    var isRunning = true; // Contrôle si le jeu est actif

    function descendre() {
       //console.log('pb3')
        descente = setInterval(() => {
             //console.log('why')
            if (!isRunning) {
                clearInterval(descente);
                return;
            }
            if (index9 > 62) {
                index9 -= 1;
                $('#fishing_road0').css('bottom', index9 + 'px');
                timeoutId = setTimeout(() => {
                    $('#fishing_road0').css('opacity', 0);
                }, 250);
            } else {
                clearInterval(descente);
                isClicable = true;
                $('#fished').css('display', 'block');
                //console.log("Le curseur est en bas, vous pouvez cliquer !");

                // afficher une div -> attraper le poisson
                timeoutId = setTimeout(() => {
                    if (isClicable && isRunning) {
                        remonter();
                    }
                }, 400);
            }
        }, 50);
    }

    function remonter() {
        //console.log('pb2')
        montee = setInterval(() => {
            //console.log('why')
            if (!isRunning) {
                clearInterval(montee);
                return;
            }
            if (index9 < 65) {
                index9 += 1;
                $('#fishing_road0').css('bottom', index9 + 'px');
                $('#fishing_road0').css('opacity', 1); // Rend visible à nouveau
            } else {
                clearInterval(montee);
                $('#fished').css('display', 'none');
                isClicable = false; // Désactive le clic lorsque le curseur est remonté
            }
        }, 50);
        peche();
    }

    // Déclenche la descente initiale
    descendre();

    // Gestion du clic sur le poisson
    $('#fished').on('click', function () {
        if (isClicable) {
            //console.log("Clic détecté pendant que le curseur est en bas !");
            isClicable = false;
            $('#fishing_road').css('display', 'none');
            $('#fishing_road0').css('display', 'none');
            $('#fished').css('display', 'none');
            
            const tableau = ["thon", "saumon", "bar"];
            const itemAleatoire = tableau[Math.floor(Math.random() * tableau.length)];
            

            notif("Vous avez attrapé un " + itemAleatoire + " !")
            add(itemAleatoire, '1');

            
            clearInterval(montee);
            clearInterval(descente);
            clearTimeout(timeoutId);

        }
    });
}

setInterval(function(){
    var src = $('#radeau').attr('src');
    if(src == '../images/bateau1.png' || src == 'images/bateau1.png'){
        clearInterval(montee);
        clearInterval(descente);
        clearTimeout(timeoutId);
        isClicable = false;
    }else{
        
    }
},40)

function peche() {
    //console.log('pb1')
    timeoutId = setTimeout(function () {
        var intervalId = setInterval(function () {
            let randomNumber = Math.floor(Math.random() * 3) + 1;
            if (randomNumber == 1) {
                poisson();
                clearInterval(intervalId);
            }
        }, 1000);
        //console.log('pb5')
    }, 1000);
}




//EAU

var vitesse = 1;

var eau_src = $('#eau').attr('src');
var eau_index = parseInt(eau_src.match(/\d+/)[0]);

setInterval(function(){
    eau_index++;
    var eau_src2 = "../aie/Untitled000" + eau_index + ".png";
    $('#eau').attr('src',eau_src2);
    if(eau_index>86574){
        eau_index=86402;
    }
    //console.log(vitesse)
},40 / vitesse)

//dérive du bateau

var boat = document.querySelectorAll('.boat');
var derive = 0;
var derive_var = true;

setInterval(function(){
    boat.forEach(index =>{
        if(!stop && derive_var){
            
        
            var leftValue = parseFloat(window.getComputedStyle(index).left)
            var nouvelleValeur3 = 0;
                    
            if(derive<34){
                nouvelleValeur3 = leftValue + 1;
            }else{
                nouvelleValeur3 = leftValue - 0.5;
            }
            nouvelleValeur3 = nouvelleValeur3 + vitesse;
            index.style.left = nouvelleValeur3 + 'px';
            
            }
            })
            derive++;
            
            if(derive>100){
                derive=0;
            }
        
        
},40)

var touched = false;
setInterval(function(){
    boat.forEach(index =>{
        var leftValue = parseFloat(window.getComputedStyle(index).left)
        if(!stop && leftValue < 400 && touched){
            var nouvelleValeur3 = 0;
            nouvelleValeur3 = leftValue + 1;
            nouvelleValeur3 = nouvelleValeur3 + vitesse;
            index.style.left = nouvelleValeur3 + 'px';
        }
        
    })
    if(bateau == 2){
        derive_var=false;
        //console.log('bateau 2')
        document.addEventListener('keydown', (event) => {
            if (event.key === 'd' || event.key === 'D') {
                vitesse=2;
                touched=true;
            
            }
        })
        document.addEventListener('keyup', (event) => {
            vitesse=0;
            touched=false;
        })
    }
    
},40)


var cause = "lookfor";
    $.ajax({
            url:'../data.php',
            data:{cause:cause},
            type:'POST',
            success: function(res){
                tab = res.split(',');
                vie = tab[0];
                vivres = tab[1];
                gold2 = tab[2];
                monde = tab[3];
                quest = tab[4];
                niv = tab[5];
                bateau = tab[6];
                mess = tab[7];
                
                if(quest >1){
                    update_quest(quest)
                }
                
                
                if(monde == 1){
                    $('#ile').css('left','220px');
                    pop_ile(1);
                }else{
                    gestion_ile(monde)
                }
                
                
                
                
                $('#life').text(vie + "%");
                $('#food').text(vivres + "%")
                $('#golds').text(gold2)
                
            }
        })
    var cause2 = 'take';
    $.ajax({
            url:'../inv.php',
            data:{cause2:cause2},
            type:'POST',
            success: function(res){
                var tab = res.split('.');
                tab.pop();
                tab.forEach(index =>{
                    var tab2 = index.split(',');

                    add(tab2[0],tab2[1]);
                })
            }
        })


function add_market(obj, quantite2,ile) {
    
const contain1 = document.createElement('div');
contain1.classList.add('contain1');

// Création de l'image
const img = document.createElement('img');
img.src = 'images/'+ obj +'.png';
contain1.appendChild(img);

// Création de la div interne
const contain2 = document.createElement('div');
contain2.classList.add('contain2');

// Création du titre
const title = document.createElement('h2');
title.textContent = obj;
contain2.appendChild(title);

var prix=0;
    if(ile ==1){
        if(obj == "bar"){
            prix = 10;
            
        }
        if(obj == "saumon"){
            prix = 10;
        }
        if(obj == "thon"){
            prix = 10;
        }

    }
    


// Création de la div pour le prix
const priceDiv = document.createElement('div');
const priceLabel = document.createElement('h3');
priceLabel.textContent = 'Prix : ';
const priceValue = document.createElement('h3');
priceValue.textContent = prix + 'or';
priceDiv.appendChild(priceLabel);
priceDiv.appendChild(priceValue);
contain2.appendChild(priceDiv);

// Création de la div pour la quantité
const quantityDiv = document.createElement('div');
const quantityLabel = document.createElement('h3');
quantityLabel.textContent = 'Quantite : ';
const decreaseBtn = document.createElement('h3');
decreaseBtn.classList.add('g');
decreaseBtn.textContent = '<';
const quantityValue = document.createElement('h3');
quantityValue.textContent = quantite2;
const increaseBtn = document.createElement('h3');
increaseBtn.classList.add('d');
increaseBtn.textContent = '>';

decreaseBtn.addEventListener('click',function(){
    var quantite = parseInt(quantityValue.textContent, 10);
    if(quantite > 0){
        quantite--;
    }
    quantityValue.textContent = quantite;

    
})

increaseBtn.addEventListener('click',function(){
    var quantite = parseInt(quantityValue.textContent, 10);
    quantite++;
    quantityValue.textContent = quantite;
})

quantityDiv.appendChild(quantityLabel);
quantityDiv.appendChild(decreaseBtn);
quantityDiv.appendChild(quantityValue);
quantityDiv.appendChild(increaseBtn);
contain2.appendChild(quantityDiv);

// Création du bouton d'achat
const buyBtn = document.createElement('h2');
buyBtn.classList.add('achet');
buyBtn.textContent = 'Acheter';
contain2.appendChild(buyBtn);

buyBtn.addEventListener('click',function(){
    var sous = $('#golds').text();
    //console.log(prix)
    var result = sous - prix;
    if(result >= 0){
        var quantite = parseInt(quantityValue.textContent, 10);
        sous = sous - prix * quantite;
        $('#golds').text(sous)
        
        //ajouter quant à l'inventaire 
        
        add(obj,quantite)
    }else{
        notif("Vous n'avez pas assez d'argent !")
    }
    
})

// Ajout de contain2 à contain1
contain1.appendChild(contain2);


$('#contain_buy').append(contain1)

}

function supp(obj,quantite2){
    
    const div = document.querySelector('div[title=' + obj + '');

    if (div) {
        var h2 = div.querySelector('.quantite');
        h3 = h2.textContent;
        h3 = parseInt(h3, 10);
        //console.log(h2)
        
        var quantite = parseInt(quantite2, 10);
        if((h3 - quantite) > 0){
            h3 = h3 - quantite;
            h2.textContent = h3;
        }else{
            div.remove();
            
            const divs = document.querySelectorAll('#contain_sell div');

            divs.forEach(div2 => {
                const h2 = div2.querySelector('h2');
                if (h2 && h2.textContent.trim() === obj) {
                    div2.remove();
                }
            });

            
        }
    } else {
        console.log("Aucune div avec title='saumon' trouvée.");
    }

    
}

function add(obj, quantite2) {
    var enfants = document.querySelectorAll('#inventaire > div');
    var tableauEnfants = Array.from(enfants);
    
    // Trouver la div contenant l'objet (Poisson)
    var divPoisson = tableauEnfants.find(function(div) {
        var img = div.querySelector('img');
        return img && img.src.includes(obj);
    });

    if (divPoisson) {
        //console.log('YA DEJA')
        
        var h3 = divPoisson.querySelector('h3');
        var quantite = h3.textContent.trim();
        var intquantite = parseInt(quantite.match(/\d+/)[0]);
        
        var plus = parseInt(quantite2); 
        intquantite += plus; 
        h3.textContent = `${intquantite}`;
        

    } else {
        var div = document.createElement('div');
        var img = document.createElement('img');
        var src = "images/" + obj + ".png";
        img.src = src;
        img.classList.add('hey')
        div.appendChild(img)
        
        div.setAttribute('title',obj);
        
        
        
        if(quantite2>0){

            var quant = document.createElement('img')
            quant.src = "images/quant.png";
            quant.classList.add('quant');
            
            var h3 = document.createElement('h3');
            h3.textContent = quantite2;
            h3.classList.add('quantite')
            
            div.appendChild(quant)
            div.appendChild(h3)
        }

        $('#inventaire').append(div);
    }
    

    

}

document.addEventListener("DOMContentLoaded", () => {
    document.querySelectorAll(".fishing_astuce").forEach(fishingAstuce => {
        var image = fishingAstuce.querySelector("img");
        var astuce = fishingAstuce.querySelector("p");

        if (image && astuce) {
            image.addEventListener("mouseenter", () => {
                astuce.style.display = "block";
            });

            image.addEventListener("mouseleave", () => {
                astuce.style.display = "none";
            });
        }
    });
});


</script>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit