diff options
author | alexichi <alexbankai96@gmail.com> | 2016-05-05 20:28:26 +0200 |
---|---|---|
committer | alexichi <alexbankai96@gmail.com> | 2016-05-05 20:28:26 +0200 |
commit | 1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762 (patch) | |
tree | ab1db10e2115afaaef7a1d9837356c5688260188 /inc | |
parent | 64e184b901fd4e7c9a829d14c5c34416923171c3 (diff) | |
download | candybox-1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762.tar.gz candybox-1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762.tar.bz2 candybox-1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762.tar.xz candybox-1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762.zip |
add dungeon server side and improve some details like the difference between floors
Diffstat (limited to 'inc')
-rw-r--r-- | inc/dungeon.inc | 16 | ||||
-rw-r--r-- | inc/messages.inc | 3 |
2 files changed, 13 insertions, 6 deletions
diff --git a/inc/dungeon.inc b/inc/dungeon.inc index 81e2ba7..ebe74b7 100644 --- a/inc/dungeon.inc +++ b/inc/dungeon.inc @@ -21,12 +21,12 @@ function generateMonster(){ } function initDungeon() { - $_SESSION["dungeon"] = true; + $_SESSION["dungeon"]["access"] = true; } function sendDungeon() { if(!empty($_SESSION["dungeon"])) - return generateMonster(); + return $_SESSION["dungeon"]; else return false; } @@ -43,14 +43,22 @@ function buildDungeon() { } function launchDungeon(){ + $f= $_POST["floor"]; $dungeon=generateMonster(); - $opponent = $dungeon["monsters"]["floor1"]; + $opponent = $dungeon["monsters"]["floor".$f]; echo json_encode($opponent); } +function sendDungeonProgress(){ + $f= $_POST["floor"]; + $nb=$_POST["mob"]; + $_SESSION["dungeon"]["flat"] = $f; + $_SESSION["dungeon"]["mob"] = $nb; +} + + function exitDungeon(){ $_SESSION["dungeon"] = false; - echo json_encode(array("a" => 7));//Cette ligne ne sert qu'à contourner l'erreur créé à cause de sendRequest. A revoir. } ?> diff --git a/inc/messages.inc b/inc/messages.inc index c51adba..1f25ed3 100644 --- a/inc/messages.inc +++ b/inc/messages.inc @@ -6,8 +6,7 @@ $messages = array( "shop_missing_item" => "This item does not exist.", "guild_not_yet_created" => "You need to create a guild first.", "guild_already_built" => "You have aready built a guild.", - "dungeon_already_available" => "You can already access the dungeon" - + "dungeon_already_available" => "You can already access the dungeon", "gamesave_ok" => "Game saved.", "gamesave_error" => "An error occured when trying to save the game.", "gamesave_not_found" => "Couldn't find the specified save file.", |