battles/classes/Battles/InventoryItem.php

35 lines
918 B
PHP
Raw Normal View History

2019-01-11 23:57:15 +02:00
<?php
namespace Battles;
2019-01-11 23:57:15 +02:00
class InventoryItem extends Item
{
2019-01-12 11:47:23 +02:00
private $present;
public function __construct($row)
{
parent::__construct($row);
2020-07-22 12:55:27 +03:00
if (isset($row['present'])) {
$this->present = $row['present'];
}
2019-01-12 11:47:23 +02:00
}
2019-01-11 23:57:15 +02:00
public function printInfo()
{
parent::printAllInfo();
if ($this->present) {
echo "<p style='color: maroon; font-style: italic'>Это подарок от {$this->present}. Вы не можете передать его кому-либо ещё.</p>";
}
2019-01-11 23:57:15 +02:00
}
2019-01-12 00:18:18 +02:00
public function printImage()
{
2020-07-22 17:04:15 +03:00
if (in_array($this->item_type, range(1,12))) {
echo "<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
2019-01-12 00:30:12 +02:00
parent::printImage();
echo "</a>";
} else {
parent::printImage();
2019-01-12 00:30:12 +02:00
}
2019-01-12 00:18:18 +02:00
}
public function printControls() {}
2019-01-11 23:57:15 +02:00
}