This repository has been archived on 2019-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
Server-v1/inventory.php

35 lines
787 B
PHP
Raw Normal View History

2016-07-04 00:51:42 -06:00
<?php
require 'required.php';
2016-08-07 22:27:14 -06:00
require 'onlyloggedin.php';
$where = ['inventory.playeruuid' => $_SESSION['uuid']];
if (!is_empty($VARS['classname'])) {
$where = ["AND" => ['inventory.playeruuid' => $_SESSION['uuid'], 'itemclasses.classname' => $VARS['classname']]];
2016-07-04 00:51:42 -06:00
}
2016-08-07 22:27:14 -06:00
$inv = $database->select(
'items', [
'[>]inventory' => ['itemid' => 'itemid'],
'[>]itemclasses' => ['classid', 'classid']
], [
'inventory.itemuuid',
'inventory.itemid',
'inventory.itemjson',
'items.itemname',
'items.itemdesc',
'items.itemcode',
'itemclasses.classid',
'itemclasses.classname'
], $where
2016-08-07 22:27:14 -06:00
);
2016-07-04 00:51:42 -06:00
if ($inv == FALSE) {
$inv = [];
}
2016-07-04 00:51:42 -06:00
$out['status'] = 'OK';
$out['items'] = $inv;
2016-08-07 22:27:14 -06:00
echo json_encode($out);