query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc(); foreach ($this as $key => $value) { if (isset($user_query[$key])) { $this->$key = $user_query[$key]; } } } private function UserInfoDoll($isBattle = 0) { //https://jsfiddle.net/ngx0yvhc $dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id); while ($row = $dressed_items->fetch_assoc()) { $dressed_item[$row['dressed_slot']] = $row; } for ($i = 1; $i <= 12; $i++) { echo sprintf('
', $i); if (isset($dressed_item[$i])) { $itemString = '%s%s'; echo sprintf($itemString, $dressed_item[$i]['image'], $dressed_item[$i]['name'], $dressed_item[$i]['name']); } else { echo sprintf('Пустой слот [%s]', $i, $i); } echo sprintf('
', $i); } echo '
'; if ($isBattle) { $sh = '%s%sУровень: %s
Сила: %s
Ловкость: %s
Интуиция: %s
Выносливость: %s
Интеллект: %s
Мудрость: %s
'; echo sprintf($sh, $this->shadow, $this->login, $this->login, $this->level, $this->strength, $this->dexterity, $this->intuition, $this->endurance, $this->intelligence, $this->wisdom); unset($sh); } else { echo '' . $this->login . ''; } echo '
'; } private function UserInfoStats($isMainWindow = 0) { $captions = 'Уровень:
Сила:
Ловкость:
Интуиция:
Выносливость:
Интеллект:
Мудрость:
Местонахождение:'; $variables = $this->level . '
' . $this->getStrength() . '
' . $this->getDexterity() . '
' . $this->getIntuition() . '
' . $this->getEndurance() . '
' . $this->getIntelligence() . '
' . $this->getWisdom() . '
' . $this->getRoomName($this->room); if ($isMainWindow) { $this->Bank = new Bank($this->id); $captions = 'Уровень:
Сила:
Ловкость:
Интуиция:
Выносливость:
Интеллект:
Мудрость:
Деньги:
Деньги в банке:'; $variables =$this->level . '
' . $this->getStrength(1) . '
' . $this->getDexterity(1) . '
' . $this->getIntuition(1) . '
' . $this->getEndurance(1) . '
' . $this->getIntelligence(1) . '
' . $this->getWisdom(1) . '
' . $this->money . '
' . $this->Bank->money; } if ($this->align) { $nameString = sprintf('', $this->align); } if ($this->block) { $nameString .= ''.$this->login.''; } else { $nameString .= ' '.$this->login.' '; } if ($this->clan) { $nameString .= sprintf('', ClanImage($this->clan)); } echo '
'; echo '
'; echo '' .$nameString. ''; echo '
'; echo '
'; echo '
'; echo $captions; echo '
'; echo '
'; echo $variables; echo '
'; echo '
'; echo '
TODO: Сделать рассчёт здоровья и модификаторов. Вывести полоску здоровья когда будет от чего отталкиваться.
'; echo '
'; } private function getStrength($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->strength); } return $this->strength; } private function getDexterity($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->dexterity); } return $this->strength; } private function getIntuition($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->intuition); } return $this->strength; } private function getEndurance($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->endurance); } return $this->strength; } private function getIntelligence($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->intelligence); } return $this->strength; } private function getWisdom($isMainWindow = 0) { if ($this->stat_points && $isMainWindow) { return sprintf('%s [+]', $this->wisdom); } return $this->strength; } private function UserInfo() { echo '
'; $this->UserInfoDoll(); $this->UserInfoStats(); echo '
'; if ($this->married) { echo sprintf('В браке с %s', $this->married, $this->married, $this->married); } echo '
'; echo '
'; echo sprintf('Родовой знак', $this->showStarSign()); echo '
'; echo '
'; echo '
'; echo '
'; echo '

Об игроке

'; if ($this->realname) { echo sprintf('Имя: %s
', $this->realname); } if ($this->info) { echo nl2br($this->info); } echo '
'; if ($this->watcherIsAdmin || $this->watcherIsModerator) { echo '
'; $infoString = 'E-Mail: %s
ДР Игрока: %s
IP Регистрации: %s'; echo sprintf($infoString, $this->email, date('d.m.Y', strtotime($this->borndate)), $this->ip); if ($this->watcherIsAdmin) { $this->Bank = new Bank($this->id); $infoString = '
ИД Игрока: %s
ИД Комнаты: %s
Деньги: %s
Деньги в банке: %s
Опыт: %s
Нераспределённые очки: %s
Текущая сессия: %s
'; echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->money, $this->experience, $this->stat_points, $this->session_id); } $this->UserLogs = new UserLogModel($this->id); echo '
Личное дело
'; while ($userLogRow = $this->UserLogs->getUserLog()->fetch_object()) { echo sprintf('%s
', date("d.m.Y H:i ", strtotime($userLogRow->date)) . $userLogRow->text); } echo '
'; echo '
'; } } private function WatcherStatus() { $query = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc(); if ($query['admin']) { $this->watcherIsAdmin = 1; } if ($query['align'] == 1) { $this->watcherIsModerator = 1; } } public function showUserInfo() { $this->effects = new EffectsModel($this->id); $this->WatcherStatus(); if ($this->block && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) { throw new Exception('Персонаж ' . $this->login . ' заблокирован!'); } elseif ($this->effects->getHideUserInfoStatus() && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) { if ($this->effects->getHideUserInfoStatus() == -1) { $date = 'навсегда'; } else { $date = 'до' . date('d.m.Y', strtotime($this->effects->getHideUserInfoStatus())); } throw new Exception('Персонаж ' . $this->login . ' обезличен ' . $date . '.'); } else { $this->UserInfo(); } } public function showUserDoll($isBattle = 0) { echo '
'; $this->UserInfoDoll($isBattle); echo '
'; } public function showUserInfoMain() { echo '
'; $this->UserInfoDoll(); $this->userInfoStats(1); echo '
'; } public function showStarSign() { /* * 1 aries * 2 taurus * 3 gemini * 4 cancer * 5 leo * 6 virgo * 7 libra * 8 scorpio * 9 sagittarios * 10 capricorn * 11 aquarius * 12 pisches */ $zodiac[356] = "10"; $zodiac[326] = "09"; $zodiac[296] = "08"; $zodiac[266] = "07"; $zodiac[235] = "06"; $zodiac[203] = "05"; $zodiac[172] = "04"; $zodiac[140] = "03"; $zodiac[111] = "02"; $zodiac[78] = "01"; $zodiac[51] = "12"; $zodiac[20] = "11"; $zodiac[0] = "10"; $dayOfYear = date("z", strtotime($this->borndate)); $isLeapYear = date("L", strtotime($this->borndate)); //Высокосный? if ($isLeapYear && $dayOfYear > 59) { --$dayOfYear; } foreach ($zodiac as $day => $sign) { if ($dayOfYear > $day) { break; } } return $sign ?? null; } }