aboutsummaryrefslogtreecommitdiffstats
path: root/inc/dungeon.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/dungeon.inc')
-rw-r--r--inc/dungeon.inc21
1 files changed, 15 insertions, 6 deletions
diff --git a/inc/dungeon.inc b/inc/dungeon.inc
index 81e2ba7..c023cf8 100644
--- a/inc/dungeon.inc
+++ b/inc/dungeon.inc
@@ -12,8 +12,9 @@ function generateMonster(){
$dungeon["monsters"][$floor] = array();
foreach($f as $monster){
$dungeon["monsters"][$floor][] = new Monster((string)$monster->name,
- intval($monster->level),
- intval($monster->hp),
+ intval($monster->level),
+ intval($monster->hp),
+ intval($monster->xp),
(string)$monster->icon);
}
}
@@ -21,12 +22,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 +44,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.
}
?>