aboutsummaryrefslogtreecommitdiffstats
path: root/inc/Inventory.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/Inventory.inc')
-rw-r--r--inc/Inventory.inc17
1 files changed, 17 insertions, 0 deletions
diff --git a/inc/Inventory.inc b/inc/Inventory.inc
index 024a4fe..747c4db 100644
--- a/inc/Inventory.inc
+++ b/inc/Inventory.inc
@@ -46,6 +46,23 @@ class Inventory {
$inv->_removeItem($item);
}
+ private function _useItem($item) {
+ foreach($this->items as $k => $object){
+ if($object[0] == $item){
+ if($this->items[$k][1]>0)$this->items[$k][1]--;
+ //if($this->items[$k][1] == 0) _removeItem($item);
+ return $this->items[$k];
+ }
+ }
+ return false;
+ }
+
+ public static function useItem($item) {
+ $inv = self::get();
+ $it = $inv->_useItem($item);
+ return $it;
+ }
+
public function addToXML($root) {
foreach($this->items as $item)
$item->addToXML($root);