battles/classes/DressedItems.php

35 lines
872 B
PHP
Raw Normal View History

2020-07-06 19:54:50 +00:00
<?php
/**
* Author: lopiu
* Date: 06.07.2020
* Time: 22:41
*/
class DressedItems
{
protected $DB;
private $dressedItem;
2020-07-06 20:34:34 +00:00
public function __construct() {
// Пустой потому что нужны разные запросы.
}
private function getDressedItems($user_id)
2020-07-06 19:54:50 +00:00
{
try {
2020-07-06 20:34:34 +00:00
return db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
2020-07-06 20:10:24 +00:00
} catch (Exception $e) {
2020-07-06 20:34:34 +00:00
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
2020-07-06 19:54:50 +00:00
}
2020-07-06 20:34:34 +00:00
return null;
2020-07-06 19:54:50 +00:00
}
2020-07-06 20:34:34 +00:00
public function getSlots($user_id)
2020-07-06 19:54:50 +00:00
{
2020-07-06 20:34:34 +00:00
while ($row = $this->getDressedItems($user_id)->fetch_assoc()) {
2020-07-06 19:54:50 +00:00
$dressed_item[$row['dressed_slot']] = $row;
$this->dressedItem[$row['dressed_slot']] = $row;
}
return $this->dressedItem;
}
}