aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authoralexichi <alexbankai96@gmail.com>2016-05-11 11:53:06 +0200
committeralexichi <alexbankai96@gmail.com>2016-05-11 11:53:06 +0200
commit2350d43a09495db18b22b86ffc815a84eeb35579 (patch)
tree8b69035a58e2900d66c174fa579bfafdc97a1548 /inc
parent7f455adbac3c5f3c67c891249576e9045870edb6 (diff)
downloadcandybox-2350d43a09495db18b22b86ffc815a84eeb35579.tar.gz
candybox-2350d43a09495db18b22b86ffc815a84eeb35579.tar.bz2
candybox-2350d43a09495db18b22b86ffc815a84eeb35579.tar.xz
candybox-2350d43a09495db18b22b86ffc815a84eeb35579.zip
add longevity feature to items
Diffstat (limited to 'inc')
-rw-r--r--inc/perso.inc21
1 files changed, 14 insertions, 7 deletions
diff --git a/inc/perso.inc b/inc/perso.inc
index 9293d3c..ecf2a99 100644
--- a/inc/perso.inc
+++ b/inc/perso.inc
@@ -1,5 +1,7 @@
<?php
+require_once("Inventory.inc");
+
function sendPerso() {
if(empty($_SESSION["perso"]))
initPerso();
@@ -27,6 +29,7 @@ function limitUse($item){
if(empty($item->feat["limit"])) return true;
else if(empty($_SESSION["usedItem"])){
initUsedItem();
+ $_SESSION["usedItem"][$n] = array();
$_SESSION["usedItem"][$n]["nbUse"]=1;
return true;
}
@@ -39,13 +42,17 @@ function limitUse($item){
}
}
-function initUsedItem(){
- $_SESSION["usedItem"]["Strength Bottle"]["longevity"] = 0;//if longevity equals 2, it means that the item was used during 2 battles
- $_SESSION["usedItem"]["Wooden Sword"]["longevity"] = 0;
- $_SESSION["usedItem"]["Metal Sword"]["longevity"] = 0;
- $_SESSION["usedItem"]["Strength Bottle"]["nbUse"] = 0;
- $_SESSION["usedItem"]["Wooden Sword"]["nbUse"] = 0;
- $_SESSION["usedItem"]["Metal Sword"]["nbUse"] = 0;
+function initUsedItem(){
+ $_SESSION["usedItem"]=array();
+}
+
+function resetUsedItem($item){
+ $it = $_SESSION["usedItem"][$item];
+ foreach($it as $k => $v){
+ foreach($v as $val){
+ $val = 0;
+ }
+ }
}
function reusable(){