Старт переноса showinf_pers(); в класс (fuck!_)

This commit is contained in:
lopar 2020-07-04 20:23:02 +03:00
parent 28df3b93ee
commit ef9e74d7f2

View File

@ -44,13 +44,16 @@ class User
}
public function showUserInfo() {
$dressed_items_array = [];
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id)->fetch_assoc();
foreach ($dressed_items as $key=>$value) {
//$dressed_items_array[$dressed_items['dressed_slot']][$key] = $value;
//$dressed_items_object[$dressed_items['dressed_slot']]->$key = $value;
//$dressed_items_array[$dressed_items->dressed_slot][$key] = $dressed_items->$value;
$dressed_items_array[$dressed_items['dressed_slot']][$key] = $dressed_items[$key];
$dressed_item = [];
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
// foreach ($dressed_items as $key=>$value) {
// //$dressed_items_array[$dressed_items['dressed_slot']][$key] = $value;
// //$dressed_items_object[$dressed_items['dressed_slot']]->$key = $value;
// //$dressed_items_array[$dressed_items->dressed_slot][$key] = $dressed_items->$value;
// $dressed_items_array[$dressed_items['dressed_slot']][$key] = $dressed_items[$key];
// }
while ($row = $dressed_items->fetch_assoc()) {
$dressed_item[$row['dressed_slot']] = $row;
}
echo <<<USERINFO
@ -64,10 +67,10 @@ class User
Находится в {$this->getRoomName($this->room)}<br>
Предметы на тушке: <br>
USERINFO;
if (isset($dressed_items_array[1])) {
if (isset($dressed_item[1])) {
echo "В руке — " .$dressed_items_array[1]['name'].PHP_EOL;
}
if (isset($dressed_items_array[4])) {
if (isset($dressed_item[4])) {
echo "На пузе — " .$dressed_items_array[4]['name'].PHP_EOL;
}
if (isset($dressed_items_object[1])) {
@ -76,7 +79,7 @@ USERINFO;
if (isset($dressed_items_object[4])) {
echo "!На пузе — " .$dressed_items_array[4]->name.PHP_EOL;
}
var_dump($dressed_items_array).PHP_EOL;
var_dump($dressed_item).PHP_EOL;
//var_dump($dressed_items_object).PHP_EOL;
echo "<p>"; var_dump($dressed_items).PHP_EOL;
}