new selling price generation algorytm
This commit is contained in:
@@ -20,10 +20,15 @@ class ShopItem extends Item
|
||||
/**
|
||||
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
|
||||
*/
|
||||
public function printControls()
|
||||
public function printControls($sell = false)
|
||||
{
|
||||
$btnPrice = "Купить за " . intval($this->cost) . " кр.";
|
||||
$btnLink = "/shop.php?buy={$this->id}&rnd=".mt_rand();
|
||||
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}'">
|
||||
|
||||
Reference in New Issue
Block a user