Отображение стат+бонус вместо чистого стата там, где это необходимо. Унификация запроса переменной. #18

This commit is contained in:
lopar 2021-03-11 20:14:41 +02:00
parent f5b2b23582
commit 26ed4cd286
3 changed files with 13 additions and 43 deletions

View File

@ -60,36 +60,6 @@ SQL;
return self::$db->fetch($query, $this->USERID);
}
public function getStrengthBonus(): ?int
{
return self::getBonuses()['sum_strength'];
}
public function getDexterityBonus(): ?int
{
return self::getBonuses()['sum_dexterity'];
}
public function getIntuitionBonus(): ?int
{
return self::getBonuses()['sum_intuition'];
}
public function getEnduranceBonus(): ?int
{
return self::getBonuses()['sum_endurance'];
}
public function getIntelliganceBonus(): ?int
{
return self::getBonuses()['sum_intelligence'];
}
public function getWisdomBonus(): ?int
{
return self::getBonuses()['sum_wisdom'];
}
public function getAccuracyBonus(): ?int
{
return self::getBonuses()['sum_accuracy'] ?? 0;

View File

@ -53,12 +53,12 @@ class UserInfo extends UserStats
$captions = 'Уровень:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Местонахождение:';
$variables =
$this->level . '<br>' .
parent::getStat('strength') . '<br>' .
parent::getStat('dexterity') . '<br>' .
parent::getStat('intuition') . '<br>' .
parent::getStat('endurance') . '<br>' .
parent::getStat('intelligence') . '<br>' .
parent::getStat('wisdom') . '<br>' .
parent::getFullStats()->allStrength . '<br>' .
parent::getFullStats()->allDexterity . '<br>' .
parent::getFullStats()->allIntuition . '<br>' .
parent::getFullStats()->allEndurance . '<br>' .
parent::getFullStats()->allIntelligence . '<br>' .
parent::getFullStats()->allWisdom . '<br>' .
Rooms::$roomNames[$this->room];
if ($isMainWindow) {
$this->Bank = new Bank($this->id);

View File

@ -381,17 +381,17 @@ Template::header('Игра');
<!--Параметры-->
<div>
<div class="container">
Сила: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('strength', 1) . '(' . strval($userStats->getStrength() + $getItemsBonuses->getStrengthBonus()) . ')' : $userStats->getStrength() + $getItemsBonuses->getStrengthBonus()) ?>
Сила: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('strength', 1) . '(' . strval($userStats->getFullStats()->allStrength) . ')' : $userStats->getFullStats()->allStrength) ?>
<br>
Ловкость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('dexterity', 1) . '(' . strval($userStats->getDexterity() + $getItemsBonuses->getDexterityBonus()) . ')' : $userStats->getDexterity() + $getItemsBonuses->getDexterityBonus()) ?>
Ловкость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('dexterity', 1) . '(' . strval($userStats->getFullStats()->allDexterity) . ')' : $userStats->getFullStats()->allDexterity) ?>
<br>
Интуиция: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intuition', 1) . '(' . strval($userStats->getIntuition() + $getItemsBonuses->getIntuitionBonus()) . ')' : $userStats->getIntuition() + $getItemsBonuses->getIntuitionBonus()) ?>
Интуиция: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intuition', 1) . '(' . strval($userStats->getFullStats()->allIntuition) . ')' : $userStats->getFullStats()->allIntuition) ?>
<br>
Выносливость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('endurance', 1) . '(' . strval($userStats->getEndurance() + $getItemsBonuses->getEnduranceBonus()) . ')' : $userStats->getEndurance() + $getItemsBonuses->getEnduranceBonus()) ?>
Выносливость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('endurance', 1) . '(' . strval($userStats->getFullStats()->allEndurance) . ')' : $userStats->getFullStats()->allEndurance) ?>
<br>
Интеллект: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intelligence', 1) . '(' . strval($userStats->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) . ')' : $userStats->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) ?>
Интеллект: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intelligence', 1) . '(' . strval($userStats->getFullStats()->allIntelligence) . ')' : $userStats->getFullStats()->allIntelligence) ?>
<br>
Мудрость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('wisdom', 1) . '(' . strval($userStats->getWisdom() + $getItemsBonuses->getWisdomBonus()) . ')' : $userStats->getWisdom() + $getItemsBonuses->getWisdomBonus()) ?>
Мудрость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('wisdom', 1) . '(' . strval($userStats->getFullStats()->allWisdom) . ')' : $userStats->getFullStats()->allWisdom) ?>
<br>
<?php if ($userStats->getFreeStatPoints()): ?>
<small style="color: darkgreen;">Возможных
@ -438,7 +438,7 @@ Template::header('Игра');
<div> <!--рюкзак-->
<table style="border: 0; padding: 2px; border-spacing: 1px; width: 100%; background-color: #a5a5a5">
<caption>Рюкзак
(масса: <?= '?? /' . $userStats->getStrength() * 4 ?>)
(масса: <?= '?? /' . (int)$userStats->getStrength() * 4 ?>)
</caption>
<?php
foreach ($iteminfo as $ii) {