2019-01-11 21:57:15 +00:00
|
|
|
|
<?php
|
2020-10-28 20:21:08 +00:00
|
|
|
|
namespace Battles;
|
2019-01-11 21:57:15 +00:00
|
|
|
|
class InventoryItem extends Item
|
|
|
|
|
{
|
2019-01-12 09:47:23 +00:00
|
|
|
|
private $present;
|
|
|
|
|
|
|
|
|
|
public function __construct($row)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct($row);
|
2020-07-22 09:55:27 +00:00
|
|
|
|
if (isset($row['present'])) {
|
|
|
|
|
$this->present = $row['present'];
|
|
|
|
|
}
|
2019-01-12 09:47:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 21:57:15 +00:00
|
|
|
|
public function printInfo()
|
|
|
|
|
{
|
2020-07-21 15:03:46 +00:00
|
|
|
|
parent::printAllInfo();
|
|
|
|
|
if ($this->present) {
|
|
|
|
|
echo "<p style='color: maroon; font-style: italic'>Это подарок от {$this->present}. Вы не можете передать его кому-либо ещё.</p>";
|
|
|
|
|
}
|
2019-01-11 21:57:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 22:18:18 +00:00
|
|
|
|
public function printImage()
|
|
|
|
|
{
|
2020-07-22 14:04:15 +00:00
|
|
|
|
if (in_array($this->item_type, range(1,12))) {
|
2020-07-22 10:04:17 +00:00
|
|
|
|
echo "<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
|
2019-01-11 22:30:12 +00:00
|
|
|
|
parent::printImage();
|
|
|
|
|
echo "</a>";
|
2020-07-21 15:03:46 +00:00
|
|
|
|
} else {
|
|
|
|
|
parent::printImage();
|
2019-01-11 22:30:12 +00:00
|
|
|
|
}
|
2019-01-11 22:18:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 21:57:15 +00:00
|
|
|
|
/**
|
2019-02-12 18:31:23 +00:00
|
|
|
|
* Для кнопок управления под картинкой предмета в зависимости от ситуации.
|
2019-01-11 21:57:15 +00:00
|
|
|
|
*/
|
|
|
|
|
public function printControls()
|
|
|
|
|
{
|
2020-07-22 10:04:17 +00:00
|
|
|
|
//FIXME Сменить заглушку на нормальную функцию!!
|
2019-01-11 21:57:15 +00:00
|
|
|
|
echo <<<BTN
|
2020-07-22 10:04:17 +00:00
|
|
|
|
<p><button class="button danger" onclick="location.href='/admin.php'">Выбросить</button>
|
2019-01-11 21:57:15 +00:00
|
|
|
|
BTN;
|
|
|
|
|
}
|
2019-01-16 16:26:16 +00:00
|
|
|
|
|
|
|
|
|
public function getId()
|
|
|
|
|
{
|
2020-07-21 15:03:46 +00:00
|
|
|
|
return $this->item_id;
|
2019-01-16 16:26:16 +00:00
|
|
|
|
}
|
2019-01-11 21:57:15 +00:00
|
|
|
|
}
|