battles/classes/Battles/InventoryItem.php

39 lines
1005 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()
{
if (in_array($this->item_type, range(1, 12))) {
echo <<<HTML
<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>
<img src="/i/sh/{$this->image}" class="item-wrap-normal" alt="">
</a>
HTML;
} else {
echo <<<IMG
<img src="/i/sh/{$this->image}" class="item-wrap-normal" alt="">
IMG;
2019-01-11 22:30:12 +00:00
}
2019-01-11 22:18:18 +00:00
}
public function printControls() {}
2019-01-11 21:57:15 +00:00
}