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 .= '
'; $str .= '' . $this->login;
        if ($isBattle) {
            $str .= ''; $str .= '' . $stats->getLogin() . ''; $str .= self::LEVEL . ': ' . $stats->getLevel(); $str .= '
' . self::STRENGTH . ': ' . $stats->getStat('strength'); $str .= '
' . self::DEXTERITY . ': ' . $stats->getStat('dexterity'); $str .= '
' . self::INTUITION . ': ' . $stats->getStat('intuition'); $str .= '
' . self::ENDURANCE . ': ' . $stats->getStat('endurance'); $str .= '
' . self::INTELLIGENCE . ': ' . $stats->getStat('intelligence'); $str .= '
' . self::WISDOM . ': ' . $stats->getStat('wisdom'); $str .= '
'; } else { $str .= '">'; } $str .= '
'; return $str; } /** Вызов из inf.php */ private function ttz(): string { $stat = $this->getFullStats(); $arr = [ self::LEVEL => $this->level, self::STRENGTH => $this->strength, self::DEXTERITY => $this->dexterity, self::INTUITION => $this->intuition, self::ENDURANCE => $this->endurance, self::INTELLIGENCE => $this->intelligence, self::WISDOM => $this->wisdom, self::EVASION => $stat->evasion, self::ACCURACY => $stat->accuracy, self::CRITICALS => $stat->criticals, self::DAMAGE => $stat->min_physical_damage . ' - ' . $stat->max_physical_damage, self::LOCATION => 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 $maxValue) { $values = [ '%20%' => (int)round(self::PERCENT_20 * $maxValue), '%80%' => (int)round(self::PERCENT_80 * $maxValue), '%value' => $value, '%max' => $maxValue ]; $string = '%value / %max'; return str_replace(array_keys($values), array_values($values), $string); } /** Для вызова из main.php * @throws GameException */ private function userInfoStats(): string { $data = [ self::LEVEL => $this->level, self::HEALTH => $this->showProgressBar($this->health, $this->maxHealth), self::MANA => $this->showProgressBar($this->mana, $this->maxMana), self::STRENGTH => parent::getStat('strength', 1), self::DEXTERITY => parent::getStat('dexterity', 1), self::INTUITION => parent::getStat('intuition', 1), self::ENDURANCE => parent::getStat('endurance', 1), self::INTELLIGENCE => parent::getStat('intelligence', 1), self::WISDOM => parent::getStat('wisdom', 1), self::EXPERIENCE => $this->experience, self::FREE_STAT_POINTS => $this->freeStatPoints, self::MONEY => User::getInstance()->money()->get(), self::MONEY_IN_BANK => User::getInstance()->money()->getBank(), ]; $str = '
'; $str .= '
' . Nick::id($this->id)->full() . '
'; $str .= '
'; foreach ($data as $caption => $variable) { $str .= '
' . $caption . '
'; $str .= '
' . $variable . '
'; } $str .= '
'; $str .= '
'; return $str; } public function userInfoStatsTest(): array { $stat = $this->getFullStats(); return [ self::STRENGTH => $this->strength, self::DEXTERITY => $this->dexterity, self::INTUITION => $this->intuition, self::ENDURANCE => $this->endurance, self::INTELLIGENCE => $this->intelligence, self::WISDOM => $this->wisdom, '
' . self::HEALTH => $this->health . ' / ' . $this->maxHealth, self::MANA => $this->mana . ' / ' . $this->maxMana, self::EVASION => $stat->evasion, self::ACCURACY => $stat->accuracy, self::CRITICALS => $stat->criticals, self::DAMAGE => $stat->min_physical_damage . ' - ' . $stat->max_physical_damage, '
' . self::LEVEL => $this->level, self::EXPERIENCE => $this->experience, self::MONEY => $this->money()->get(), '
' . self::LOCATION => 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; } }