diff --git a/classes/Item.php b/classes/Item.php index 4db6568..c781998 100644 --- a/classes/Item.php +++ b/classes/Item.php @@ -1,10 +1,4 @@ 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']; @@ -133,6 +133,12 @@ abstract class Item echo " 0) return ": " . $number . ""; + else return ": " . $number . ""; + } + protected function printBaseInfo() { echo $this->name . " (Масса: " . $this->massa . ")"; @@ -141,4 +147,32 @@ abstract class Item if ($this->maxdur > 0) echo "
Долговечность: {$this->maxdur}"; if ($this->maxdur == -1) echo "
Долговечность: неразрушимо"; } + + protected function printRequirements() + { + if ($this->nlevel > 0) echo "
Требуется уровень" . $this->wrap($this->nlevel); + if ($this->nnoj > 0) echo "
Требуется владение колющим оружиием" . $this->wrap($this->nnoj); + if ($this->ndubina > 0) echo "
Требуется владение дробящим оружием" . $this->wrap($this->ndubina); + if ($this->ntopor > 0) echo "
Требуется владение рубящим оружием" . $this->wrap($this->ntopor); + if ($this->nmech > 0) echo "
Требуется владение режущим оружием" . $this->wrap($this->nmech); + if ($this->nsila > 0) echo "
Требуется сила" . $this->wrap($this->nsila); + if ($this->nlovk > 0) echo "
Требуется ловкость" . $this->wrap($this->nlovk); + if ($this->ninta > 0) echo "
Требуется интуиция" . $this->wrap($this->ninta); + if ($this->nvinos > 0) echo "
Требуется выносливость" . $this->wrap($this->nvinos); + if ($this->nintel > 0) echo "
Требуется интеллект" . $this->wrap($this->nintel); + } + + protected function printBonuses() + { + if ($this->gsila) echo "
Сила" . $this->wrap($this->gsila); + if ($this->glovk) echo "
Ловкость" . $this->wrap($this->glovk); + if ($this->ginta) echo "
Интуиция" . $this->wrap($this->ginta); + if ($this->gintel) echo "
Интеллект" . $this->wrap($this->gintel); + if ($this->minu AND $this->maxu) echo "
Урон: {$this->minu} - {$this->maxu}"; + if ($this->ghp) echo "
Здоровье" . $this->wrap($this->ghp); + if ($this->gnoj) echo "
Владение колющим оружиием" . $this->wrap($this->gnoj); + if ($this->gdubina) echo "
Владение дробящим оружием" . $this->wrap($this->gdubina); + if ($this->gtopor) echo "
Владение рубящим оружием" . $this->wrap($this->gtopor); + if ($this->gmech) echo "
Владение режущим оружием" . $this->wrap($this->gmech); + } } \ No newline at end of file diff --git a/classes/ItemClass.php b/classes/ItemClass.php index 054cf39..bf1e970 100644 --- a/classes/ItemClass.php +++ b/classes/ItemClass.php @@ -1,45 +1,25 @@ 0) return ": " . $number . ""; - else return ": " . $number . ""; - } - - public function printStats() + public function ShopInfo() { parent::printBaseInfo(); - if ($this->nlevel > 0) echo "
Требуется уровень" . $this->wrap($this->nlevel); - if ($this->nnoj > 0) echo "
Требуется владение колющим оружиием" . $this->wrap($this->nnoj); - if ($this->ndubina > 0) echo "
Требуется владение дробящим оружием" . $this->wrap($this->ndubina); - if ($this->ntopor > 0) echo "
Требуется владение рубящим оружием" . $this->wrap($this->ntopor); - if ($this->nmech > 0) echo "
Требуется владение режущим оружием" . $this->wrap($this->nmech); - if ($this->nsila > 0) echo "
Требуется сила" . $this->wrap($this->nsila); - if ($this->nlovk > 0) echo "
Требуется ловкость" . $this->wrap($this->nlovk); - if ($this->ninta > 0) echo "
Требуется интуиция" . $this->wrap($this->ninta); - if ($this->nvinos > 0) echo "
Требуется выносливость" . $this->wrap($this->nvinos); - if ($this->nintel > 0) echo "
Требуется интеллект" . $this->wrap($this->nintel); - - if ($this->gsila) echo "
Сила" . $this->wrap($this->gsila); - if ($this->glovk) echo "
Ловкость" . $this->wrap($this->glovk); - if ($this->ginta) echo "
Интуиция" . $this->wrap($this->ginta); - if ($this->gintel) echo "
Интеллект" . $this->wrap($this->gintel); - if ($this->minu AND $this->maxu) echo "
Урон: {$this->minu} - {$this->maxu}"; - if ($this->ghp) echo "
Здоровье" . $this->wrap($this->ghp); - if ($this->gnoj) echo "
Владение колющим оружиием" . $this->wrap($this->gnoj); - if ($this->gdubina) echo "
Владение дробящим оружием" . $this->wrap($this->gdubina); - if ($this->gtopor) echo "
Владение рубящим оружием" . $this->wrap($this->gtopor); - if ($this->gmech) echo "
Владение режущим оружием" . $this->wrap($this->gmech); - - echo "
"; + echo "
Цена" . $this->wrap($this->cost); + parent::printRequirements(); + parent::printBonuses(); } + public function EkrShopInfo() + { + parent::printBaseInfo(); + echo "
Цена" . $this->wrap($this->ecost); + parent::printRequirements(); + parent::printBonuses(); + } + + public function PresentInfo() + { + parent::printBaseInfo(); + } } \ No newline at end of file diff --git a/test.php b/test.php index a38b3df..6990025 100644 --- a/test.php +++ b/test.php @@ -26,7 +26,7 @@ foreach ($iteminfo as $ii) { $ii->printImage(); echo ""; echo ""; - $ii->printStats(); + $ii->ShopInfo(); echo ""; } echo ""; \ No newline at end of file