diff options
author | piernov <piernov@piernov.org> | 2016-05-07 13:48:28 +0200 |
---|---|---|
committer | piernov <piernov@piernov.org> | 2016-05-07 13:48:28 +0200 |
commit | b91588134f3067c2771011c10af77cda5f9031e8 (patch) | |
tree | a8e5f1bde0bfe9539bb5dd29e249ee8c6b1f36d6 /inc/perso.inc | |
parent | 8621eae6aa5fcdba0a60f0a5f1136412c61999ec (diff) | |
parent | 80f5826d1ac8f6d42866d5133c6f463943b96bab (diff) | |
download | candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.gz candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.bz2 candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.xz candybox-b91588134f3067c2771011c10af77cda5f9031e8.zip |
Merge branch 'alexichi' into feat/gui
Diffstat (limited to 'inc/perso.inc')
-rw-r--r-- | inc/perso.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/perso.inc b/inc/perso.inc new file mode 100644 index 0000000..0362d8c --- /dev/null +++ b/inc/perso.inc @@ -0,0 +1,23 @@ +<?php +function sendPerso() { + if(empty($_SESSION["perso"])) + initPerso(); + return $_SESSION["perso"]; +} + +function updatePerso(){ + $hp = $_POST["hp"]; + $xp = $_POST["xp"]; + $lv = $_POST["lv"]; + $_SESSION["perso"]["hp"] = $hp; + $_SESSION["perso"]["xp"] = intval($xp); + $_SESSION["perso"]["lv"] = $lv; +} + +function initPerso(){ + $_SESSION["perso"]["hp"] = 5; + $_SESSION["perso"]["xp"] = 0; + $_SESSION["perso"]["lv"] = 3; +} + +?> |