404 lines
6.8 KiB
PHP
404 lines
6.8 KiB
PHP
<?php
|
|
|
|
#todo êàæåòñÿ ÷àñòü ïîëåé âðîäå city, room, color, invis íàïðÿìèê çàâèñèò îò login (îòïðàâèòåëü)
|
|
#todo åñëè ýòî òàê, ÷àñòüþ ñåòòåðîâ ìîæíî áóäåò ïîæåðòâîâàòü.
|
|
|
|
class ChatMessage
|
|
{
|
|
private int $new = 1;
|
|
private string $city = 'capitalcity';
|
|
private int $room = 0;
|
|
private string $login = '';
|
|
private string $to = '';
|
|
private string $text;
|
|
private int $time = 0;
|
|
private int $type = 0;
|
|
private int $toChat = 0;
|
|
private int $typeTime = 0;
|
|
private string $color = '#000';
|
|
private int $sound = 0;
|
|
private int $spam = 0;
|
|
private bool $isAlert = false;
|
|
private int $invis = 0;
|
|
private int $da = 0;
|
|
private int $nosee = 0;
|
|
private int $delete = 0;
|
|
private int $molch = 0;
|
|
private int $global = 0;
|
|
private int $dn = 0;
|
|
/**
|
|
* Ôååðâåðêè, ÷¸ðò ïîäåðè!
|
|
* _incl_data\class\magic\feerverks.php
|
|
* @var string|null
|
|
*/
|
|
private ?string $fireworks = null;
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getDn(): int
|
|
{
|
|
return $this->dn;
|
|
}
|
|
|
|
/**
|
|
* @param int $dn
|
|
*/
|
|
public function setDn(int $dn): void
|
|
{
|
|
$this->dn = $dn;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getGlobal(): int
|
|
{
|
|
return $this->global;
|
|
}
|
|
|
|
/**
|
|
* @param int $global
|
|
*/
|
|
public function setGlobal(int $global): void
|
|
{
|
|
$this->global = $global;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getDelete(): int
|
|
{
|
|
return $this->delete;
|
|
}
|
|
|
|
/**
|
|
* @param int $delete
|
|
*/
|
|
public function setDelete(int $delete): void
|
|
{
|
|
$this->delete = $delete;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getMolch(): int
|
|
{
|
|
return $this->molch;
|
|
}
|
|
|
|
/**
|
|
* @param int $molch
|
|
*/
|
|
public function setMolch(int $molch): void
|
|
{
|
|
$this->molch = $molch;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getNosee(): int
|
|
{
|
|
return $this->nosee;
|
|
}
|
|
|
|
/**
|
|
* @param int $nosee
|
|
*/
|
|
public function setNosee(int $nosee): void
|
|
{
|
|
$this->nosee = $nosee;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getInvis(): int
|
|
{
|
|
return $this->invis;
|
|
}
|
|
|
|
/**
|
|
* @param int $invis
|
|
*/
|
|
public function setInvis(int $invis): void
|
|
{
|
|
$this->invis = $invis;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getDa(): int
|
|
{
|
|
return $this->da;
|
|
}
|
|
|
|
/**
|
|
* @param int $da
|
|
*/
|
|
public function setDa(int $da): void
|
|
{
|
|
$this->da = $da;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getSpam(): int
|
|
{
|
|
return $this->spam;
|
|
}
|
|
|
|
/**
|
|
* @param int $spam
|
|
*/
|
|
public function setSpam(int $spam): void
|
|
{
|
|
$this->spam = $spam;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getSound(): int
|
|
{
|
|
return $this->sound;
|
|
}
|
|
|
|
/**
|
|
* @param int $sound
|
|
*/
|
|
public function setSound(int $sound): void
|
|
{
|
|
$this->sound = $sound;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getNew(): int
|
|
{
|
|
return $this->new;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getCity(): string
|
|
{
|
|
return $this->city;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getRoom(): int
|
|
{
|
|
return $this->room;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getLogin(): string
|
|
{
|
|
return $this->login;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getTo(): string
|
|
{
|
|
return $this->to;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getText(): string
|
|
{
|
|
if ($this->isAlert) {
|
|
return '<span style="color: red">Âíèìàíèå!</span> ' . $this->text;
|
|
}
|
|
return $this->text;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getTime(): int
|
|
{
|
|
if (!$this->time) {
|
|
$this->time = time();
|
|
}
|
|
return $this->time;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getType(): int
|
|
{
|
|
return $this->type;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getToChat(): int
|
|
{
|
|
return $this->toChat;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getTypeTime(): int
|
|
{
|
|
return $this->typeTime;
|
|
}
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getColor(): string
|
|
{
|
|
return $this->color;
|
|
}
|
|
|
|
/**
|
|
* @param int $new
|
|
*/
|
|
public function setNew(int $new): void
|
|
{
|
|
if ($new !== 1) {
|
|
$this->new = $new;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param string $city
|
|
*/
|
|
public function setCity(string $city): void
|
|
{
|
|
$this->city = $city;
|
|
}
|
|
|
|
/**
|
|
* @param int $room
|
|
*/
|
|
public function setRoom(int $room): void
|
|
{
|
|
$this->room = $room;
|
|
}
|
|
|
|
/**
|
|
* @param string $login
|
|
*/
|
|
public function setLogin(string $login): void
|
|
{
|
|
$this->login = $login;
|
|
}
|
|
|
|
/**
|
|
* @param string $to
|
|
*/
|
|
public function setTo(string $to): void
|
|
{
|
|
$this->to = $to;
|
|
}
|
|
|
|
/**
|
|
* @param string $text
|
|
*/
|
|
public function setText(string $text): void
|
|
{
|
|
$this->text = $text;
|
|
}
|
|
|
|
/**
|
|
* @param int $time
|
|
*/
|
|
public function setTime(int $time): void
|
|
{
|
|
$this->time = $time;
|
|
}
|
|
|
|
/**
|
|
* @param int $type
|
|
*/
|
|
public function setType(int $type): void
|
|
{
|
|
$this->type = $type;
|
|
}
|
|
|
|
/**
|
|
* @param int $toChat
|
|
*/
|
|
public function setToChat(int $toChat): void
|
|
{
|
|
$this->toChat = $toChat;
|
|
}
|
|
|
|
/**
|
|
* @param int $typeTime
|
|
*/
|
|
public function setTypeTime(int $typeTime): void
|
|
{
|
|
$this->typeTime = $typeTime;
|
|
}
|
|
|
|
/**
|
|
* @param string $color
|
|
*/
|
|
public function setColor(string $color): void
|
|
{
|
|
$this->color = $color;
|
|
}
|
|
|
|
/**
|
|
* Äîáàâëÿåò ê ñîîáùåíèþ êðàñíûé ïðåôèêñ "Âíèìàíèå!".
|
|
* @param bool $isAlert
|
|
*/
|
|
public function setIsAlert(bool $isAlert): void
|
|
{
|
|
$this->isAlert = $isAlert;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getFireworks(): ?string
|
|
{
|
|
return $this->fireworks;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $fireworks
|
|
*/
|
|
public function setFireworks(?string $fireworks): void
|
|
{
|
|
$this->fireworks = $fireworks;
|
|
}
|
|
|
|
/**
|
|
* Çàãëóøêà äëÿ îïöèîíàëüíîé ïåðåäà÷è ïàðàìåòðîâ.
|
|
* @param string $json
|
|
* @return void
|
|
*/
|
|
public function setParamsFromJson(string $json): void
|
|
{
|
|
$params = json_decode($json, true);
|
|
foreach ($params as $param => $value) {
|
|
if (property_exists($this, $param)) {
|
|
$this->$param = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|