two type test

This commit is contained in:
lopar 2019-01-12 00:05:20 +02:00
parent 6a791d528e
commit 2da8f9c7a0
2 changed files with 11 additions and 9 deletions

View File

@ -5,13 +5,9 @@ abstract class Item
public $name;
public $massa;
public $nalign;
public $count;
public $maxdur;
public $img;
protected $cost;
protected $ecost;
public $nlevel;
public $nsila;
public $nlovk;
@ -70,13 +66,9 @@ abstract class Item
{
$this->name = $row['name'];
$this->massa = $row['massa'];
$this->count = $row['count'];
$this->maxdur = $row['maxdur'];
$this->img = $row['img'];
$this->cost = $row['cost'];
$this->ecost = $row['ecost'];
$this->nlevel = $row['nlevel'];
$this->nalign = $row['nalign'];
$this->nsila = $row['nsila'];
@ -143,7 +135,6 @@ abstract class Item
{
echo $this->name . " (Масса: " . $this->massa . ")";
if ($this->nalign) echo " <img src=i/align_{$this->nalign}.gif title='Этот предмет могут использовать только игроки с определённой склонностью.'> ";
if ($this->count > 0) echo "<br><small>(Осталось: {$this->count} штук)</small>";
if ($this->maxdur > 0) echo "<br>Долговечность: {$this->maxdur}";
if ($this->maxdur == -1) echo "<br>Долговечность: <i>неразрушимо</i>";
}

View File

@ -2,10 +2,21 @@
class ShopItem extends Item
{
private $cost;
private $count;
private function __construct($row)
{
parent::__construct($row);
$this->cost = $row['cost'];
$this->count = $row['count'];
}
public function printInfo()
{
parent::printBaseInfo();
echo "<br>Цена" . $this->wrap($this->cost) . " пымпочек";
if ($this->count > 0) echo "<br><small>(Осталось: {$this->count} штук)</small>";
parent::printRequirements();
parent::printBonuses();
}