battles/classes/Battles/InventoryItem.php

33 lines
878 B
PHP
Raw Normal View History

2019-01-11 21:57:15 +00:00
<?php
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()
{
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))) {
echo "<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
2019-01-11 22:30:12 +00:00
parent::printImage();
echo "</a>";
} 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
}