battles/classes/InventoryItem.php
Igor Barkov [iwork] 19316744ce it works?!
2019-01-14 15:52:41 +02:00

50 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class InventoryItem extends Item
{
private $present;
private $artefact;
private $item_id;
public function __construct($row)
{
parent::__construct($row);
$this->present = $row['present'];
$this->artefact = $row['artefact'];
$this->item_id = $row['id'];
if ($this->artefact) $this->name = <<<NAME
<b style='color: crimson;'>{$this->name}</b> <img src="//{$_SERVER['SERVER_NAME']}/i/artefact1.gif">
NAME;
}
public function printInfo()
{
parent::printBaseInfo();
parent::printRequirements();
parent::printBonuses();
parent::printMagic();
if ($this->present) echo "<p style='color: maroon; font-style: italic'>Это подарок от {$this->present}. Вы не можете передать его кому-либо ещё.</p>";
}
public function printImage()
{
if (!in_array($this->type,[12,50,200])) {
echo "<a href=//{$_SERVER['SERVER_NAME']}/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
parent::printImage();
echo "</a>";
}
else parent::printImage();
}
/**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации.
*/
public function printControls()
{
echo <<<BTN
<p><input type="button" style="background: brown; border: 1px solid grey; color: white; border-radius: 2px;" value="Выбросить"
onclick="location='/admin.php'">
BTN;
}
}