"nickname:origin" keys this member ignores (18) */ public array $ignores = []; /** @var array ids this member had a private talk with (they hear 74 when he leaves) */ public array $partners = []; public float $connectedAt; public function __construct( public readonly string $id, public readonly string $nickname, public readonly int $age, public readonly int $sex, public readonly string $city, public readonly int $admin, public readonly int $origin, public readonly Session $session, ) { $this->connectedAt = microtime(true); } public function isAdmin(): bool { return $this->admin === 1 || $this->admin === 2; } /** "nickname:origin": how the applet names a member in its ignore, friend and ejection lists. */ public function key(): string { return $this->nickname . ':' . $this->origin; } /** An empty field vanishes in the applet's tokenizer (it shifts the others): "?" is its "nothing". */ public function cityField(): string { return $this->city === '' ? '?' : $this->city; } /** The member as the room's list shows it: id, admin, nickname, flags, age, sex, city. */ public function roomEntry(): array { return [$this->id, (string)$this->admin, $this->nickname, (string)$this->flags, (string)$this->age, (string)$this->sex, $this->cityField()]; } /** The member as a search shows it (with the sex). */ public function searchEntry(bool $withSex): array { $row = [$this->id, $this->nickname, (string)($this->flags & (self::REFUSES_PRIVATE | self::BUSY)), (string)$this->age]; if ($withSex) { $row[] = (string)$this->sex; } // where: 0 / 4 in a public room (its name), 1 / 5 in a private one, else nowhere ("?") $where = $this->room === null ? '2' : ($this->room->type === 0 ? '0' : '1'); return [...$row, $this->cityField(), $this->room === null ? '?' : $this->room->name, $where]; } }