38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
||
|
||
class ShopItem extends Item
|
||
{
|
||
public $count;
|
||
public $razdel;
|
||
public $ecost;
|
||
public $zeton;
|
||
public $onlyone;
|
||
public $shshop;
|
||
|
||
public function printInfo()
|
||
{
|
||
parent::printBaseInfo();
|
||
parent::printRequirements();
|
||
parent::printBonuses();
|
||
parent::printMagic();
|
||
}
|
||
|
||
/**
|
||
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
|
||
*/
|
||
public function printControls($sell = false)
|
||
{
|
||
if ($sell) {
|
||
$btnPrice = "Продать";
|
||
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
|
||
} else {
|
||
$btnPrice = "Купить за " . intval($this->cost) . " кр.";
|
||
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
|
||
}
|
||
echo <<<BTN
|
||
<p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnPrice}"
|
||
onclick="location='{$btnLink}'">
|
||
BTN;
|
||
if ($this->count > 0) echo "<br><small>В наличии: {$this->count} штук</small>";
|
||
}
|
||
} |