2020-07-03 13:23:08 +00:00
< ? php
class User
{
2020-07-22 09:29:31 +00:00
public $id = 0 ;
2020-07-21 08:36:21 +00:00
public $login = '<em>Некто</em>' ;
2020-08-30 00:59:29 +00:00
public $pass ;
2020-07-21 08:36:21 +00:00
public $email = '<em>неизвестно</em>' ;
2020-07-03 13:23:08 +00:00
public $realname ;
public $borndate ;
public $info ;
2020-07-21 08:36:21 +00:00
public $level = 0 ;
public $align = 0 ;
public $clan = 0 ;
public $money = 0 ;
public $strength = 0 ;
public $dexterity = 0 ;
public $intuition = 0 ;
public $endurance = 0 ;
public $intelligence = 0 ;
public $wisdom = 0 ;
2020-08-29 18:14:33 +00:00
public $health ;
public $mana ;
2020-07-03 13:23:08 +00:00
public $ip ;
public $session_id ;
2020-07-21 08:36:21 +00:00
public $admin = 0 ;
2020-07-03 13:23:08 +00:00
public $enter_game ;
public $room ;
public $block ;
2020-07-06 10:41:20 +00:00
public $shadow ;
2020-07-20 13:27:32 +00:00
// Удар кулаком всегда 1-2.
public $minDamage = 1 ;
public $maxDamage = 2 ;
2020-07-20 13:44:31 +00:00
//Броня без предметов не существует.
public $headArmor = 0 ;
public $chestArmor = 0 ;
public $legArmor = 0 ;
2020-07-22 14:04:15 +00:00
public $free_stat_points = 0 ;
2020-07-20 09:32:51 +00:00
public const STAT_MAXIMUM_AMOUNT = 40 ;
2020-07-21 08:36:21 +00:00
private const ERROR_STAT_IS_MAXIMUM = 'Ошибка: Параметр достиг своего лимита!' ;
private const ERROR_STAT_UNKNOWN = 'Ошибка: Неизвестный параметр!' ;
2020-07-03 13:49:39 +00:00
// Пока несуществующие, для совместимости.
2020-07-10 08:08:00 +00:00
public $married = 'Someone или нет.' ;
public $experience = 200 ;
2020-08-29 23:21:22 +00:00
public $battle = 0 ;
public $in_tower = 0 ; // Скорее башню похороним чем запустим...
public $zayavka = 0 ;
2020-07-10 08:08:00 +00:00
// Динамически рассчитываемые
2020-08-29 18:14:33 +00:00
public $maxHealth = 5 ;
public $maxMana = 5 ;
2020-07-05 18:38:13 +00:00
//Статусы того, кто смотрит на информацию.
2020-07-06 05:56:25 +00:00
public $watcher_id ;
2020-07-05 18:38:13 +00:00
protected $watcherIsAdmin ;
protected $watcherIsModerator ;
2020-07-04 23:25:14 +00:00
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-08-29 18:14:33 +00:00
$this -> maxHealth = round (( $this -> endurance * 3 ) + ( $this -> endurance / 2 ) * ( $this -> level - 1 ) + ( $this -> endurance / 5 ) * (( $this -> level - 1 ) * ( $this -> level - 2 ) / 2 ));
2020-08-29 18:25:22 +00:00
$this -> maxMana = round (( $this -> wisdom * 3 ) + ( $this -> wisdom / 2 ) * ( $this -> level - 1 ) + ( $this -> wisdom / 5 ) * (( $this -> level - 1 ) * ( $this -> level - 2 ) / 2 ));
2020-07-03 13:23:08 +00:00
}
2020-07-03 16:37:24 +00:00
2020-07-06 15:21:52 +00:00
/**
* Отображает куклу персонажа ( образ и слоты ) .
2020-07-10 08:08:00 +00:00
*
* @ param int $isBattle - установить 1 , если куклу нужно отобразить в поединке ( показывает параметры при наведении
* на образ ) .
* @ param int $isMain - установить 1 , если куклу надо показать на странице игрока ( по клику на предмет снимает
* е г о ) .
2020-07-06 15:21:52 +00:00
*
* @ throws \Krugozor\Database\Mysql\Exception
*/
private function UserInfoDoll ( $isBattle = 0 , $isMain = 0 )
2020-07-04 20:00:47 +00:00
{
2020-07-06 10:41:20 +00:00
//https://jsfiddle.net/ngx0yvhc
2020-07-21 15:57:15 +00:00
//TODO переверстать grid, чтобы он касался только куклы.
2020-07-20 12:07:49 +00:00
$di = new DressedItems ( $this -> id );
2020-07-20 14:31:25 +00:00
$dressedItems = $di -> getItemsInSlots ();
2020-07-06 20:17:49 +00:00
for ( $i = 1 ; $i <= 12 ; $i ++ ) {
echo sprintf ( '<div class="slot-%s">' , $i );
2020-07-21 12:14:25 +00:00
if ( ! empty ( $dressedItems [ $i ])) {
2020-07-06 20:17:49 +00:00
if ( ! $isBattle && $isMain ) {
$itemString = '<a href="?edit=1&drop=%s"><img src="/i/sh/%s" class="item-wrap-normal" alt="%s" title="%s"></a>' ;
2020-07-07 13:01:46 +00:00
echo sprintf ( $itemString , $i , $dressedItems [ $i ][ 'image' ], $dressedItems [ $i ][ 'name' ], $dressedItems [ $i ][ 'name' ]);
2020-07-06 20:17:49 +00:00
} else {
$itemString = '<img src="/i/sh/%s" class="item-wrap-normal tip" alt="%s"><span class="tiptext"><strong>%s</strong></span>' ;
2020-07-07 13:01:46 +00:00
echo sprintf ( $itemString , $dressedItems [ $i ][ 'image' ], $dressedItems [ $i ][ 'name' ], $dressedItems [ $i ][ 'name' ]);
2020-07-06 20:17:49 +00:00
}
} else {
echo sprintf ( '<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [%s]" alt="Пустой слот [%s]">' , $i , $i );
}
echo sprintf ( '</div><!-- slot-%s -->' , $i );
}
2020-07-06 09:09:47 +00:00
echo '<div class="slot-image">' ;
2020-07-06 10:41:20 +00:00
if ( $isBattle ) {
$sh = '<img src="/i/shadow/%s" alt="%s" class="tip"><span class="tiptext"><b>%s</b>Уровень: %s<br>Сила: %s<br>Ловкость: %s<br>Интуиция: %s<br>Выносливость: %s<br>Интеллект: %s<br>Мудрость: %s</span>' ;
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 '<img src="/i/shadow/' . $this -> shadow . '" alt="' . $this -> login . '">' ;
}
2020-07-06 09:09:47 +00:00
echo '</div><!-- slot-image -->' ;
}
2020-07-06 13:22:33 +00:00
private function UserInfoStats ( $isMainWindow = 0 )
2020-07-05 15:09:55 +00:00
{
2020-07-06 10:41:20 +00:00
$captions = 'Уровень:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Местонахождение:' ;
2020-07-06 13:22:33 +00:00
$variables = $this -> level . '<br>' . $this -> getStrength () . '<br>' . $this -> getDexterity () . '<br>' . $this -> getIntuition () . '<br>' . $this -> getEndurance () . '<br>' . $this -> getIntelligence () . '<br>' . $this -> getWisdom () . '<br>' . $this -> getRoomName ( $this -> room );
if ( $isMainWindow ) {
$this -> Bank = new Bank ( $this -> id );
2020-07-10 08:08:00 +00:00
$captions = 'Уровень:<br>Здоровье:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Опыт:<br>Очки характеристик:<br>Деньги:<br>Деньги в банке:' ;
2020-07-22 14:04:15 +00:00
$variables = $this -> level . '<br>' . $this -> health . '<br>' . $this -> getStrength ( 1 ) . '<br>' . $this -> getDexterity ( 1 ) . '<br>' . $this -> getIntuition ( 1 ) . '<br>' . $this -> getEndurance ( 1 ) . '<br>' . $this -> getIntelligence ( 1 ) . '<br>' . $this -> getWisdom ( 1 ) . '<br>' . $this -> experience . '<br>' . $this -> free_stat_points . '<br>' . $this -> money . '<br>' . $this -> Bank -> money ;
2020-07-06 13:22:33 +00:00
}
2020-07-06 12:26:50 +00:00
if ( $this -> align ) {
$nameString = sprintf ( '<img src="/i/align_%s.png" >' , $this -> align );
}
if ( $this -> block ) {
2020-07-06 13:29:49 +00:00
$nameString .= '<span class="private"><s>' . $this -> login . '</s></span>' ;
2020-07-06 12:26:50 +00:00
} else {
2020-07-06 13:29:49 +00:00
$nameString .= ' <b>' . $this -> login . '</b> ' ;
2020-07-06 12:26:50 +00:00
}
if ( $this -> clan ) {
2020-08-27 12:38:06 +00:00
$nameString .= sprintf ( '<img src="/i/clan/%s.png" >' , $this -> clan );
2020-07-06 12:26:50 +00:00
}
2020-07-05 15:09:55 +00:00
echo '<div class="user-info">' ;
2020-07-06 12:26:50 +00:00
echo '<div class="info">' ;
2020-07-06 13:29:49 +00:00
echo '<b>' . $nameString . '</b>' ;
2020-07-06 12:26:50 +00:00
echo '</div><!-- info -->' ;
2020-07-05 15:45:59 +00:00
echo '<div class="stats-container">' ;
echo '<div class="column">' ;
2020-07-06 10:41:20 +00:00
echo $captions ;
2020-07-05 16:43:15 +00:00
echo '</div><!-- column -->' ;
2020-07-05 15:45:59 +00:00
echo '<div class="column">' ;
2020-07-06 10:41:20 +00:00
echo $variables ;
2020-07-05 16:43:15 +00:00
echo '</div><!-- column -->' ;
echo '</div><!-- stats-container -->' ;
2020-07-21 08:36:21 +00:00
echo '<div class="debug">TODO: Сделать рассчёт модификаторов. Вывести полоску здоровья когда будет от чего отталкиваться.</div>' ;
2020-07-06 10:41:20 +00:00
echo '</div><!-- user-info -->' ;
}
2020-07-20 09:32:51 +00:00
public function getStrength ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> strength < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-20 09:32:51 +00:00
//main.php?edit=1&ups=sila
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> strength );
}
return $this -> strength ;
}
2020-07-06 13:29:49 +00:00
2020-07-20 09:32:51 +00:00
public function getDexterity ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> dexterity < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-20 09:32:51 +00:00
//main.php?edit=1&ups=lovk
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> dexterity );
}
2020-07-20 09:32:51 +00:00
return $this -> dexterity ;
2020-07-06 13:22:33 +00:00
}
2020-07-06 13:29:49 +00:00
2020-07-20 09:32:51 +00:00
public function getIntuition ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> intuition < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-20 09:32:51 +00:00
//main.php?edit=1&ups=inta...
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> intuition );
}
2020-07-20 09:32:51 +00:00
return $this -> intuition ;
2020-07-06 13:22:33 +00:00
}
2020-07-06 13:29:49 +00:00
2020-07-20 09:32:51 +00:00
public function getEndurance ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> endurance < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> endurance );
}
2020-07-20 09:32:51 +00:00
return $this -> endurance ;
2020-07-06 13:22:33 +00:00
}
2020-07-06 13:29:49 +00:00
2020-07-20 09:32:51 +00:00
public function getIntelligence ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> intelligence < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> intelligence );
}
2020-07-20 09:32:51 +00:00
return $this -> intelligence ;
2020-07-06 13:22:33 +00:00
}
2020-07-06 13:29:49 +00:00
2020-07-20 09:32:51 +00:00
public function getWisdom ( $isMainWindow = 0 )
2020-07-06 13:29:49 +00:00
{
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points && $isMainWindow && $this -> wisdom < self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-06 13:22:33 +00:00
return sprintf ( '%s <a href="#">[+]</a>' , $this -> wisdom );
}
2020-07-20 09:32:51 +00:00
return $this -> wisdom ;
2020-07-06 13:22:33 +00:00
}
2020-07-21 08:36:21 +00:00
public function setStrength ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> strength <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET strength = strength + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function setDexterity ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> dexterity <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET dexterity = dexterity + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function setIntuition ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> intuition <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET intuition = intuition + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function setEndurance ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> endurance <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET endurance = endurance + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function setIntelligence ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> intelligence <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET intelligence = intelligence + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function setWisdom ()
{
2020-07-22 14:04:15 +00:00
if ( $this -> wisdom <= self :: STAT_MAXIMUM_AMOUNT && $this -> free_stat_points > 0 ) {
2020-07-21 08:36:21 +00:00
db :: c () -> query ( 'UPDATE users SET wisdom = wisdom + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
}
public function addOnePointToStat ( $stat_name )
{
$allowed = [ 'strength' , 'dexterity' , 'intuition' , 'endurance' , 'intelligence' , 'wisdom' ];
if ( in_array ( $stat_name , $allowed )) {
2020-07-22 14:04:15 +00:00
if ( $this -> free_stat_points > 0 && $this -> $stat_name <= self :: STAT_MAXIMUM_AMOUNT ) {
2020-07-21 08:36:21 +00:00
$query = 'UPDATE users SET ?f = ?f + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i' ;
db :: c () -> query ( $query , $stat_name , $stat_name , $this -> id );
} else {
throw new Exception ( self :: ERROR_STAT_IS_MAXIMUM );
}
} else {
throw new Exception ( self :: ERROR_STAT_UNKNOWN );
}
}
2020-07-06 10:41:20 +00:00
private function UserInfo ()
{
echo '<div class="user-info-container">' ;
$this -> UserInfoDoll ();
$this -> UserInfoStats ();
echo '<div class="slot-lower">' ;
2020-07-05 16:12:53 +00:00
if ( $this -> married ) {
echo sprintf ( '<a href = "inf.php?%s" target = _blank ><img alt = "В браке с %s" src = "i/married.gif" title = "В браке с %s"></a >' , $this -> married , $this -> married , $this -> married );
}
2020-07-06 10:41:20 +00:00
echo '</div><!-- slot-lower -->' ;
echo '<div class="user-signs">' ;
echo sprintf ( '<img src="i/zodiac/%s.png" alt="Родовой знак">' , $this -> showStarSign ());
echo '</div><!-- user-signs -->' ;
2020-07-05 16:43:15 +00:00
echo '</div><!-- user-info-container -->' ;
echo '<hr><!-- Нижняя часть -->' ;
echo '<div class="user-info-container-lower">' ;
echo '<h2>О б игроке</h2>' ;
if ( $this -> realname ) {
echo sprintf ( 'Имя: %s<br>' , $this -> realname );
}
if ( $this -> info ) {
echo nl2br ( $this -> info );
}
echo '</div><!-- user-info-container-lower -->' ;
2020-07-05 17:59:52 +00:00
2020-07-05 18:38:13 +00:00
if ( $this -> watcherIsAdmin || $this -> watcherIsModerator ) {
2020-07-05 21:35:25 +00:00
echo '<div class="secret-info">' ;
2020-07-06 10:41:20 +00:00
$infoString = 'E-Mail: %s<br> ДР Игрока: %s<br> IP Регистрации: %s' ;
2020-07-06 05:56:25 +00:00
echo sprintf ( $infoString , $this -> email , date ( 'd.m.Y' , strtotime ( $this -> borndate )), $this -> ip );
2020-07-05 18:38:13 +00:00
if ( $this -> watcherIsAdmin ) {
$this -> Bank = new Bank ( $this -> id );
2020-07-06 05:56:25 +00:00
$infoString = '<br><span>ИД Игрока: %s<br> ИД Комнаты: %s<br> Деньги: %s<br> Деньги в банке: %s<br> Опыт: %s<br> Нераспределённые очки: %s<br> Текущая сессия: %s</span>' ;
2020-07-22 14:04:15 +00:00
echo sprintf ( $infoString , $this -> id , $this -> room , $this -> money , $this -> Bank -> money , $this -> experience , $this -> free_stat_points , $this -> session_id );
2020-07-05 21:16:22 +00:00
}
$this -> UserLogs = new UserLogModel ( $this -> id );
2020-07-06 10:41:20 +00:00
echo '<div class="secret-info-user-log"><b>Личное дело</b><br>' ;
2020-07-05 21:16:22 +00:00
while ( $userLogRow = $this -> UserLogs -> getUserLog () -> fetch_object ()) {
echo sprintf ( '<code>%s</code><br>' , date ( " d.m.Y H:i " , strtotime ( $userLogRow -> date )) . $userLogRow -> text );
2020-07-05 18:38:13 +00:00
}
2020-07-05 21:35:25 +00:00
echo '</div><!-- secret-info-user-log -->' ;
echo '</div><!-- secret-info -->' ;
2020-07-05 18:38:13 +00:00
}
2020-07-04 10:49:43 +00:00
}
2020-07-06 10:41:20 +00:00
private function WatcherStatus ()
{
2020-07-06 05:56:25 +00:00
$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 ( '<span class="error">Персонаж ' . $this -> login . ' заблокирован!</span>' );
} 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 ( '<span class="error">Персонаж ' . $this -> login . ' обезличен ' . $date . '.</span>' );
} else {
2020-07-06 10:41:20 +00:00
$this -> UserInfo ();
2020-07-06 05:56:25 +00:00
}
}
2020-07-06 15:21:52 +00:00
public function showUserDoll ( $isBattle = 0 , $isMain = 0 )
2020-07-06 10:41:20 +00:00
{
echo '<div class="user-info-container">' ;
2020-07-06 15:21:52 +00:00
$this -> UserInfoDoll ( $isBattle , $isMain );
2020-07-06 13:22:33 +00:00
echo '</div><!-- user-info-container -->' ;
}
2020-07-06 13:29:49 +00:00
public function showUserInfoMain ()
{
2020-07-06 13:22:33 +00:00
echo '<div class="user-info-container">' ;
$this -> UserInfoDoll ();
$this -> userInfoStats ( 1 );
2020-07-06 10:41:20 +00:00
echo '</div><!-- user-info-container -->' ;
}
2020-07-06 05:56:25 +00:00
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
*/
2020-07-05 17:29:30 +00:00
$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 )); //Высокосный?
2020-07-06 05:56:25 +00:00
if ( $isLeapYear && $dayOfYear > 59 ) {
2020-07-05 17:29:30 +00:00
-- $dayOfYear ;
}
foreach ( $zodiac as $day => $sign ) {
if ( $dayOfYear > $day ) {
break ;
}
}
return $sign ? ? null ;
}
2020-07-10 08:08:00 +00:00
2020-08-29 18:18:18 +00:00
public function getHealth () : string
2020-07-10 08:08:00 +00:00
{
2020-08-29 18:14:33 +00:00
return $this -> health . '/' . $this -> maxHealth ;
}
2020-08-29 18:18:18 +00:00
public function getMana () : string
2020-08-29 18:14:33 +00:00
{
return $this -> mana . '/' . $this -> maxMana ;
2020-07-10 08:08:00 +00:00
}
2020-07-21 11:52:39 +00:00
public function setRoom ()
{
}
2020-07-03 13:23:08 +00:00
}