battles/classes/InventoryItem.php

46 lines
1.4 KiB
PHP
Raw Normal View History

2019-01-11 21:57:15 +00:00
<?php
class InventoryItem extends Item
{
2019-01-12 09:47:23 +00:00
private $present;
public function __construct($row)
{
parent::__construct($row);
$this->present = $row['present'];
2019-01-12 10:04:24 +00:00
if ($this->artefact) $this->name = <<<NAME
2019-01-12 10:28:46 +00:00
<b style='color: crimson;'>{$this->name}</b> <img src="//{$_SERVER['SERVER_NAME']}/i/artefact1.gif">
2019-01-12 10:04:24 +00:00
NAME;
2019-01-12 09:47:23 +00:00
}
2019-01-11 21:57:15 +00:00
public function printInfo()
{
parent::printBaseInfo();
parent::printRequirements();
parent::printBonuses();
2019-01-14 13:52:41 +00:00
parent::printMagic();
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()
{
2019-01-11 22:30:12 +00:00
if (!in_array($this->type,[12,50,200])) {
2019-01-14 14:43:09 +00:00
echo "<a href=//{$_SERVER['SERVER_NAME']}/main.php?edit=1&dress={$this->id} title='Надеть'>";
2019-01-11 22:30:12 +00:00
parent::printImage();
echo "</a>";
}
else parent::printImage();
2019-01-11 22:18:18 +00:00
}
2019-01-11 21:57:15 +00:00
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
*/
public function printControls()
{
echo <<<BTN
2019-01-12 10:28:46 +00:00
<p><input type="button" style="background: brown; border: 1px solid grey; color: white; border-radius: 2px;" value="Выбросить"
2019-01-11 21:57:15 +00:00
onclick="location='/admin.php'">
BTN;
}
}