<?php
/**
 * Copyright (c) 2018.
 * Author: Igor Barkov <lopar.4ever@gmail.com>
 * Project name: Battles-Game
 */

class showpers
{
    private $pers_data;
    private $weared_items;

    private function __construct($id)
    {
        if (!$this->pers_data) {
            $query = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
            $this->pers_data = $query;
        }
        if (!$this->weared_items) {
            $query = db::c()->query('SELECT `name`, `img`, `type` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 1', $id);
            $this->weared_items = $query;
        }
    }

    private function dgfs()
    {
        $w_items['sergi'] = $this->pers_data['sergi'];
        $w_items['kulon'] = $this->pers_data['kulon'];
        $w_items['weap'] = $this->pers_data['weap'];
        $w_items['bron'] = $this->pers_data['bron'];
        $w_items['r1'] = $this->pers_data['r1'];
        $w_items['r2'] = $this->pers_data['r2'];
        $w_items['r3'] = $this->pers_data['r3'];
        $w_items['helm'] = $this->pers_data['helm'];
        $w_items['perchi'] = $this->pers_data['perchi'];
        $w_items['shit'] = $this->pers_data['shit'];
        $w_items['boots'] = $this->pers_data['boots'];
        $w_items['rubax'] = $this->pers_data['rubax'];
        $w_items['plaw'] = $this->pers_data['plaw'];
        $w_items['rune1'] = $this->pers_data['rune1'];
        $w_items['rune2'] = $this->pers_data['rune2'];
        $w_items['rune3'] = $this->pers_data['rune3'];
    }
}
