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-07 09:52:54 +00:00
|
|
|
/**
|
|
|
|
* DressedItems constructor.
|
|
|
|
*/
|
|
|
|
public function __construct() {}
|
2020-07-06 20:34:34 +00:00
|
|
|
|
2020-07-07 09:50:45 +00:00
|
|
|
private function getDressedItems()
|
2020-07-06 19:54:50 +00:00
|
|
|
{
|
|
|
|
try {
|
2020-07-07 09:50:45 +00:00
|
|
|
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->userid);
|
|
|
|
while ($row = $this->DB->fetch_assoc()) {
|
|
|
|
$dressed_item[$row['dressed_slot']] = $row;
|
|
|
|
$this->dressedItem[$row['dressed_slot']] = $row;
|
|
|
|
}
|
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-07 09:50:45 +00:00
|
|
|
public function getSlots()
|
2020-07-06 19:54:50 +00:00
|
|
|
{
|
2020-07-07 09:50:45 +00:00
|
|
|
return $this->dressedItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function runQuery($user_id)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $user_id);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
echo '<div class="debug">getDressedItems: ' . $e . '</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function eeee($user_id)
|
|
|
|
{
|
|
|
|
if (!$this->DB) {
|
|
|
|
$this->runQuery($user_id);
|
|
|
|
}
|
|
|
|
while ($row = $this->DB->fetch_assoc()) {
|
2020-07-06 19:54:50 +00:00
|
|
|
$dressed_item[$row['dressed_slot']] = $row;
|
|
|
|
$this->dressedItem[$row['dressed_slot']] = $row;
|
|
|
|
}
|
|
|
|
}
|
2020-07-07 09:50:45 +00:00
|
|
|
|
2020-07-06 19:54:50 +00:00
|
|
|
}
|