Отображение статов отображажало только силу. Теперь к статам можно обращаться напрямик.

This commit is contained in:
Igor Barkov (iwork) 2020-07-20 12:32:51 +03:00
parent 2d73a57d31
commit 94e1dccaef

View File

@ -25,10 +25,15 @@ class User
public $room; public $room;
public $block; public $block;
public $shadow; public $shadow;
public const STAT_MAXIMUM_AMOUNT = 40;
// Пока несуществующие, для совместимости. // Пока несуществующие, для совместимости.
public $married = 'Someone или нет.'; public $married = 'Someone или нет.';
public $experience = 200; public $experience = 200;
public $stat_points = 1; public $stat_points = 1;
public $headArmor;
public $chestArmor;
public $legArmor;
// Динамически рассчитываемые // Динамически рассчитываемые
public $health; public $health;
//Статусы того, кто смотрит на информацию. //Статусы того, кто смотрит на информацию.
@ -129,52 +134,55 @@ class User
echo '</div><!-- user-info -->'; echo '</div><!-- user-info -->';
} }
private function getStrength($isMainWindow = 0) public function getStrength($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->strength < self::STAT_MAXIMUM_AMOUNT) {
//main.php?edit=1&ups=sila
return sprintf('%s <a href="#">[+]</a>', $this->strength); return sprintf('%s <a href="#">[+]</a>', $this->strength);
} }
return $this->strength; return $this->strength;
} }
private function getDexterity($isMainWindow = 0) public function getDexterity($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->dexterity < self::STAT_MAXIMUM_AMOUNT) {
//main.php?edit=1&ups=lovk
return sprintf('%s <a href="#">[+]</a>', $this->dexterity); return sprintf('%s <a href="#">[+]</a>', $this->dexterity);
} }
return $this->strength; return $this->dexterity;
} }
private function getIntuition($isMainWindow = 0) public function getIntuition($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->intuition < self::STAT_MAXIMUM_AMOUNT) {
//main.php?edit=1&ups=inta...
return sprintf('%s <a href="#">[+]</a>', $this->intuition); return sprintf('%s <a href="#">[+]</a>', $this->intuition);
} }
return $this->strength; return $this->intuition;
} }
private function getEndurance($isMainWindow = 0) public function getEndurance($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->endurance < self::STAT_MAXIMUM_AMOUNT) {
return sprintf('%s <a href="#">[+]</a>', $this->endurance); return sprintf('%s <a href="#">[+]</a>', $this->endurance);
} }
return $this->strength; return $this->endurance;
} }
private function getIntelligence($isMainWindow = 0) public function getIntelligence($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->intelligence < self::STAT_MAXIMUM_AMOUNT) {
return sprintf('%s <a href="#">[+]</a>', $this->intelligence); return sprintf('%s <a href="#">[+]</a>', $this->intelligence);
} }
return $this->strength; return $this->intelligence;
} }
private function getWisdom($isMainWindow = 0) public function getWisdom($isMainWindow = 0)
{ {
if ($this->stat_points && $isMainWindow) { if ($this->stat_points && $isMainWindow && $this->wisdom < self::STAT_MAXIMUM_AMOUNT) {
return sprintf('%s <a href="#">[+]</a>', $this->wisdom); return sprintf('%s <a href="#">[+]</a>', $this->wisdom);
} }
return $this->strength; return $this->wisdom;
} }
private function UserInfo() private function UserInfo()