diff options
Diffstat (limited to 'inc/perso.inc')
-rw-r--r-- | inc/perso.inc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/inc/perso.inc b/inc/perso.inc index 0362d8c..f455173 100644 --- a/inc/perso.inc +++ b/inc/perso.inc @@ -1,17 +1,24 @@ <?php + function sendPerso() { if(empty($_SESSION["perso"])) initPerso(); return $_SESSION["perso"]; } +function increasePerso($prop, $num) { + if(empty($_SESSION["perso"])) + initPerso(); + $_SESSION["perso"][$prop] += $num; +} + function updatePerso(){ $hp = $_POST["hp"]; $xp = $_POST["xp"]; $lv = $_POST["lv"]; - $_SESSION["perso"]["hp"] = $hp; - $_SESSION["perso"]["xp"] = intval($xp); - $_SESSION["perso"]["lv"] = $lv; + $_SESSION["perso"]["hp"] = +$hp; + $_SESSION["perso"]["xp"] = +$xp; + $_SESSION["perso"]["lv"] = +$lv; } function initPerso(){ |