game/_incl_data/class/Inf/Twinks.php

40 lines
936 B
PHP
Raw Normal View History

2023-11-02 13:57:39 +00:00
<?php
namespace Inf;
use Core\Db;
class Twinks
{
private array $twinks = [];
/** Мульты персонажа
* @param int $userid
* @param int $twinkid
*/
public function __construct(int $userid, int $twinkid)
{
$twinks = Db::getRows('select login, level, twink from users_twink where uid = ? and twink != 0', [$userid]);
foreach ($twinks as $twink) {
$str = $twink['login'] . ' [' . $twink['level'] . ']';
if ($twinkid === $twink['twink']) {
$str = '<b style="color:#ff9900;">' . $str . '</b>';
}
$this->twinks[] = $str;
}
}
public function print(): void
{
echo $this->get();
}
private function get(): string
{
if (empty($this->twinks)) {
return '';
}
return 'Другие образы: ' . implode(', ', $this->twinks) . '<br>';
}
}