diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/perso.inc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/inc/perso.inc b/inc/perso.inc index 075f8ae..4fb05ef 100644 --- a/inc/perso.inc +++ b/inc/perso.inc @@ -1,8 +1,8 @@ <?php function sendPerso() { - if(!empty($_SESSION["perso"])) - return $_SESSION["perso"]; - else return false; + if(empty($_SESSION["perso"])) + initPerso(); + return $_SESSION["perso"]; } function updatePerso(){ @@ -14,4 +14,10 @@ function updatePerso(){ $_SESSION["perso"]["lv"] = $lv; } +function initPerso(){ + $_SESSION["perso"]["hp"] = 5; + $_SESSION["perso"]["xp"] = 0; + $_SESSION["perso"]["lv"] = 3; +} + ?> |