40 lines
936 B
PHP
40 lines
936 B
PHP
|
<?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>';
|
||
|
}
|
||
|
}
|