USERID = $user_id;
}
private function getDressedItems()
{
try {
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID);
} catch (Exception $e) {
echo '
Не прогрузилась таблица inventory (*) для класса DressedItems.
';
}
}
private function getBonusesFromDressedItems()
{
try {
$query = << 0
SQL;
$this->DBSUM = db::c()->query($query, $this->USERID)->fetch_assoc();
} catch (Exception $e) {
echo 'Не прогрузилась таблица inventory (SUM) для класса DressedItems:' . $e . '
';
}
}
public function getItemsInSlots()
{
if (!$this->DB) {
self::getDressedItems();
}
while ($row = $this->DB->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
$this->dressedItem[$row['dressed_slot']] = $row;
}
return $this->dressedItem;
}
private function getBonuses()
{
if (!$this->DBSUM) {
self::getBonusesFromDressedItems();
}
return $this->DBSUM;
}
public function getStrengthBonus()
{
return self::getBonuses()['sum_strength'];
}
public function getDexterityBonus()
{
return self::getBonuses()['sum_dexterity'];
}
public function getIntuitionBonus()
{
return self::getBonuses()['sum_intuition'];
}
public function getEnduranceBonus()
{
return self::getBonuses()['sum_endurance'];
}
public function getIntelliganceBonus()
{
return self::getBonuses()['sum_intelligence'];
}
public function getWisdomBonus()
{
return self::getBonuses()['sum_wisdom'];
}
public function getAccuracyBonus()
{
return self::getBonuses()['sum_accuracy'];
}
public function getEvasionBonus()
{
return self::getBonuses()['sum_evasion'];
}
public function getCriticalsBonus()
{
return self::getBonuses()['sum_criticals'];
}
public function getItemsWeight()
{
return self::getBonuses()['sum_weight'];
}
public function undressItem($slot_id)
{
if (!$slot_id || $this->dressedItem[$slot_id]) {
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID);
}
}
}