id); $stats = new UserStats($this->id); $dressedItems = $di->getItemsInSlots(); $str = null; for ($i = 1; $i <= 12; $i++) { $str .= sprintf('
', $i); if (!empty($dressedItems->$i)) { if (!$isBattle && $isMain) { $str .= sprintf('%s', mt_rand(), $i, $dressedItems->$i->image, $dressedItems->$i->name, $dressedItems->$i->name); } else { $str .= sprintf('%s%s', $dressedItems->$i->image, $dressedItems->$i->name, $dressedItems->$i->name); } } else { $str .= sprintf('Пустой слот [%s]', $i, $i); } $str .= sprintf('
', $i); } $str .= '
'; if ($isBattle) { $str .= sprintf('%s%sУровень: %s
Сила: %s
Ловкость: %s
Интуиция: %s
Выносливость: %s
Интеллект: %s
Мудрость: %s
', $this->shadow, $stats->getLogin(), $stats->getLogin(), $stats->getLevel(), $stats->getStat('strength'), $stats->getStat('dexterity'), $stats->getStat('intuition'), $stats->getStat('endurance'), $stats->getStat('intelligence'), $stats->getStat('wisdom')); unset($sh); } else { $str .= '' . $this->login . ''; } $str .= '
'; return $str; } public function test(): array { return [ 'Сила' => $this->strength, 'Ловкость' => $this->dexterity, 'Интуиция' => $this->intuition, 'Выносливость' => $this->endurance, 'Интеллект' => $this->intelligence, 'Мудрость' => $this->wisdom, ]; } /** Вызов из inf.php */ private function ttz(): string { $stat = $this->getFullStats(); $arr = [ 'Уровень' => $this->level, 'Сила' => $this->strength, 'Ловкость' => $this->dexterity, 'Интуиция' => $this->intuition, 'Выносливость' => $this->endurance, 'Интеллект' => $this->intelligence, 'Мудрость' => $this->wisdom, 'Уворот' => $stat->evasion, 'Точность' => $stat->accuracy, 'Шанс крита' => $stat->criticals, 'Урон' => $stat->min_physical_damage . ' - ' . $stat->max_physical_damage, 'Локация' => Rooms::$roomNames[$this->room], ]; $str = null; $i = 0; foreach ($arr as $item => $value) { $str .= "
$item
$value
"; if (in_array($i, [6, 9])) { $str .= "
"; } $i++; } return sprintf( "
%s
%s
", Nick::id($this->id)->full(1), $str ); } private function showProgressBar(int $value, int $max_value) { $values = [ '%20%' => (int)round(self::PERCENT_20 * $max_value), '%80%' => (int)round(self::PERCENT_80 * $max_value), '%value' => $value, '%max' => $max_value ]; $string = '%value / %max'; return str_replace(array_keys($values), array_values($values), $string); } /** Для вызова из main.php * @throws GameException */ private function UserInfoStats(): string { $captions = 'Уровень:
Здоровье:
Пыль:
Сила:
Ловкость:
Интуиция:
Выносливость:
Интеллект:
Мудрость:
Опыт:
Очки характеристик:
Деньги:
Деньги в банке: '; $variables = $this->level . '
' . $this->showProgressBar($this->health, $this->maxHealth) . '
' . $this->showProgressBar($this->mana, $this->maxMana) . '
' . parent::getStat('strength', 1) . '
' . parent::getStat('dexterity', 1) . '
' . parent::getStat('intuition', 1) . '
' . parent::getStat('endurance', 1) . '
' . parent::getStat('intelligence', 1) . '
' . parent::getStat('wisdom', 1) . '
' . $this->experience . '
' . $this->free_stat_points . '
' . User::getInstance()->money()->get() . '
' . User::getInstance()->money()->getBank(); $nameString = Nick::id($this->id)->full(); return <<
$nameString
$captions
$variables
HTML; } public function userInfoStatsTest(): array { $stat = $this->getFullStats(); return [ 'Сила' => $this->strength, 'Ловкость' => $this->dexterity, 'Интуиция' => $this->intuition, 'Выносливость' => $this->endurance, 'Интеллект' => $this->intelligence, 'Мудрость' => $this->wisdom, '
HP' => $this->health . ' / ' . $this->maxHealth, 'MP' => $this->mana . ' / ' . $this->maxMana, 'Уворот' => $stat->evasion, 'Точность' => $stat->accuracy, 'Шанс крита' => $stat->criticals, 'Урон' => $stat->min_physical_damage . ' - ' . $stat->max_physical_damage, '
Уровень' => $this->level, 'Опыт' => $this->experience, 'Деньги' => $this->money()->get(), '
Локация' => Rooms::$roomNames[$this->room], ]; } /** Для вызова из inf.php * @throws GameException */ public function showUserInfo() { $str = null; $hidden = UserEffect::hasHiddenProfile($this->id); if ($this->block && !User::getInstance()->getAdmin()) { $str .= "Персонаж $this->login заблокирован!"; } elseif (!empty($hidden) && !User::getInstance()->getAdmin()) { $str .= "Персонаж $this->login обезличен $hidden."; } else { $str .= '
'; $str .= $this->UserInfoDoll(); $str .= $this->ttz(); $str .= '
' . $this->showProgressBar($this->health, $this->maxHealth) . '
' . $this->showProgressBar($this->mana, $this->maxMana) . '
'; $str .= '
'; $str .= '
'; $str .= '
'; $str .= '

Об игроке

'; $str .= $this->profile()->getRealname() ? "Имя: {$this->profile()->getRealname()}" : ''; $str .= $this->profile()->getInfo() ? '
' . nl2br($this->profile()->getInfo()) : ''; $str .= '
'; if (User::getInstance()->getAdmin()) { $str .= UserPrivateInfo::get(User::getInstance()); } } echo $str; } public function showUserDoll($isBattle = 0, $isMain = 0): string { try { return '
' . $this->UserInfoDoll($isBattle, $isMain) . '
'; } catch (GameException $e) { return $e; } } /** Отображение на main.php */ public function showUserInfoMain(): string { try { return '
' . $this->UserInfoDoll() . '
' . $this->userInfoStats(); } catch (GameException $e) { return $e; } } public function showUserEffects(): string { $effs = Effects::getAll($this->id); $img = UserEffect::$effectImage; $r = ''; foreach ($effs as $effect) { $timeleft = timeOut($effect->remaining_time - time()); $r .= "
$effect->name $effect->name
$timeleft
"; } return $r; } }