inventory.php 787 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require 'required.php';
  3. require 'onlyloggedin.php';
  4. $where = ['inventory.playeruuid' => $_SESSION['uuid']];
  5. if (!is_empty($VARS['classname'])) {
  6. $where = ["AND" => ['inventory.playeruuid' => $_SESSION['uuid'], 'itemclasses.classname' => $VARS['classname']]];
  7. }
  8. $inv = $database->select(
  9. 'items', [
  10. '[>]inventory' => ['itemid' => 'itemid'],
  11. '[>]itemclasses' => ['classid', 'classid']
  12. ], [
  13. 'inventory.itemuuid',
  14. 'inventory.itemid',
  15. 'inventory.itemjson',
  16. 'items.itemname',
  17. 'items.itemdesc',
  18. 'items.itemcode',
  19. 'itemclasses.classid',
  20. 'itemclasses.classname'
  21. ], $where
  22. );
  23. if ($inv == FALSE) {
  24. $inv = [];
  25. }
  26. $out['status'] = 'OK';
  27. $out['items'] = $inv;
  28. echo json_encode($out);