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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

session_start();

if(isset($_POST['deco'])){
        if (isset($_SESSION['login'])) {
            unset($_SESSION['login']);
            session_destroy();
            header("Location: cursed.php");
        }
    }
    
if(isset($_SESSION['login'])){
    echo "<div id='cache'>on</div>";
}



?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Carpirats</title>
    <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=Tangerine:wght@400;700&display=swap" rel="stylesheet">
<style>

body{
    margin:0;
    padding:0;
    width:100%;
    height:100vh;
    display:flex;
    justify-content:center;
    background-image:url('images/bg_wood.png');
    background-size:cover;    
}

.cache{
    display:none;
}


#canvas{
    margin-top:150px;
	width: 1000px;
	height:600px;
	background-image:url('images/sky.png');
	background-size:cover;
	background-position:center;
	image-rendering: pixelated;
	position:relative;
	overflow:hidden;
}
#bordure{
    margin-top:80px;
    position:absolute;
	width: 1130px;
	height:700px;
	image-rendering: pixelated;
    z-index:4000;
    margin-right:60px;
    display:none;

}

.image{
    width: 1200px;
	height:600px;
    position:absolute;
    top:0;
    left:0;
}

.boat{
    width: 350px;
    position:absolute;
    top:230px;
    left:330px;
}

.enemi{
    width: 200px;
    position:absolute;
    top:280px;
    left:1100px;
    transform:scale(-1,1);
}

.boat2{
    width: 350px;
    position:absolute;
    top:230px;
    left:130px;
}

.enemi2{
    width: 200px;
    position:absolute;
    top:280px;
    left:600px;
    transform:scale(-1,1);
}

.clouds{
    position:absolute;
    width:1000px;
    left:500px;
    top:150px;
}




#vie{
    position:absolute;
    top:25px;
    left:25px;
    background:red;
    width:100px;
    height:25px;
}

#vie2{
    position:absolute;
    top:18px;
    left:23px;
    width:136px;
    height:40px;
    z-index:10;
}

#vivres{
    z-index:9;
    position:absolute;
    top:75px;
    left:25px;
    background:green;
    width:100px;
    height:25px;
}

.infos{
    margin:0;
    margin-top:5px;
    padding:0;
    text-align:center;
}

#vivres2{
    position:absolute;
    top:70px;
    left:23px;
    width:136px;
    height:40px;
    z-index:10;
}


#gold{
    z-index:800;
    position:absolute;
    top:125px;
    left:50px;

}

#gold2{
    z-index:800;
    position:absolute;
    top:123px;
    left:21px;
    width:25px;

}




#ile{
    position:absolute;
    width:50px;
    height:50px;
    top:400px;
    left:1000px;
    background:green;
}

#texte2{
   width:auto;
   position:absolute;
    bottom:0px;
    left:50%;
    transform:translate(-50%);
    z-index:998;
    display:none;
    opacity:0;
    transition:.5s all;
    
}

#texte{
   width:auto;
   position:absolute;
    bottom:150px;
    left:50%;
    transform:translate(-50%);
    z-index:999;
    opacity:0;
    transition:.5s all;
    width:400px;
    height:50px;
    display:flex;
    justify-content:center;
    align-items:center;
}





#log{
    position:absolute;
    z-index:888;
    right:-480px;
    top:50%;
    transform:translate(0,-50%);
    transition:.5s all;
    width:400px;
    height:430px;
    background:url('images/log.png');
    background-size:contain;
    
    font-family: "Tangerine", serif;
    font-weight: 400;
  font-style: normal;
  

  
}

#log h2{
    width:100%;
    margin:0;
    padding:0;
    height:50px;
    text-align:center;
    margin-top:50px;
    font-size:3rem;
    text-decoration:underline;

}

#log h3{
    
    width:200px;
    font-size:1.6rem;
    margin:auto;
    margin-top:5px;
    text-align:center;
    margin-bottom:5px;
}

#log a{
    color:#6a335f;
    text-decoration:underline;
    cursor:pointer;
}

#log div{
    margin:auto;
    margin-top:10px;
    width:170px;
    display:flex;
    justify-content:space-between;
}

#log label{
    font-size:1.6rem;
}

.toi{
    width:100px;
    background:none;
    border:none;
    
font-family: "Tangerine", serif;
    font-weight: 600;
  font-style: normal;
  font-size:1.5rem;
}

#log input:focus{
    border:none;
    background:none;
    outline:none;
}



.envoyer{
    all:initial;
    margin-top:5PX;
    margin-right:20px;
    font-family: "Tangerine", serif;
    font-weight: 600;
  font-style: normal;
  font-size:1.8rem;
  cursor:pointer;
  text-decoration:underline;
}

.erreure{
    
    width:200px;
    font-size:1.4rem;
    margin:auto;
    text-align:center;
    margin-top:10px;
    color:#9b1d19;
}

.erreure2{
    
    width:200px;
    font-size:1.4rem;
    margin:auto;
    text-align:center;
}


.envoyer2{
    all:initial;
    margin-top:5px;
    
    font-family: "Tangerine", serif;
    font-weight: 600;
  font-style: normal;
  font-size:1.8rem;
  cursor:pointer;
  text-decoration:underline;
}

#ins{
    position:absolute;
    z-index:888;
    right:-480px;
    top:50%;
    transform:translate(0,-50%);
    transition:.5s all;
    width:400px;
    height:430px;
    background:url('images/log.png');
    background-size:contain;
    font-family: "Tangerine", serif;
    font-weight: 400;
  font-style: normal;
}

#ins h2{
    width:100%;
    margin:0;
    padding:0;
    height:50px;
    text-align:center;
    margin-top:50px;
    font-size:3rem;
    text-decoration:underline;
}

#ins h3{
    width:200px;
    font-size:1.6rem;
    margin:auto;
    margin-top:5px;
    text-align:center;
    margin-bottom:5px;
}

#ins a{
    color:#6a335f;
    text-decoration:underline;
    cursor:pointer;
}

#ins div{
    margin:auto;
    margin-top:10px;
    width:170px;
    display:flex;
    justify-content:space-between;
}

#ins label{
    font-size:1.6rem;
}
#ins input:focus{
    border:none;
    background:none;
    outline:none;
}


#act{
    position:absolute;
    margin-top:80px;
    display:flex;
    gap:30px;
    
    
}
#act input{
    all:initial;
    font-family: "Tangerine", serif;
    font-weight: 800;
  font-style: normal;
  color:#c6a418;
  font-size:3rem;
  cursor:pointer;

  padding:10px 15px 10px 15px;
  background-image:url('images/c.png');
    background-size: 100% 90%;
    background-repeat:no-repeat;
 
}

#act h2{
    all:initial;
    font-family: "Tangerine", serif;
    font-weight: 800;
  font-style: normal;
  color:#c6a418;
  font-size:3rem;
  cursor:pointer;

  padding:10px 15px 10px 15px;
  background-image:url('images/c.png');
    background-size: 100% 90%;
    background-repeat:no-repeat;
 
}

#quete{
    position:absolute;
    right:160px;
    top:100px;
    z-index:999;

}

#quete div h3{
    all:initial;
    font-family:Arial Serif;
    color:#533423;
    font-size:1.4rem;
    cursor:pointer;
    display:block;
    text-align:center;
    text-decoration:underline;
    width:260px;
}

#quete div p{
    all:initial;
    font-family:Arial Serif;
    color:#533423;
    font-size:1rem;
    cursor:pointer;
    display:block;
    text-align:center;
}

#quete div{
    background:#ae9573;
    border:3px #533423 solid;
    border-radius:5px;
    width:260px;
    margin:auto;
    position:relative;
    bottom:35px;
    z-index:701;
    padding-top:20px;
    padding-bottom:10px;
}

#quete h2{
    all:initial;
    font-family: "Tangerine", serif;
    font-weight: 800;
  font-style: normal;
  color:#533423;
  font-size:3rem;
  cursor:pointer;
    display:block;
  padding:10px 15px 10px 15px;
  background-image:url('images/texte.png');
    background-size: 100% 180%;
    background-repeat:no-repeat;
    background-position:center;
    padding:25px 20px 30px 20px;
    width:300px;
    text-align:center;
    position:relative;
    z-index:999;

}

#map{
    position:absolute;
    width:300px;
    right:100px;
    z-index:890;
    bottom:100px;
}

#inv{
    width:72%;
    height:82%;
    background:blue;
    position:absolute;
    z-index:801;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    display:none;
    display:flex;
    align-items:start;
    display:none;
}

.market{
    width:75%;
    height:85%;
    background:blue;
    position:absolute;
    z-index:801;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    display:none;
    display:flex;
    align-items:start;
}

#choose{
    width:20%;
    height:100%;
    background:red;
}

#choose h2{
    border:2px black solid;
    cursor:pointer;
}
#contain2{
    width:80%;
    height:100%;
    background:pink;
}

#inv div{
    background:red;
    height:auto;
    width:100px;
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    align-items:start;
    height:100px;
    overflow:auto;
    
}

#inv div h2{
    margin:0;
    width:100%;
    text-align:center;
}

#inv div h3{
    margin:0;
    width:100%;
    text-align:center;
}


#ile{
    width:50px;
    height:50px;
    z-index:500;
    position:absolute;
    bottom:100px;
    left:700px;
    background:green;
}

#ile01{
    display:none;
}

#ile1{
    position:absolute;
    z-index:300;
    bottom:100px;
}

#fight{
    position:absolute;
    z-index:300;
    bottom:100px;
}

#sell{
    width:100%;
    height:100%;
    background:black;
    display:flex;
    align-items:start;
}

#buy{
    width:100%;
    height:100%;
    background:green;
    display:flex;
    align-items:start;
    display:none;
}

#buy div{
    background:blue;
    height:auto;
    width:100px;
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    align-items:start;
    height:100px;
    overflow:auto;
    
}

#buy div h2{
    margin:0;
    width:100%;
    text-align:center;
}

#buy div h3{
    margin:0;
    width:100%;
    text-align:center;
}

#sell div{
    background:blue;
    height:auto;
    width:100px;
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    align-items:start;
    height:100px;
    overflow:auto;
    
}

#sell div h2{
    margin:0;
    width:100%;
    text-align:center;
}

#sell div h3{
    margin:0;
    width:100%;
    text-align:center;
}

.Acheter{
    cursor:pointer;
}

.Vendre{
    cursor:pointer;
}

#combat{
    width:100%;
    height:100%;
    background:pink;
    z-index:880;
    position:absolute;
    background-image:url('images/sky.png');
	background-size:cover;
	background-position:center;
	image-rendering: pixelated;
	bottom:100px;
	display:none;
}

#interface{
    position:absolute;
    width:100%;
    height:20vh;
    bottom:-100px;
    background:white;
    display:flex;
    justify-content:space-around;
}

#actions{
    width:30%;
    height:100%;
    background:red;
}
#actions h2{
    width:100%;
    text-align:center;
    border:3px black solid;
    margin:0;
    padding:0;
    margin-top:10px;
    cursor:pointer;
}

#informations{
    width:30%;
    height:100%;
    background:blue;
}

#informations_enemi{
    width:30%;
    height:100%;
    background:blue;
}

#what{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    background:white;
    display:none;
}

#what h2{
    color:black;
    cursor:pointer;
    border:3px black solid;
}

#enemi_life{
    background:red;
    height:10px;
}

#space{
    position:absolute;
    width:100%;
    height:100%;
    z-index:2000;
    display:none;
}

#radeau{
    width:200px;
    height:100px;
    position:absolute;
    z-index:3000;
    bottom:100px;
    left:400px;
}

</style>
<body>
    <?php
    
    
    

    if(isset($_SESSION['login'])){
        echo "<form id='act' method='POST' action='cursed.php'>
        <h2 id='savine'>Sauvegarder</h2>
        <input id='deco' type='submit' name='deco' value='Deconnexion'>

    </form>";
    //envoi directement les données à la BDD via un formulaire AJAX, qui renvoi une confirmation via la fonction message();
    //Données envoyées : 
    // Vie / Vivres / Gold / Contenu de l'inventaire // n Monde
    }else{
        echo "<form id='act' method='POST' action='cursed.php'>
        <h2 id='login'>Connexion</h2>
        <h2 id='inscription'>Inscription</h2>
    </form>";
    //Quand on appui sur un des boutons, ouvre une popup de connexion / inscription. 
    //Mettre un pti message qui dit que si on s'inscrit / créer un compte, les données actuelle seront perdues.
    
    // Charger les données de la BDD :
    // Vie / Vivres / Gold / Contenu de l'inventaire // n Monde 
    
    }
    
    
    
    
    ?>
    
    
    <img id='map' src='images/map.png'>
    <img src='images/texte.png' id='texte2'>
    <div id='texte'>
        <p>Oeoeoeo</p>
    </div>
        <div id='quete'>
            <h2>Liste des quêtes</h2>
        </div>
        <img id='bordure' src='images/border.png'>
        <div id="canvas">
            <div id='combat'>
                <img  class='clouds' src='images/clouds2.png'>
                <img class='image' src='images/sea.png'>
                <img  class='enemi2' src='images/bateau.png'>
                <img  class='enemi2' src='images/voiles1.png'>
                <img  id='en2' class='boat2' src='images/bateau.png'>
                <img class='boat2' src='images/voiles1.png'>
                <div id='interface'>
                    <div id='informations'>
                        <h1>Votre bateau</h1>
                    </div>
                    <div id='actions'>
                        <h1>Actions</h1>
                        <h2 id='b_attaquer'>Attaquer</h2>
                        <h2 id='b_fuir'>Fuir</h2>
                    </div>
                    <div id='informations_enemi'>
                        <h1>Infos enemi</h1>
                    </div>
                </div>
            </div>
            <div class='market' id='ile01'>
                <div id='choose'>
                    <h2 id='hop'>Acheter</h2>
                    <h2 id='oust'>Vendre</h2>
                    <h2>Améliorations</h2>
                    <h2 id='out'>Lever l'ancre</h2>
                </div>
                <div id='contain2'>
                    <div id='sell'>

                    </div>
                    <div id='buy'>
                        
                    </div>
                </div>
                <div id='what'>
                    <h2 id='go_droite'>Sud</h2>
                    <h2 id='go_left'>Nord</h2>
                </div>
            </div>
            <div id='inv'>

            </div>
            <div id='log'>
                <h2>Inscription</h2>
                <h3>Si vous avez déja un compte, <a id='gocon'>connectez vous.</a></h3>
                <h4 class='erreure2'>En vous inscrivant, vous conservez les données de jeu actuelles</h4>
                <form>
                    <div>
                        <label>Nom :</label>
                        <input id='ins_nom' class='toi' type='text' name='pseudo' placeholder='..............................'>
                    </div>
                    <div>
                        <label>Mdp :</label>
                        <input id='ins_mdp' class='toi' type='PASSWORD' name='mdp' placeholder='..............................'>
                    </div>
                    
                    <div>
                    <label class='envoyer' id='register'>S'inscrire</label>
                    <label class='envoyer2'>Fermer</label>
                    </div>
                    <h4 id='erreur1' class='erreure'></h4>
                </form>
            </div>
            
            
            <div id='ins'>
                <h2>Connexion</h2>
                <h3>Si vous n'avez pas encore de compte, <a id='goins'>inscrivez vous.</a></h3>
                <h4 class='erreure2'>En vous connectant, vous perdez les données de jeu actuelles</h4>
                <form>
                    <div>
                        <label>Nom :</label>
                        <input id='log_nom' class='toi' type='text' name='pseudo' placeholder='..............................'>
                    </div>
                    <div>
                        <label>Mdp :</label>
                        <input id='log_mdp' class='toi' type='PASSWORD' name='mdp' placeholder='..............................'>
                    </div>
                    <div>
                    <label class='envoyer' id='connexion'>Se connecter</label>
                    <label class='envoyer2'>Fermer</label>
                    </div>
                    <h4 id='erreur2' class='erreure'></h4>
                </form>
            </div>
            
            <img id='clouds' class='clouds' src='images/clouds2.png'>
            <img class='image' src='images/sea.png'>
            
            
            <img  id='boat2' class='enemi' src='images/bateau.png'>
            <img id='voile2' class='enemi' src='images/voiles1.png'>
            <img  id='boat' class='boat' src='images/bateau.png'>
            <img id='voile' class='boat' src='images/voiles1.png'>
            
            <img src='images/life.png' id='vie2'>
            <div id='vie'></div>
            <img src='images/life.png' id='vivres2'>
            <div id='vivres'></div>
            <img src='images/coin.png' id='gold2'>
            <div id='gold'>100 pièces d'or</div>
            <div id='ile'></div>
            <img id='space' src='aie/Untitled00086401.png'>
            <img id='radeau' src='images/radeau2.png'>
    	</div>


<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>





$('#out').on('click',function(){
    
    //console.log(index_ile);
    if(index_ile>1){
        $('#what').css('display','block');

        
    }else if(index_ile>3){
        //console.log('OOOOOOOO')
        }
    else{
        $('#ile01').css('display','none');
        arret = false;
        //NNNNNNNNN
        var inventaire2 = document.getElementById('buy');
        inventaire2.innerHTML = '';
        droite();

    }
})

$('#go_droite').on('click',function(){
    gauche();
    console.log('GAUCHEEEEEEEEEEEEEE')
    $('#ile01').css('display','none');
    arret = false;
    //NNNNNNNNN
    var inventaire2 = document.getElementById('buy');
    inventaire2.innerHTML = '';
    $('#what').css('display','none');
})
$('#go_left').on('click',function(){
    droite();
    $('#ile01').css('display','none');
    arret = false;
    //NNNNNNNNN
    var inventaire2 = document.getElementById('buy');
    inventaire2.innerHTML = '';
    $('#what').css('display','none');
})

$('#oust').on('click',function(){
    $('#buy').css('display','flex');
    $('#sell').css('display','none');
})

$('#hop').on('click',function(){
    $('#sell').css('display','flex');
    $('#buy').css('display','none');
})



    var monde = "1";
    var quest = '1';
    
    var inventaire = [];



var cache = $('#cache').text();
if(cache == "on"){
  
    var cause = "lookfor";
    $.ajax({
            url:'data.php',
            data:{cause:cause},
            type:'POST',
            success: function(res){
                var tab = res.split(',');
                var vie = tab[0];
                var vivres = tab[1];
                var gold2 = tab[2];
                monde = tab[3];
                quest = tab[4];

                //var element = document.getElementById('un');
                //element.remove();
                
                $('#gold').text(gold2 + " pieces d'or");
                $('#vie').css("width",vie);

                $('#vivres').css("width",vivres);
            }
        })
    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(',');
                    //console.log(tab2[0]);
                    //console.log(tab2[1]);
                    add(tab2[0],tab2[1]);
                })
            }
        })
    
}


$('#register').on('click',function(){
    var nom = $('#ins_nom').val();
    var mdp = $('#ins_mdp').val();
    var cause = 'register';

    if(!mdp || !nom){
        $('#erreur1').text('Veuillez remplir tous les champs')
    }else{
        $('#erreur1').text('');
        $.ajax({
            url:'verif.php',
            data:{cause:cause,nom:nom,mdp:mdp},
            type:'POST',
            success: function(res){
                $('#erreur1').text(res)
                if(res == "Enregistrement réussi"){
                    location.reload();
                }
            }
        })
    }
    
})

$('#connexion').on('click',function(){
    var nom = $('#log_nom').val();
    var mdp = $('#log_mdp').val();
    var cause = 'login';
    
    //console.log("hey")

    if(!mdp || !nom){
        $('#erreur2').text('Veuillez remplir tous les champs')
    }else{
        $('#erreur2').text('');
        $.ajax({
            url:'verif.php',
            data:{cause:cause,nom:nom,mdp:mdp},
            type:'POST',
            success: function(res){
                $('#erreur2').text(res)
                //console.log(res)
                if(res == "Connexion reussie"){
                    location.reload();
                }
            }
        })
    }
})


$(document).on('click', '#savine', function() {
    var cause2 = "give";
    
    var vie3 = $('#vie').css('width');
    var vie4 = parseInt(vie3,10);
    var vivres3 = $('#vivres').css('width');
    var vivres4 = parseInt(vivres3,10);
    
    var gold = 100;
    var gold4 = $('#gold').text();
    var gold5 = parseInt(gold4.match(/\d+/)[0], 10)
    
    
    $.ajax({
            url:'data.php',
            data:{cause:cause2,vie:vie4,vivres:vivres4,gold:gold5,monde:monde,quest:quest},
            type:'POST',
            success: function(res){
                //console.log(res)
            }
        })
        
    var nom = "";
    var quantite = "";
    var cause2 = "supp";
    $.ajax({
            url:'inv.php',
            data:{cause2:cause2},
            type:'POST',
            success: function(res){
                //console.log('Supp')
            }
        })
        
    setTimeout(function(){
        cause2 = 'send';
        let enfants = $('#inv').children();
        Array.from(enfants).forEach(enfant => {
            let h2 = enfant.querySelector('h2');
            if (h2) {
                nom = h2.textContent;
            }
            let h3 = enfant.querySelector('h3');
            if (h3) {
                quantite = h3.textContent;
                quantite = parseInt(quantite.match(/\d+/)[0]);
                //ICI MODIFIER EN INT
            }
            
            $.ajax({
                url:'inv.php',
                data:{cause2:cause2,nom:nom,quantite:quantite},
                type:'POST',
                success: function(res){
                    //console.log('add')
                    message('Sauvegarde effectuée avec succès',2000)
                }
            })
            
        });
    },2000)
    
})

$('#login').on('click',function(){
    $('#log').css('z-index','888');
    $('#ins').css('z-index','889');
    $('#ins').css('right','-80px');
})

$('#inscription').on('click',function(){
    $('#log').css('z-index','889');
    $('#ins').css('z-index','888');
    $('#log').css('right','-80px');
})



$('#goins').on('click',function(){
$('#log').css('z-index','889');
    $('#ins').css('z-index','888');
    $('#log').css('right','-80px');
})

$('#gocon').on('click',function(){
    $('#log').css('z-index','888');
    $('#ins').css('z-index','889');
    $('#ins').css('right','-80px');
})

$(document).on('click', '.envoyer2', function(event) {
    $('#ins').css('right', '-480px');
    $('#log').css('right', '-480px');
});


function message(texte,temps){
    $('#texte').css('opacity','1');
    $('#texte2').css('display','block');
    $('#texte2').css('opacity','1');
    $('#texte').text(texte)
    var temps2 = temps/2;
    setTimeout(function(){
        $('#texte').css('opacity','0');
        $('#texte2').css('opacity','0');
        setTimeout(function(){
            $('#texte2').css('display','none');
        },temps2)
        
    },temps);
}

var index=0;
var stop=false;
var amarer = false;
var arret = false;
var fight = false;

var inverser = false;
var apres = false;
var stet = false;

var retour = false;

var jsp = $('#space').attr('src');
var okk = parseInt(jsp.match(/\d+/)[0]);
setInterval(function(){
    
    okk++;
    var src2 = "aie/Untitled000" + okk + ".png";
    $('#space').attr('src',src2);
    
    if(okk>86574){
        console.log('OOOOOOOO')
        okk=86402;
    }
    
    // ANIM JOUEE ICIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
},40)

setInterval(function(){
    
    
    if(index_ile>=3){
        $('#go_left').text('Rejoindre le monde 2');
    }else{
        $('#go_left').text('Nord');
    }
        if(index_ile>1){
            
        
            var enemis = document.querySelectorAll('.enemi');
            enemis.forEach(index =>{
                //console.log(stet)
                if(!stet && index_ile>1){
                    stet = true;
                    boat_spawn();

                }
                var leftValue = parseFloat(window.getComputedStyle(index).left)
                var nouvelleValeur3 = 0;
                
                if(spawn == "gauche"){
                        if(stop == false){
                            nouvelleValeur3 = leftValue - 1.5;
                        }else{
                            nouvelleValeur3 = leftValue - 0.75;
                        }
                    
                }else{

                        if(stop == false){
                            nouvelleValeur3 = leftValue -2 ;
                        }else{
                            nouvelleValeur3 = leftValue -1;
                        }
                    
                }
                
                index.style.left = nouvelleValeur3 + 'px';
                
                if(leftValue > 1000 || leftValue < -200){
                    if(index_ile>1){
                        stet=false;
                    }
                    
                }
                /**
                
                //console.log(index);
                var leftValue = parseFloat(window.getComputedStyle(index).left) || 0;
                var nouvelleValeur3 = 0;
                if(!inverser){
                    if(stop == false){
                    nouvelleValeur3 = leftValue - 2;
                    }else{
                        nouvelleValeur3 = leftValue - 1;
                    }
                    if(nouvelleValeur3 < -200){
                     nouvelleValeur3 = 1200;
                     stet=false
                     
                         //ICI CHANGER LA SOURCE DE LIMAGE 
                     }
                }else{
                    if(stop == false){
                    nouvelleValeur3 = leftValue + 2;
                    }else{
                        nouvelleValeur3 = leftValue + 1;
                    }
                    if(nouvelleValeur3 > 1200){
                     nouvelleValeur3 = -200;
                     stet=false;
                     //ICI CHANGER LA SOURCE DE LIMAGE 
                     
                         
                     }
                }

    
                 index.style.left = nouvelleValeur3 + 'px';
                 
                 //console.log(nouvelleValeur3)
                 **/
                 if(nouvelleValeur3 < 600 && nouvelleValeur3 > 250){
                     
                     //if pirate // if marchand
                     
                     if(!fight){
                         fight=true;
                         var attaque = document.createElement('h2');
                           attaque.textContent = 'Attaquer';
                           attaque.id = 'fight';
                           
                           $('#canvas').append(attaque);
                           
                     }
                     
                     if(!apres){
                         $('#fight').css('display','block');
                        $('#fight').css('left', nouvelleValeur3 + 'px');
                     }
                     
                     
                     $('#fight').on('click',function(){
                         $('#combat').css('display','flex');
                         arret=true;
                         
                        //gestion du combat
                        
                        //1 savoir si marchand ou pirate -> récupérer la source
                         var source = index.getAttribute('src');
                         if(source == "images/pirate.png"){
                             console.log('pirate')
                             var div = document.getElementById('informations_enemi');
                             if(div){
                                div.innerHTML = '';
                             }
                             var nom = document.createElement('h1');
                             nom.textContent = 'Bateau Pirate';
                             var vie = document.createElement('div');
                             vie.style.width = '100px';
                             vie.id = 'enemi_life';
                             var rec = document.createElement('h3');
                             rec.textContent='Récompenses possibles : or / boulets / carte au trésor';
                             
                             div.appendChild(nom);
                             div.appendChild(vie);
                             div.appendChild(rec)
                             
                             //changer la src dans combat
                             $('#en2').attr('src','images/pirate.png')
                         }else{
                             console.log('marchand')
                             var div = document.getElementById('informations_enemi');
                             if(div){
                                div.innerHTML = '';
                             }
                             var nom = document.createElement('h1');
                             nom.textContent = 'Marchands';
                             var vie = document.createElement('div');
                             vie.style.width = '100px';
                             vie.id = 'enemi_life';
                             var rec = document.createElement('h3');
                             rec.textContent='Récompenses possibles : poisson / vivres';
                             
                             div.appendChild(nom);
                             div.appendChild(vie);
                             div.appendChild(rec)
                             $('#en2').attr('src','images/marchand.png')
                         }
                         
                     })
                   
                }else{
                    $('#fight').css('display','none');
                }
                
                
            })
            
        }

        
        if(!arret){
        
$('#b_attaquer').on('click',function(){
                             
})

$('#b_fuir').on('click',function(){
    $('#combat').css('display','none');
    arret=false;
    message('Vous avez réussi à fuir',3000);
    
    $('#voile2').css('display','none')
    $('#boat2').css('display','none')
    
    $('#fight').css('display','none');
    apres=true;
})     
        
    
    //mouvement des nuages
        var $element = $('#clouds');
        var leftValue = parseFloat($element.css('left'), 10);
        
        var $element2 = $('#ile');
        var leftValue2 = parseFloat($element2.css('left'), 10);
        
        var nouvelleValeur = 0;
        var nouvelleValeur2 = 0;
        if(!inverser){
            if(stop == false){
             nouvelleValeur = leftValue - 1; 
             nouvelleValeur2 = leftValue2 - 1; 
            }else{
                 nouvelleValeur = leftValue - 0.5; 
                 nouvelleValeur2 = leftValue2 - 0.5; 
            }
            if(nouvelleValeur < -550){
               nouvelleValeur = 1100;
           }
           
           if(nouvelleValeur2 < -200){
               //console.log('OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
               nouvelleValeur2 = 1000;
               var sold = document.getElementById('sell');
               sold.innerHTML = '';
               new_ile();
               
               $('#voile2').css('display','block')
                        $('#boat2').css('display','block')
                        apres=false;
           }
        }else{
            if(stop == false){
             nouvelleValeur = leftValue + 1; 
             nouvelleValeur2 = leftValue2 + 1; 
            }else{
                 nouvelleValeur = leftValue + 0.5; 
                 nouvelleValeur2 = leftValue2 + 0.5; 
            }
            if(nouvelleValeur > 1100){
               nouvelleValeur = -550;
           }
           
           if(nouvelleValeur2 > 1000){
               nouvelleValeur2 = -200;
               var sold = document.getElementById('sell');
               sold.innerHTML = '';
               index_ile--;
               new_ile();
               index_ile--;
               
               $('#voile2').css('display','block')
                        $('#boat2').css('display','block')
                        apres=false;
           }
        }

       if(nouvelleValeur2 < 600 && nouvelleValeur2 > 350){
           //collision ile ici
           if(!amarer){
               amarer = true;
               
               /**
               var amarer2 = document.createElement('h2');
               amarer2.textContent = 'Amarer';
               amarer2.id = 'ile1';
               
               $('#canvas').append(amarer2);
               
               $('#ile1').on('click',function(){
                    $('#ile01').css('display','flex');
                    arret = true;
                    
                    **/
                    
                    //ICI on créé le menu de vente en fonction de l'inventaire. 
                    $('#ile01').css('display','flex');
                    arret = true;
                    var inventaire2 = document.getElementById('inv');
                    Array.from(inventaire2.children).forEach((child, index) => {
                        //console.log(`Enfant ${index + 1} :`, child);
                        var inom = child.querySelector('h2').textContent;
                        var iquantite = child.querySelector('h3').textContent;
                        iquantite = parseInt(iquantite.match(/\d+/)[0]);
                        var prix = "1e/unité";
                        
                        var newDiv = document.createElement('div');
                        var newH2 = document.createElement('h2');
                        var newH3 = document.createElement('h3');
                        
                        var newH32 = document.createElement('h3');
                        
                        
                        var select = document.createElement('select');
                        
                        select.classList.add('produit');
                        for (let i = 1; i < iquantite + 1; i++) {
                            //console.log(i)
                            var option = document.createElement('option');
                            option.value = i;
                            option.textContent = i;
                            select.appendChild(option);
                        }
                        
                        newH2.textContent = inom; 
                        //newH3.textContent = `x${quantite2}`;
                        newH3.textContent = prix;
                        newH32.textContent = "Vendre"; 
                        newH32.classList.add('Vendre');
                        
                        select.selectedIndex = select.options.length - 1;
                        
                        newDiv.appendChild(newH2);
                        newDiv.appendChild(select);
                        newDiv.appendChild(newH3)
                        newDiv.appendChild(newH32);
                        $('#buy').append(newDiv);
                        
                        vendre();
                    });
                //})
           }
       }else{
           amarer = false;
           var element = document.getElementById('ile1');
           if(element){
               element.remove();
           }
        
           
       }
       
       $('#ile1').css('left',nouvelleValeur2 + 'px');
       
       

       

        $element.css('left', nouvelleValeur + 'px');
        $element2.css('left', nouvelleValeur2 + 'px');
        
        
    } 
        
},20);

var spawn = "";
function boat_spawn(){
    var randomNumber = Math.floor(Math.random() * 2) + 1;
    if(randomNumber == 1){
        $('#boat2').attr('src','images/marchand.png')
        //console.log('marchand')
    }else{
        $('#boat2').attr('src','images/pirate.png')
        //console.log('pirate')
    }

    //var spawn = "droite";
    if(randomNumber == 1){
        spawn = "gauche";
        var voiles2 = document.getElementById('voile2')
        var boat2 = document.getElementById('boat2');
        boat2.style.transform = 'scale(1, 1)';
        voiles2.style.transform = 'scale(1, 1)';
        
        $('.enemi').css('left','1000px');
    }else{
        spawn='droite';
        var voiles2 = document.getElementById('voile2')
        var boat2 = document.getElementById('boat2');
        boat2.style.transform = 'scale(-1, 1)';
        voiles2.style.transform = 'scale(-1, 1)';
        $('.enemi').css('left','1000px');

    }
}


function vendre() {
    var vendreElements = document.querySelectorAll('.Vendre');

    vendreElements.forEach(element => {
        if (!element.dataset.eventAttached) {
            element.addEventListener('click', function(event) {
                //console.log('Clic détecté sur :', event.target);
                
                var boutonClique = event.target;
                var produitDiv = event.target.closest('div');
                var select2 = produitDiv.querySelector('.produit');
                var prix = produitDiv.querySelector('h3');
                var nom = produitDiv.querySelector('h2');
                nom = nom.textContent;
                //console.log(nom)
                prix = prix.textContent;
                prix = parseInt(prix.match(/\d+/)[0]);
                //console.log(prix)
                
                
                
                var quantite2 = select2.value;
                //console.log(quantite2)
                var prixTot = prix * quantite2;
                var valeurs = Array.from(select2.options).map(option => parseInt(option.value));
                var valeurMax = Math.max(...valeurs);
                
                if(quantite2 == valeurMax){

                        produitDiv.remove();
 
                        supp(nom,quantite2)
                        
                    }else{

                        for (let i = 0; i < quantite2; i++) {
                            var select3 = produitDiv.querySelector('.produit');
                            var optionsCount = select3.options.length;
                                select2.options[optionsCount - 1].remove(); 
                        }
                        supp(nom,quantite2)

                        
                        
                    }
                    
                    var money = $('#gold').text();
                    money = parseInt(money.match(/\d+/)[0]);
                    var reste = money + prixTot;
                    $('#gold').text(reste + " pieces d'or");
                
            })
            element.dataset.eventAttached = true;
        }
    })
}

document.addEventListener('keydown', (event) => {
    if (event.key === 'e' || event.key === 'E') {
        if(index < 1){
            stop=true;
           $('#voile').attr('src','images/voilefin.png')
           index++;
        }else{
            stop=false;
            index--;
            $('#voile').attr('src','images/voiles1.png');
            /**
            if(quest == 1){
                endquete('un');
                message('Vous pouvez baisser / relever vos voiles pour diminuer / augmenter la vitesse de votre bateau. De plus, des voiles relevées vous permettent de pécher du poisson !',5000)
                newquete('deux','Niv 2 - Pechez un poisson !', 'Appuyez sur R pour pécher un poisson lorsque vos voiles sont relevées.')
            }
            **/
            
            
        }
        
    }
    if (event.key === 'a' || event.key === 'A') {
        var o = $('#inv').css('display');
        if(o == "none"){
            $('#inv').css('display','flex');
        }else{
            $('#inv').css('display','none');
        }
    }
    if (event.key === 'r' || event.key === 'R') {
        var o = $('#inv').css('display');
        if(o == "none"){
            if(stop){
                add("Poisson","1");
                message('Vous avez attrapé un poisson !!','2000')
                //endquete('deux');
            }
        }
    }
    
    if (event.key === 'Escape' ) {
        /**
        console.log("OOOOOOOOOOOO")
        $('#inv').css('display','none');
        $('#ile01').css('display','none');
        arret=false;
        **/

        
    }
})

function gauche(){
    var voiles = document.getElementById('voile')
        var boat = document.getElementById('boat');
        boat.style.transform = 'scale(-1, 1)';
        voiles.style.transform = 'scale(-1, 1)';
        inverser = true;
        
        /**
        var voiles2 = document.getElementById('voile2')
        var boat2 = document.getElementById('boat2');
        boat2.style.transform = 'scale(1, 1)';
        voiles2.style.transform = 'scale(1, 1)';
        **/
}

function droite(){
    var voiles = document.getElementById('voile')
        var boat = document.getElementById('boat');
        boat.style.transform = 'scale(1, 1)';
        voiles.style.transform = 'scale(1, 1)';
        inverser = false;
        
        /**
        var voiles2 = document.getElementById('voile2')
        var boat2 = document.getElementById('boat2');
        boat2.style.transform = 'scale(-1, 1)';
        voiles2.style.transform = 'scale(-1, 1)';
        **/
}


//newquete("un",'Niv 1 - Relever les voiles','Appuyez sur E pour lever / baisser les voiles')

function newquete(id,h1,p){
    var element = document.createElement('h3');
    
    var texte = document.createElement('p');
    var div = document.createElement('div');
    element.textContent = h1;
    texte.textContent = p;
    div.append(element)
    div.append(texte)
    div.id = id;
    $('#quete').append(div);
}

function endquete(id){
    var element = document.getElementById(id);
    element.remove();
    quest++;
}

$('#map').on('click',function(){
    var src = $('#map').attr('src');
    //console.log(src)
    if(src == "images/map.png"){
        message("Vous ne possédez pas de carte, achetez en une auprès d'un marchand.",3000);
    }
})

//add("Boulets","5","blabla");
/**
setTimeout(function(){
    supp('Poisson','1');
},2000)
**/


function supp(obj,quantite2){
    //trouver la div et récupéré la quantité
    var enfants = document.querySelectorAll('#inv > div');
    var tableauEnfants = Array.from(enfants);
    var divPoisson = tableauEnfants.find(function(div) {
        var h2 = div.querySelector('h2');
        return h2 && h2.textContent.trim() === obj; 
    });
    
    if(divPoisson){
        var h3 = divPoisson.querySelector('h3');
        var quantite = h3.textContent.trim();
        var intquantite = parseInt(quantite.match(/\d+/)[0]);
        var quantite3 = parseInt(quantite2);
        var result = intquantite - quantite3;
        //console.log(result)
        if(result<=0){
            divPoisson.remove();
        }else{
            //enelver la quantite adéquate
            h3.textContent = `x${result}`;
        }
    }else{
        console.log("lobjet nexiste pas dans linventaire");
    }
    // faire quantité - quantité 2
    // si le résultat est 0 ou moins, supprimé la div, sinon, appliquer le nouveau résultat
    
    
}

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

    if (divPoisson) {
        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 = `x${intquantite}`;
    } else {
        var newDiv = document.createElement('div');
        var newH2 = document.createElement('h2');
        var newH3 = document.createElement('h3');
        
        newH2.textContent = obj; 
        newH3.textContent = `x${quantite2}`; 
        
        newDiv.appendChild(newH2);
        newDiv.appendChild(newH3);
        $('#inv').append(newDiv);
    }
}
//tableau de prix dans l'ile

//ile des marchands
const ile_1 = [
    { nom: "Poisson", prix: 8 },
    { nom: "Boulets", prix: 25 },
    { nom: "Vivres", prix: 15 },
    { nom: "Carte", prix: 50 },
    { nom: "Journal", prix: 80 }
];

//ile de la marine, 
const ile_2 = [
    { nom: "Poisson", prix: 12 },
    { nom: "Vivres", prix: 10 },
    { nom: "Carte", prix: 50 },
    { nom: "Journal", prix: 70 }
];

//ile pirate ?
const ile_3 = [
    { nom: "Boulets", prix: 20 },
    { nom: "Carte au trésor", prix: 100 },
    { nom: "Journal", prix: 80 }
];

var index_ile = 0;
var iles = [ile_1,ile_2,ile_3];
iles.forEach(produit => {
    //console.log(produit);
});

//tableau des iles

ile_1.forEach(produit => {
    //console.log(`Nom: ${produit.nom}, Prix: ${produit.prix.toFixed(2)} €`);
});

new_ile();

function new_ile(){
    //prend une ile random parmis celles ci
    
    //var ileAleatoire = iles[Math.floor(Math.random() * iles.length)];
    var ileAleatoire = iles[index_ile];
    index_ile++;
    
    ileAleatoire.forEach(produit => {
        //console.log(`Nom: ${produit.nom}, Prix: ${produit.prix.toFixed(2)} €`);
        var quantite = Math.floor((Math.random() * 12) +2);
        var prix = produit.prix;
        prix = prix + 'e/unité';
        var nom = produit.nom;
        
        if(nom == "Carte" || nom == "Journal" || nom == "Carte au trésor"){
            quantite = 2;
        }
        
        addmarket(nom,quantite,prix);
    });
    //récupère le marché.
    //associe le marché associé
    
}

var quetes = [
    { numero: 1, recompense: 10, titre: "Lever les voiles", description: "Appuyez sur e pour lever les voiles"},
    { numero: 2, recompense: 10, titre: "Pecher un poisson", description: "Appuyez sur r lorsque vos voiles sont baissées"}
];

var queteNumero2 = quetes.find(quete => quete.numero === 2);
//console.log(queteNumero2);





//create(2);

/**
function create(nb){
    var objets = ['Poisson','Boulet'];
    // FAIRE UN FOREACH -> MIEUX
    objets.forEach(item =>{
        var quantite = Math.floor((Math.random() * 12) +2);
        //console.log(quantite)
        var element = item;
        
        //console.log(element)
        
        if(element == "Poisson"){
            var prix = "2e/unité";
        }
        if(element == 'Boulet'){
            var prix = "5e/unité";
        }
        addmarket(element,quantite,prix);
    })

} 
**/

function addmarket(obj, quantite2,prix) {
    var enfants = document.querySelectorAll('#sell > div');
    var tableauEnfants = Array.from(enfants);
    
    // Trouver la div contenant l'objet (Poisson)
    var divPoisson = tableauEnfants.find(function(div) {
        var h2 = div.querySelector('h2');
        return h2 && h2.textContent.trim() === obj; 
    });

    if (divPoisson) {
        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 = `x${intquantite}`;
        

    //jpense le if on peut le supp mais je laisse au cas ou 
        
    } else {
        var newDiv = document.createElement('div');
        var newH2 = document.createElement('h2');
        var newH3 = document.createElement('h3');
        
        var newH32 = document.createElement('h3');
        
        
        var select = document.createElement('select');
        
        select.classList.add('produit');
        for (let i = 1; i < quantite2; i++) {
            //console.log(i)
            var option = document.createElement('option');
            option.value = i;
            option.textContent = i;
            select.appendChild(option);
        }
        
        newH2.textContent = obj; 
        //newH3.textContent = `x${quantite2}`;
        newH3.textContent = prix;
        newH32.textContent = "Acheter"; 
        newH32.classList.add('Acheter');
        
        select.selectedIndex = select.options.length - 1;
        
        newDiv.appendChild(newH2);
        newDiv.appendChild(select);
        newDiv.appendChild(newH3)
        newDiv.appendChild(newH32);
        $('#sell').append(newDiv);
        
        acheter();
    }
}

//GESTION DE LACHAT ICI

function acheter() {
    var acheterElements = document.querySelectorAll('.Acheter');

    acheterElements.forEach(element => {
        if (!element.dataset.eventAttached) {
            element.addEventListener('click', function(event) {
                //console.log('Clic détecté sur :', event.target);
                var boutonClique = event.target;
                var produitDiv = event.target.closest('div');
                var select2 = produitDiv.querySelector('.produit');
                var prix = produitDiv.querySelector('h3');
                prix = prix.textContent;
                prix = parseInt(prix.match(/\d+/)[0]);
                //console.log(prix)
                
                var quantite2 = select2.value;
                //console.log(quantite2)
                var valeurs = Array.from(select2.options).map(option => parseInt(option.value));
                var valeurMax = Math.max(...valeurs);
                
                var money = $('#gold').text();
                money = parseInt(money.match(/\d+/)[0]);
                
                var prixTot = prix * quantite2;
                if(money >= prixTot){
                    //AJOUT A LINV
                    
                    var nom = produitDiv.querySelector('h2');
                    nom = nom.textContent;
                    //console.log(nom.textContent)
                    
                    add(nom,quantite2);
                    
                    
                    var reste = money - prixTot;
                    $('#gold').text(reste + " pieces d'or");
                    if(quantite2 == valeurMax){

                        produitDiv.remove();
                    }else{

                        for (let i = 0; i < quantite2; i++) {
                            var select3 = produitDiv.querySelector('.produit');
                            var optionsCount = select3.options.length;
                                select2.options[optionsCount - 1].remove(); 
                        }
                        
                    }
                    
                }else{
                    message("Vous n'avez pas assez dargent",3000)
                }

            });
            element.dataset.eventAttached = true;
        }
    });
}
    
</script>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit