2019-01-11 20:26:10 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
class ShopItem extends Item
|
|
|
|
|
{
|
|
|
|
|
public function printInfo()
|
|
|
|
|
{
|
2019-01-14 21:46:56 +00:00
|
|
|
|
if ($this->printControls()) $this->maxdur = 0;
|
2019-01-14 21:44:33 +00:00
|
|
|
|
|
2019-01-11 20:26:10 +00:00
|
|
|
|
parent::printBaseInfo();
|
|
|
|
|
parent::printRequirements();
|
|
|
|
|
parent::printBonuses();
|
2019-01-14 14:12:53 +00:00
|
|
|
|
parent::printMagic();
|
2019-01-11 20:26:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
|
|
|
|
|
*/
|
2019-01-14 20:28:47 +00:00
|
|
|
|
public function printControls($sell = false)
|
2019-01-11 20:26:10 +00:00
|
|
|
|
{
|
2019-01-14 20:28:47 +00:00
|
|
|
|
if ($sell) {
|
|
|
|
|
$btnPrice = "Продать";
|
|
|
|
|
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
|
2019-01-14 21:44:33 +00:00
|
|
|
|
$this->maxdur = 0;
|
2019-01-14 20:28:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
$btnPrice = "Купить за " . intval($this->cost) . " кр.";
|
|
|
|
|
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
|
|
|
|
|
}
|
2019-01-11 20:26:10 +00:00
|
|
|
|
echo <<<BTN
|
2019-01-14 16:19:25 +00:00
|
|
|
|
<p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnPrice}"
|
2019-01-14 16:42:45 +00:00
|
|
|
|
onclick="location='{$btnLink}'">
|
2019-01-11 20:26:10 +00:00
|
|
|
|
BTN;
|
2019-01-14 17:15:16 +00:00
|
|
|
|
if ($this->count > 0) echo "<br><small>В наличии: {$this->count} штук</small>";
|
2019-01-11 20:26:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|