parent:: test
This commit is contained in:
parent
0a8d9632bb
commit
ec59f2726e
@ -1,10 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: Lopar
|
|
||||||
* Date: 10.01.2019
|
|
||||||
* Time: 17:12
|
|
||||||
*/
|
|
||||||
|
|
||||||
abstract class Item
|
abstract class Item
|
||||||
{
|
{
|
||||||
@ -15,6 +9,9 @@ abstract class Item
|
|||||||
public $maxdur;
|
public $maxdur;
|
||||||
public $img;
|
public $img;
|
||||||
|
|
||||||
|
protected $cost;
|
||||||
|
protected $ecost;
|
||||||
|
|
||||||
public $nlevel;
|
public $nlevel;
|
||||||
public $nsila;
|
public $nsila;
|
||||||
public $nlovk;
|
public $nlovk;
|
||||||
@ -77,6 +74,9 @@ abstract class Item
|
|||||||
$this->maxdur = $row['maxdur'];
|
$this->maxdur = $row['maxdur'];
|
||||||
$this->img = $row['img'];
|
$this->img = $row['img'];
|
||||||
|
|
||||||
|
$this->cost = $row['cost'];
|
||||||
|
$this->ecost = $row['ecost'];
|
||||||
|
|
||||||
$this->nlevel = $row['nlevel'];
|
$this->nlevel = $row['nlevel'];
|
||||||
$this->nalign = $row['nalign'];
|
$this->nalign = $row['nalign'];
|
||||||
$this->nsila = $row['nsila'];
|
$this->nsila = $row['nsila'];
|
||||||
@ -133,6 +133,12 @@ abstract class Item
|
|||||||
echo "<img src='/i/sh/{$this->img}'";
|
echo "<img src='/i/sh/{$this->img}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function wrap($number)
|
||||||
|
{
|
||||||
|
if ($number > 0) return ": <b>" . $number . "</b>";
|
||||||
|
else return ": <b style='color: maroon;'>" . $number . "</b>";
|
||||||
|
}
|
||||||
|
|
||||||
protected function printBaseInfo()
|
protected function printBaseInfo()
|
||||||
{
|
{
|
||||||
echo $this->name . " (Масса: " . $this->massa . ")";
|
echo $this->name . " (Масса: " . $this->massa . ")";
|
||||||
@ -141,4 +147,32 @@ abstract class Item
|
|||||||
if ($this->maxdur > 0) echo "<br>Долговечность: {$this->maxdur}";
|
if ($this->maxdur > 0) echo "<br>Долговечность: {$this->maxdur}";
|
||||||
if ($this->maxdur == -1) echo "<br>Долговечность: <i>неразрушимо</i>";
|
if ($this->maxdur == -1) echo "<br>Долговечность: <i>неразрушимо</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function printRequirements()
|
||||||
|
{
|
||||||
|
if ($this->nlevel > 0) echo "<br>Требуется уровень" . $this->wrap($this->nlevel);
|
||||||
|
if ($this->nnoj > 0) echo "<br>Требуется владение колющим оружиием" . $this->wrap($this->nnoj);
|
||||||
|
if ($this->ndubina > 0) echo "<br>Требуется владение дробящим оружием" . $this->wrap($this->ndubina);
|
||||||
|
if ($this->ntopor > 0) echo "<br>Требуется владение рубящим оружием" . $this->wrap($this->ntopor);
|
||||||
|
if ($this->nmech > 0) echo "<br>Требуется владение режущим оружием" . $this->wrap($this->nmech);
|
||||||
|
if ($this->nsila > 0) echo "<br>Требуется сила" . $this->wrap($this->nsila);
|
||||||
|
if ($this->nlovk > 0) echo "<br>Требуется ловкость" . $this->wrap($this->nlovk);
|
||||||
|
if ($this->ninta > 0) echo "<br>Требуется интуиция" . $this->wrap($this->ninta);
|
||||||
|
if ($this->nvinos > 0) echo "<br>Требуется выносливость" . $this->wrap($this->nvinos);
|
||||||
|
if ($this->nintel > 0) echo "<br>Требуется интеллект" . $this->wrap($this->nintel);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function printBonuses()
|
||||||
|
{
|
||||||
|
if ($this->gsila) echo "<br>Сила" . $this->wrap($this->gsila);
|
||||||
|
if ($this->glovk) echo "<br>Ловкость" . $this->wrap($this->glovk);
|
||||||
|
if ($this->ginta) echo "<br>Интуиция" . $this->wrap($this->ginta);
|
||||||
|
if ($this->gintel) echo "<br>Интеллект" . $this->wrap($this->gintel);
|
||||||
|
if ($this->minu AND $this->maxu) echo "<br>Урон: {$this->minu} - {$this->maxu}";
|
||||||
|
if ($this->ghp) echo "<br>Здоровье" . $this->wrap($this->ghp);
|
||||||
|
if ($this->gnoj) echo "<br>Владение колющим оружиием" . $this->wrap($this->gnoj);
|
||||||
|
if ($this->gdubina) echo "<br>Владение дробящим оружием" . $this->wrap($this->gdubina);
|
||||||
|
if ($this->gtopor) echo "<br>Владение рубящим оружием" . $this->wrap($this->gtopor);
|
||||||
|
if ($this->gmech) echo "<br>Владение режущим оружием" . $this->wrap($this->gmech);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,45 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: Lopar
|
|
||||||
* Date: 11.01.2019
|
|
||||||
* Time: 18:21
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ItemClass extends Item
|
class ItemClass extends Item
|
||||||
{
|
{
|
||||||
private function wrap($number)
|
public function ShopInfo()
|
||||||
{
|
|
||||||
if ($number > 0) return ": <b>" . $number . "</b>";
|
|
||||||
else return ": <b style='color: maroon;'>" . $number . "</b>";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function printStats()
|
|
||||||
{
|
{
|
||||||
parent::printBaseInfo();
|
parent::printBaseInfo();
|
||||||
if ($this->nlevel > 0) echo "<br>Требуется уровень" . $this->wrap($this->nlevel);
|
echo "<br>Цена" . $this->wrap($this->cost);
|
||||||
if ($this->nnoj > 0) echo "<br>Требуется владение колющим оружиием" . $this->wrap($this->nnoj);
|
parent::printRequirements();
|
||||||
if ($this->ndubina > 0) echo "<br>Требуется владение дробящим оружием" . $this->wrap($this->ndubina);
|
parent::printBonuses();
|
||||||
if ($this->ntopor > 0) echo "<br>Требуется владение рубящим оружием" . $this->wrap($this->ntopor);
|
|
||||||
if ($this->nmech > 0) echo "<br>Требуется владение режущим оружием" . $this->wrap($this->nmech);
|
|
||||||
if ($this->nsila > 0) echo "<br>Требуется сила" . $this->wrap($this->nsila);
|
|
||||||
if ($this->nlovk > 0) echo "<br>Требуется ловкость" . $this->wrap($this->nlovk);
|
|
||||||
if ($this->ninta > 0) echo "<br>Требуется интуиция" . $this->wrap($this->ninta);
|
|
||||||
if ($this->nvinos > 0) echo "<br>Требуется выносливость" . $this->wrap($this->nvinos);
|
|
||||||
if ($this->nintel > 0) echo "<br>Требуется интеллект" . $this->wrap($this->nintel);
|
|
||||||
|
|
||||||
if ($this->gsila) echo "<br>Сила" . $this->wrap($this->gsila);
|
|
||||||
if ($this->glovk) echo "<br>Ловкость" . $this->wrap($this->glovk);
|
|
||||||
if ($this->ginta) echo "<br>Интуиция" . $this->wrap($this->ginta);
|
|
||||||
if ($this->gintel) echo "<br>Интеллект" . $this->wrap($this->gintel);
|
|
||||||
if ($this->minu AND $this->maxu) echo "<br>Урон: {$this->minu} - {$this->maxu}";
|
|
||||||
if ($this->ghp) echo "<br>Здоровье" . $this->wrap($this->ghp);
|
|
||||||
if ($this->gnoj) echo "<br>Владение колющим оружиием" . $this->wrap($this->gnoj);
|
|
||||||
if ($this->gdubina) echo "<br>Владение дробящим оружием" . $this->wrap($this->gdubina);
|
|
||||||
if ($this->gtopor) echo "<br>Владение рубящим оружием" . $this->wrap($this->gtopor);
|
|
||||||
if ($this->gmech) echo "<br>Владение режущим оружием" . $this->wrap($this->gmech);
|
|
||||||
|
|
||||||
echo "<br>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function EkrShopInfo()
|
||||||
|
{
|
||||||
|
parent::printBaseInfo();
|
||||||
|
echo "<br>Цена" . $this->wrap($this->ecost);
|
||||||
|
parent::printRequirements();
|
||||||
|
parent::printBonuses();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PresentInfo()
|
||||||
|
{
|
||||||
|
parent::printBaseInfo();
|
||||||
|
}
|
||||||
}
|
}
|
2
test.php
2
test.php
@ -26,7 +26,7 @@ foreach ($iteminfo as $ii) {
|
|||||||
$ii->printImage();
|
$ii->printImage();
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "<td bgcolor='#d3d3d3'>";
|
echo "<td bgcolor='#d3d3d3'>";
|
||||||
$ii->printStats();
|
$ii->ShopInfo();
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
Loading…
x
Reference in New Issue
Block a user