aboutsummaryrefslogtreecommitdiffstats
path: root/inc/perso.inc
blob: f45517309f7f7f1ba95f7f79355589d54b381701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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"] = +$xp;
	$_SESSION["perso"]["lv"] = +$lv;
}

function initPerso(){
	$_SESSION["perso"]["hp"] = 5;
	$_SESSION["perso"]["xp"] = 0;
	$_SESSION["perso"]["lv"] = 3;
}

?>