From 0a07d53be75d571d5d55978226b527af97b60e9a Mon Sep 17 00:00:00 2001 From: lopar Date: Wed, 10 Mar 2021 23:38:14 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=81=20UserStats=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=BE=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=BE=D0=BD=D0=B0=D0=B6=D0=B0.=20=D0=9F?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20=D0=BD=D0=B5=D0=BA=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=20=D0=B2=20=D0=B3=D0=B5=D1=82=D1=82=D0=B5?= =?UTF-8?q?=D1=80=D1=8B.=20=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=D1=8B=D1=85=20=D1=81=D0=B5=D1=82=D1=82=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/Battles/User.php | 343 +++------------------------------- classes/Battles/UserInfo.php | 2 +- classes/Battles/UserStats.php | 221 ++++++++++++++++++++++ inf.php | 19 +- main.php | 91 +++------ user_anketa.php | 14 +- 6 files changed, 285 insertions(+), 405 deletions(-) create mode 100644 classes/Battles/UserStats.php diff --git a/classes/Battles/User.php b/classes/Battles/User.php index bb5a208..9f7f34c 100644 --- a/classes/Battles/User.php +++ b/classes/Battles/User.php @@ -14,45 +14,23 @@ class User protected $realname; protected $borndate; protected $info; - protected $level = 0; - protected $align = 0; + protected $level; + protected $align; protected $clan; - protected $money = 0; - protected $strength = 0; - protected $dexterity = 0; - protected $intuition = 0; - protected $endurance = 0; - protected $intelligence = 0; - protected $wisdom = 0; - protected $health; - protected $mana; - protected $ip; - protected $session_id; + protected $money; + protected $ip = 0; + protected $admin = 0; protected $enter_game; protected $room; protected $block; protected $shadow; - // Удар кулаком всегда 1-2. - protected $minDamage = 1; - protected $maxDamage = 2; - //Броня без предметов не существует. - protected $headArmor = 0; - protected $chestArmor = 0; - protected $legArmor = 0; - protected $free_stat_points = 0; - private const STAT_MAXIMUM_AMOUNT = 40; - private const ERROR_STAT_IS_MAXIMUM = 'Ошибка: Параметр достиг своего лимита!'; - private const ERROR_STAT_UNKNOWN = 'Ошибка: Неизвестный параметр!'; + // Пока несуществующие, для совместимости. - protected $married = 'Someone или нет.'; protected $experience = 200; protected $battle = 0; protected $in_tower = 0; // Скорее башню похороним чем запустим... protected $zayavka = 0; - // Динамически рассчитываемые - protected $maxHealth = 5; - protected $maxMana = 5; protected static $db; public const INFO_CHAR_LIMIT = 1500; @@ -66,51 +44,8 @@ class User $this->$key = $user_query[$key]; } } - $this->maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2)); - $this->maxMana = round(($this->wisdom * 3) + ($this->wisdom / 2) * ($this->level - 1) + ($this->wisdom / 5) * (($this->level - 1) * ($this->level - 2) / 2)); } - /** - * Отдаёт информацию о базовом(!) стате. - * @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'. - * @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку на повышение стата на 1, при условии наличия свободных очков статов. - * @return string - * @throws GameException - */ - public function getStat($stat_name, $isMainWindow = 0):string - { - $allowed = ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom']; - if (in_array($stat_name, $allowed)) { - if ($this->free_stat_points && $isMainWindow && $this->$stat_name < self::STAT_MAXIMUM_AMOUNT) { - return sprintf('%s [+]', $this->$stat_name, mt_rand(), $stat_name); - } else { - return $this->$stat_name; - } - } else { - throw new GameException(self::ERROR_STAT_UNKNOWN); - } - } - - /** - * Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков статов. - * @param string $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'. - * @throws GameException - */ - public function addOnePointToStat(string $stat_name) - { - $allowed = ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom']; - if (in_array($stat_name, $allowed)) { - if ($this->free_stat_points > 0 && $this->$stat_name <= self::STAT_MAXIMUM_AMOUNT) { - $query = "UPDATE users SET {$stat_name} = {$stat_name} + 1, free_stat_points = free_stat_points - 1 WHERE id = ?"; - self::$db->execute($query,$this->id); - } else { - throw new GameException(self::ERROR_STAT_IS_MAXIMUM); - } - } else { - throw new GameException(self::ERROR_STAT_UNKNOWN); - } - - } protected function showStarSign(): ?string { @@ -156,22 +91,13 @@ class User return $sign ?? null; } - public function getHealth(): string + + public static function setUserEffect(int $userId, int $type, string $name, int $time): bool { - return $this->health . '/' . $this->maxHealth; + return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time) VALUES (?,?,?,?)', [$userId, $type, $name, $time]); } - public function getMana(): string - { - return $this->mana . '/' . $this->maxMana; - } - - public static function setUserEffect(int $userId, int $type, string $name, int $time):bool - { - return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time) VALUES (?,?,?,?)',[$userId, $type, $name, $time]); - } - - public static function removeUserEffect(int $userId, int $type):bool + public static function removeUserEffect(int $userId, int $type): bool { if (self::$db->fetch('SELECT 1 FROM users_effects WHERE owner_id = ? AND type = ?', [$userId, $type])) { self::$db->execute('DELETE FROM users_effects WHERE owner_id = ? AND type = ?', [$userId, $type]); @@ -187,14 +113,6 @@ class User return $this->id; } - /** - * @param int $id - */ - public function setId(int $id): void - { - $this->id = $id; - } - /** * @return string */ @@ -227,6 +145,11 @@ class User $this->pass = $pass; } + public function savePass() + { + self::$db->execute('UPDATE users SET pass = ? WHERE id = ?', [$this->pass, $this->id]); + } + /** * @return string */ @@ -355,101 +278,6 @@ class User $this->money = $money; } - /** - * @return int - */ - public function getStrength(): int - { - return $this->strength; - } - - /** - * @param int $strength - */ - public function setStrength(int $strength): void - { - $this->strength = $strength; - } - - /** - * @return int - */ - public function getDexterity(): int - { - return $this->dexterity; - } - - /** - * @param int $dexterity - */ - public function setDexterity(int $dexterity): void - { - $this->dexterity = $dexterity; - } - - /** - * @return int - */ - public function getIntuition(): int - { - return $this->intuition; - } - - /** - * @param int $intuition - */ - public function setIntuition(int $intuition): void - { - $this->intuition = $intuition; - } - - /** - * @return int - */ - public function getEndurance(): int - { - return $this->endurance; - } - - /** - * @param int $endurance - */ - public function setEndurance(int $endurance): void - { - $this->endurance = $endurance; - } - - /** - * @return int - */ - public function getIntelligence(): int - { - return $this->intelligence; - } - - /** - * @param int $intelligence - */ - public function setIntelligence(int $intelligence): void - { - $this->intelligence = $intelligence; - } - - /** - * @return int - */ - public function getWisdom(): int - { - return $this->wisdom; - } - - /** - * @param int $wisdom - */ - public function setWisdom(int $wisdom): void - { - $this->wisdom = $wisdom; - } /** * @return mixed @@ -467,21 +295,6 @@ class User $this->ip = $ip; } - /** - * @return mixed - */ - public function getSessionId() - { - return $this->session_id; - } - - /** - * @param mixed $session_id - */ - public function setSessionId($session_id): void - { - $this->session_id = $session_id; - } /** * @return int @@ -491,14 +304,6 @@ class User return $this->admin; } - /** - * @param int $admin - */ - public function setAdmin(int $admin): void - { - $this->admin = $admin; - } - /** * @return mixed */ @@ -560,103 +365,18 @@ class User */ public function setShadow($shadow): void { - $this->shadow = $shadow; + $shadows = [ + 'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10', + 'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10', + ]; + if (in_array($shadow, $shadows) && $this->getShadow() == '0.png') { + $this->shadow = $shadow . '.png'; + } } - /** - * @return int - */ - public function getMinDamage(): int + public function saveShadow() { - return $this->minDamage; - } - - /** - * @return int - */ - public function getMaxDamage(): int - { - return $this->maxDamage; - } - - /** - * @return int - */ - public function getHeadArmor(): int - { - return $this->headArmor; - } - - /** - * @param int $headArmor - */ - public function setHeadArmor(int $headArmor): void - { - $this->headArmor = $headArmor; - } - - /** - * @return int - */ - public function getChestArmor(): int - { - return $this->chestArmor; - } - - /** - * @param int $chestArmor - */ - public function setChestArmor(int $chestArmor): void - { - $this->chestArmor = $chestArmor; - } - - /** - * @return int - */ - public function getLegArmor(): int - { - return $this->legArmor; - } - - /** - * @param int $legArmor - */ - public function setLegArmor(int $legArmor): void - { - $this->legArmor = $legArmor; - } - - /** - * @return int - */ - public function getFreeStatPoints(): int - { - return $this->free_stat_points; - } - - /** - * @param int $free_stat_points - */ - public function setFreeStatPoints(int $free_stat_points): void - { - $this->free_stat_points = $free_stat_points; - } - - /** - * @return string - */ - public function getMarried(): string - { - return $this->married; - } - - /** - * @param string $married - */ - public function setMarried(string $married): void - { - $this->married = $married; + self::$db->execute('UPDATE users SET shadow = ? WHERE id = ?', [$this->getShadow(), $this->getId()]); } /** @@ -723,20 +443,9 @@ class User $this->zayavka = $zayavka; } - /** - * @return float|int - */ - public function getMaxHealth() + public function saveAnketa() { - return $this->maxHealth; - } - - /** - * @return float|int - */ - public function getMaxMana() - { - return $this->maxMana; + self::$db->execute('UPDATE users SET realname = ?, info = ? WHERE id = ?', [$this->realname, $this->info, $this->id]); } } \ No newline at end of file diff --git a/classes/Battles/UserInfo.php b/classes/Battles/UserInfo.php index 4892f7e..53229a9 100644 --- a/classes/Battles/UserInfo.php +++ b/classes/Battles/UserInfo.php @@ -3,7 +3,7 @@ namespace Battles; use Battles\Models\EffectsModel; use Exceptions\GameException; -class UserInfo extends User +class UserInfo extends UserStats { use Rooms; //Статусы того, кто смотрит на информацию. diff --git a/classes/Battles/UserStats.php b/classes/Battles/UserStats.php new file mode 100644 index 0000000..3c1079c --- /dev/null +++ b/classes/Battles/UserStats.php @@ -0,0 +1,221 @@ +maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2)); + $this->maxMana = round(($this->wisdom * 3) + ($this->wisdom / 2) * ($this->level - 1) + ($this->wisdom / 5) * (($this->level - 1) * ($this->level - 2) / 2)); + } + + /** + * Отдаёт информацию о базовом(!) стате. + * + * @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', + * 'endurance', 'intelligence', 'wisdom'. + * @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку + * на повышение стата на 1, при условии наличия свободных очков статов. + * + * @return string + */ + public function getStat($stat_name, $isMainWindow = 0): string + { + if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) { + return self::ERROR_STAT_UNKNOWN; + } + if ($this->free_stat_points && $isMainWindow && $this->$stat_name < self::STAT_MAXIMUM_AMOUNT) { + $this->$stat_name .= " [+]"; + } + return $this->$stat_name; + + } + + /** + * Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков + * статов. + * + * @param string $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', + * 'endurance', 'intelligence', 'wisdom'. + * + * @throws GameException + */ + public function addOnePointToStat(string $stat_name) + { + if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) { + throw new GameException(self::ERROR_STAT_UNKNOWN); + } + if ($this->free_stat_points <= 0 || $this->$stat_name >= self::STAT_MAXIMUM_AMOUNT) { + throw new GameException(self::ERROR_STAT_IS_MAXIMUM); + } else { + $query = "UPDATE users SET {$stat_name} = {$stat_name} + 1, free_stat_points = free_stat_points - 1 WHERE id = ?"; + self::$db->execute($query, $this->id); + } + } + + /** + * @return mixed + */ + public function getStrength() + { + return $this->strength; + } + + /** + * @return mixed + */ + public function getDexterity() + { + return $this->dexterity; + } + + /** + * @return mixed + */ + public function getIntuition() + { + return $this->intuition; + } + + /** + * @return mixed + */ + public function getEndurance() + { + return $this->endurance; + } + + /** + * @return mixed + */ + public function getIntelligence() + { + return $this->intelligence; + } + + /** + * @return mixed + */ + public function getWisdom() + { + return $this->wisdom; + } + + /** + * @return mixed + */ + public function getHealth() + { + return $this->health; + } + + /** + * @return mixed + */ + public function getMana() + { + return $this->mana; + } + + /** + * @return mixed + */ + public function getFreeStatPoints() + { + return $this->free_stat_points; + } + + /** + * @return float + */ + public function getMaxHealth(): float + { + return $this->maxHealth; + } + + /** + * @return float + */ + public function getMaxMana(): float + { + return $this->maxMana; + } + + /** + * @return int + */ + public function getMinDamage(): int + { + return $this->minDamage; + } + + /** + * @return int + */ + public function getMaxDamage(): int + { + return $this->maxDamage; + } + + /** + * @return int + */ + public function getHeadArmor(): int + { + return $this->headArmor; + } + + /** + * @return int + */ + public function getChestArmor(): int + { + return $this->chestArmor; + } + + /** + * @return int + */ + public function getLegArmor(): int + { + return $this->legArmor; + } + + +} \ No newline at end of file diff --git a/inf.php b/inf.php index 05509f6..2f92f1b 100644 --- a/inf.php +++ b/inf.php @@ -1,21 +1,14 @@ id); +$userInfo = new \Battles\UserInfo(urldecode($_SERVER['QUERY_STRING'])); +$presentsModel = new \Battles\Models\PresentsModel($userInfo->getId()); $presentsList = $presentsModel->getAllPresents(); $userInfo->watcher_id = $_SESSION['uid'] ?? null; -\Battles\Template::header('Информация о ' . $userInfo->login); -if (!$userInfo->id) { - echo sprintf('Ошибка: персонаж %s не найден...

←назад

', $login); +\Battles\Template::header('Информация о ' . $userInfo->getLogin()); +if (!$userInfo->getId()) { + echo sprintf('Ошибка: персонаж %s не найден...

←назад

', urldecode($_SERVER['QUERY_STRING'])); exit; } -try { - $userInfo->showUserInfo(); - -} catch (Exception $e_showUserInfo) { - echo "
Ошибка генератора showUserInfo() в User.php: {$e_showUserInfo}
"; -} - +$userInfo->showUserInfo(); include_once 'views/presents-list.php'; \ No newline at end of file diff --git a/main.php b/main.php index 9721a0b..9878606 100644 --- a/main.php +++ b/main.php @@ -6,6 +6,7 @@ use Battles\InventoryItem; use Battles\Template; use Battles\Travel; use Battles\UserInfo; +use Battles\UserStats; ob_start("ob_gzhandler"); session_start(); @@ -35,6 +36,7 @@ $setShadow = $_POST['setshadow'] ?? null; $edit = $_GET['edit'] ?? null; // Подготавливаем отображение инфы и предметов. $userInfo = new UserInfo($user->getId()); +$userStats = new UserStats($user->getId()); $getItemsBonuses = new DressedItems($_SESSION['uid']); $data = \Battles\Database\DBPDO::INIT()->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId()); $iteminfo = []; @@ -173,7 +175,7 @@ if ($goto) { $eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->getId()); //(масса: getItemsWeight() . '/' . $user->strength * 4 - if ($d['sum_weight'] > $user->getStrength() * 4 && $goto) { + if ($d['sum_weight'] > $userStats->getStrength() * 4 && $goto) { err('У вас переполнен рюкзак, вы не можете передвигаться...'); $imove = false; } @@ -199,60 +201,11 @@ if (isset($_GET['use'])) { usemagic($_GET['use'], $_POST['target']); } -function setShadow($image) -{ - global $user; - $shadows = [ - 'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10', - 'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10', - 'person', - ]; - if (in_array($image, $shadows)) { - $i = $image . '.png'; - db::c()->query('UPDATE `users` SET `shadow` = "?s" WHERE `id` = ?i', $i, $user->getId()); - } else { - err('Ошибка!'); - } +if ($obraz) { + $user->setShadow($obraz); + $user->saveShadow(); } -if ($obraz && ($user->getShadow() == 'g0.gif' || $user->getShadow() == 'man0.gif')) { - setShadow($obraz); -} - -if ($del == 1 && $effectId > 0) { - $pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user->getId(), $effectId)->fetch_assoc(); - if (isset($pl['type'])) { - echo del_efs($effectId, $pl['type']); - } else { - echo "Эффект не найден!"; - } -} - -if ($brons && $ids) { - try { - $cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user->getId(), $ids)->fetch_assoc(); - } catch (\Krugozor\Database\Mysql\Exception $e) { - echo "
Ошибка: " . $e->getMessage() . "
В файле: " . $e->getFile() . " (" . $e->getLine() . ")
"; - } - if ($cur['free_bron'] > 0 && $cur[$brons] > 0) { - db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->getId(), $ids); - echo "Параметр брони увеличен!"; - } -} -if ($stats && $ids) { - $cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids); - if ($cur['free_stat'] > 0 && $cur[$stats] > 0) { - db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->getId(), $ids); - echo "Параметр увеличен!"; - } -} -if ($mfs && $ids) { - $cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids); - if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) { - db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->getId(), $ids); - echo "Параметр увеличен!"; - } -} if ($setShadow) { Template::header('Образ персонажа'); ?> @@ -388,39 +341,39 @@ Template::header('Игра');
- Сила: getFreeStatPoints() ? $user->getStat('strength', 1) . '(' . strval($user->getStrength() + $getItemsBonuses->getStrengthBonus()) . ')' : $user->getStrength() + $getItemsBonuses->getStrengthBonus()) ?> + Сила: getFreeStatPoints() ? $userStats->getStat('strength', 1) . '(' . strval($userStats->getStrength() + $getItemsBonuses->getStrengthBonus()) . ')' : $userStats->getStrength() + $getItemsBonuses->getStrengthBonus()) ?>
- Ловкость: getFreeStatPoints() ? $user->getStat('dexterity', 1) . '(' . strval($user->getDexterity() + $getItemsBonuses->getDexterityBonus()) . ')' : $user->getDexterity() + $getItemsBonuses->getDexterityBonus()) ?> + Ловкость: getFreeStatPoints() ? $userStats->getStat('dexterity', 1) . '(' . strval($userStats->getDexterity() + $getItemsBonuses->getDexterityBonus()) . ')' : $userStats->getDexterity() + $getItemsBonuses->getDexterityBonus()) ?>
- Интуиция: getFreeStatPoints() ? $user->getStat('intuition', 1) . '(' . strval($user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) . ')' : $user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) ?> + Интуиция: getFreeStatPoints() ? $userStats->getStat('intuition', 1) . '(' . strval($userStats->getIntuition() + $getItemsBonuses->getIntuitionBonus()) . ')' : $userStats->getIntuition() + $getItemsBonuses->getIntuitionBonus()) ?>
- Выносливость: getFreeStatPoints() ? $user->getStat('endurance', 1) . '(' . strval($user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) . ')' : $user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) ?> + Выносливость: getFreeStatPoints() ? $userStats->getStat('endurance', 1) . '(' . strval($userStats->getEndurance() + $getItemsBonuses->getEnduranceBonus()) . ')' : $userStats->getEndurance() + $getItemsBonuses->getEnduranceBonus()) ?>
- Интеллект: getFreeStatPoints() ? $user->getStat('intelligence', 1) . '(' . strval($user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) . ')' : $user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) ?> + Интеллект: getFreeStatPoints() ? $userStats->getStat('intelligence', 1) . '(' . strval($userStats->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) . ')' : $userStats->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) ?>
- Мудрость: getFreeStatPoints() ? $user->getStat('wisdom', 1) . '(' . strval($user->getWisdom() + $getItemsBonuses->getWisdomBonus()) . ')' : $user->getWisdom() + $getItemsBonuses->getWisdomBonus()) ?> + Мудрость: getFreeStatPoints() ? $userStats->getStat('wisdom', 1) . '(' . strval($userStats->getWisdom() + $getItemsBonuses->getWisdomBonus()) . ')' : $userStats->getWisdom() + $getItemsBonuses->getWisdomBonus()) ?>
- getFreeStatPoints()): ?> + getFreeStatPoints()): ?> Возможных - увеличений: getFreeStatPoints() ?>
+ увеличений: getFreeStatPoints() ?>

- Здоровье: getHealth() ?>
- Пыль: getMana() ?>
+ Здоровье: getHealth() ?>
+ Пыль: getMana() ?>
Уворот: getEvasionBonus() ?>
Точность: getAccuracyBonus() ?>
Шанс крита: getCriticalsBonus() ?>
- Урон: getMinDamage() + $getItemsBonuses->getMinPhysDamage() ?> - - getMaxDamage() + $getItemsBonuses->getMaxPhysDamage() ?>
+ Урон: getMinDamage() + $getItemsBonuses->getMinPhysDamage() ?> + - getMaxDamage() + $getItemsBonuses->getMaxPhysDamage() ?>

Защита от огня: ??
Защита от воды: ??
Защита от вохдуха: ??
Защита от земли: ??
Защита от яда: ??
- Броня головы: getHeadArmor() ?>
- Броня корпуса: getChestArmor() ?>
- Броня ног: getLegArmor() ?>
+ Броня головы: getHeadArmor() ?>
+ Броня корпуса: getChestArmor() ?>
+ Броня ног: getLegArmor() ?>
@@ -445,7 +398,7 @@ Template::header('Игра');
", $hobbie); $hobbie = str_replace("\\r", "", $hobbie); @@ -18,14 +17,19 @@ if ($name || $hobbie) { if (strlen($hobbie) > User::INFO_CHAR_LIMIT) { err('Максимальная длинна поля Хобби: ' . User::INFO_CHAR_LIMIT . ' символов!'); } else { - $values = ['realname' => $name, 'color' => $color, 'info' => $hobbie]; - db::c()->query('UPDATE users SET ?As WHERE id = ?i', $values, $user->getId()); + if ($name) { + $user->setRealname($name); + } + if ($hobbie) { + $user->setInfo($hobbie); + } + $user->saveAnketa(); } } - if ($oldpsw && $newpsw) { if (password_verify($oldpsw, $user->getPass())) { - db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `id` = ?i', password_hash($newpsw, PASSWORD_DEFAULT), $user->getId()); + $user->setPass(password_hash($newpsw, PASSWORD_DEFAULT)); + $user->savePass(); } else { err('Неверный текущий пароль!'); }
Рюкзак - (масса: getStrength() * 4 ?>) + (масса: getStrength() * 4 ?>)