aboutsummaryrefslogtreecommitdiffstats
path: root/inc/dungeon.inc
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-07 13:48:28 +0200
committerpiernov <piernov@piernov.org>2016-05-07 13:48:28 +0200
commitb91588134f3067c2771011c10af77cda5f9031e8 (patch)
treea8e5f1bde0bfe9539bb5dd29e249ee8c6b1f36d6 /inc/dungeon.inc
parent8621eae6aa5fcdba0a60f0a5f1136412c61999ec (diff)
parent80f5826d1ac8f6d42866d5133c6f463943b96bab (diff)
downloadcandybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.gz
candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.bz2
candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.xz
candybox-b91588134f3067c2771011c10af77cda5f9031e8.zip
Merge branch 'alexichi' into feat/gui
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.
}
?>