2020-07-03 13:23:08 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class User
|
|
|
|
|
{
|
|
|
|
|
public $id;
|
|
|
|
|
public $login;
|
|
|
|
|
public $email;
|
|
|
|
|
public $realname;
|
|
|
|
|
public $borndate;
|
|
|
|
|
public $info;
|
|
|
|
|
public $level;
|
|
|
|
|
public $align;
|
|
|
|
|
public $clan;
|
|
|
|
|
public $money;
|
|
|
|
|
public $strength;
|
|
|
|
|
public $dexterity;
|
|
|
|
|
public $intuition;
|
|
|
|
|
public $endurance;
|
|
|
|
|
public $intelligence;
|
|
|
|
|
public $wisdom;
|
|
|
|
|
public $ip;
|
|
|
|
|
public $session_id;
|
|
|
|
|
public $admin;
|
|
|
|
|
public $enter_game;
|
|
|
|
|
public $room;
|
|
|
|
|
public $block;
|
|
|
|
|
|
2020-07-03 13:49:39 +00:00
|
|
|
|
// Пока несуществующие, для совместимости.
|
|
|
|
|
public $married;
|
|
|
|
|
public $exp;
|
|
|
|
|
public $stats;
|
|
|
|
|
|
2020-07-04 10:49:43 +00:00
|
|
|
|
use Rooms;
|
|
|
|
|
|
2020-07-03 13:33:34 +00:00
|
|
|
|
public function __construct($user)
|
2020-07-03 13:23:08 +00:00
|
|
|
|
{
|
2020-07-03 16:21:57 +00:00
|
|
|
|
$user_query = db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
2020-07-03 13:23:08 +00:00
|
|
|
|
foreach ($this as $key => $value) {
|
|
|
|
|
if (isset($user_query[$key])) {
|
|
|
|
|
$this->$key = $user_query[$key];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-03 16:37:24 +00:00
|
|
|
|
|
2020-07-04 10:49:43 +00:00
|
|
|
|
public function showUserInfo() {
|
2020-07-04 12:58:53 +00:00
|
|
|
|
$dressed_items_array = [];
|
2020-07-04 16:32:31 +00:00
|
|
|
|
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id)->fetch_assoc();
|
2020-07-04 13:05:54 +00:00
|
|
|
|
foreach ($dressed_items as $key=>$value) {
|
2020-07-04 16:24:43 +00:00
|
|
|
|
//$dressed_items_array[$dressed_items['dressed_slot']][$key] = $value;
|
2020-07-04 16:25:36 +00:00
|
|
|
|
//$dressed_items_object[$dressed_items['dressed_slot']]->$key = $value;
|
2020-07-04 16:32:31 +00:00
|
|
|
|
//$dressed_items_array[$dressed_items->dressed_slot][$key] = $dressed_items->$value;
|
|
|
|
|
$dressed_items_array[$dressed_items['dressed_slot']][$key] = $dressed_items[$key];
|
2020-07-04 11:50:53 +00:00
|
|
|
|
}
|
2020-07-04 12:58:53 +00:00
|
|
|
|
|
2020-07-04 11:37:36 +00:00
|
|
|
|
echo <<<USERINFO
|
2020-07-04 11:18:28 +00:00
|
|
|
|
Имя {$this->login} <br>
|
|
|
|
|
Сила {$this->strength} <br>
|
|
|
|
|
Ловкость {$this->dexterity} <br>
|
|
|
|
|
Интуиция {$this->intuition} <br>
|
|
|
|
|
Выносливость {$this->endurance} <br>
|
|
|
|
|
Интеллект {$this->intelligence} <br>
|
|
|
|
|
Мудрость {$this->wisdom} <br>
|
2020-07-04 11:37:36 +00:00
|
|
|
|
Находится в {$this->getRoomName($this->room)}<br>
|
|
|
|
|
Предметы на тушке: <br>
|
2020-07-04 11:18:28 +00:00
|
|
|
|
USERINFO;
|
2020-07-04 13:11:28 +00:00
|
|
|
|
if (isset($dressed_items_array[1])) {
|
|
|
|
|
echo "В руке — " .$dressed_items_array[1]['name'].PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
if (isset($dressed_items_array[4])) {
|
|
|
|
|
echo "На пузе — " .$dressed_items_array[4]['name'].PHP_EOL;
|
|
|
|
|
}
|
2020-07-04 16:20:59 +00:00
|
|
|
|
if (isset($dressed_items_object[1])) {
|
|
|
|
|
echo "!В руке — " .$dressed_items_array[1]->name.PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
if (isset($dressed_items_object[4])) {
|
|
|
|
|
echo "!На пузе — " .$dressed_items_array[4]->name.PHP_EOL;
|
|
|
|
|
}
|
2020-07-04 16:29:33 +00:00
|
|
|
|
var_dump($dressed_items_array).PHP_EOL;
|
2020-07-04 16:25:36 +00:00
|
|
|
|
//var_dump($dressed_items_object).PHP_EOL;
|
2020-07-04 16:24:43 +00:00
|
|
|
|
echo "<p>"; var_dump($dressed_items).PHP_EOL;
|
2020-07-04 10:49:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-03 13:23:08 +00:00
|
|
|
|
}
|