Много рефактора
This commit is contained in:
@@ -10,7 +10,7 @@ use User;
|
||||
|
||||
class ModFactory
|
||||
{
|
||||
private const ERROR_WRONG_DURATION = 'Íåâåðíî óêàçàí ñðîê íàêàçàíèÿ';
|
||||
private const ERROR_WRONG_DURATION = 'Неверно указан срок наказания';
|
||||
public readonly string $status;
|
||||
private DateTime $time;
|
||||
private ChatMessage $msg;
|
||||
@@ -21,12 +21,12 @@ class ModFactory
|
||||
public function __construct(
|
||||
private readonly string $targetLogin,
|
||||
private readonly string $reason,
|
||||
int $moderatorsRoom // Êîìíàòà ãäå ñèäèò ìîäåðàòîð.
|
||||
int $moderatorsRoom // Комната где сидит модератор.
|
||||
)
|
||||
{
|
||||
$this->targetUser = User::getInfo($this->targetLogin);
|
||||
if (empty($this->targetUser)) {
|
||||
$this->status = 'Ïåðñîíàæ íå íàéäåí!';
|
||||
$this->status = 'Персонаж не найден!';
|
||||
return;
|
||||
}
|
||||
$this->chat = new Chat();
|
||||
@@ -46,7 +46,7 @@ class ModFactory
|
||||
}
|
||||
$this->time->modify("+ $minutes minute");
|
||||
$this->moderation->silence($this->time, $this->reason);
|
||||
$this->status = "Ïåðñîíàæó $this->targetLogin çàïðåùåíî îáùàòüñÿ â ÷àòå äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
|
||||
$this->status = "Персонажу $this->targetLogin запрещено общаться в чате до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
|
||||
$this->msg->setText("[img[items/silence.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -54,11 +54,11 @@ class ModFactory
|
||||
public function unsilence(): void
|
||||
{
|
||||
if ($this->targetUser['molch1'] < $this->time->getTimestamp()) {
|
||||
$this->status = 'Ïåðñîíàæ íå ìîë÷èò!';
|
||||
$this->status = 'Персонаж не молчит!';
|
||||
return;
|
||||
}
|
||||
$this->moderation->unsilence();
|
||||
$this->status = "Ñ ïåðñîíàæà $this->targetLogin ñíÿò çàïðåò íà îáùåíèå â ÷àòå.";
|
||||
$this->status = "С персонажа $this->targetLogin снят запрет на общение в чате.";
|
||||
$this->msg->setText("[img[items/pal_button3.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -71,8 +71,8 @@ class ModFactory
|
||||
}
|
||||
$this->time->modify("+ $days day");
|
||||
$this->moderation->prison($this->time, $this->reason);
|
||||
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin áûë îòïðàâëåí â òþðüìó äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
|
||||
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
|
||||
$this->status = "Персонаж $this->targetLogin был отправлен в тюрьму до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
|
||||
$this->msg->setText("[img[items/jail.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class ModFactory
|
||||
public function unprison(): void
|
||||
{
|
||||
$this->moderation->unprison();
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin áûë âûïóùåí èç òþðüìû.";
|
||||
$this->status = "Персонаж $this->targetLogin был выпущен из тюрьмы.";
|
||||
$this->msg->setText("[img[items/jail_off.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -92,12 +92,12 @@ class ModFactory
|
||||
return;
|
||||
}
|
||||
if ($this->targetUser['info_delete'] === 1 || $this->targetUser['info_delete'] >= $this->time->getTimestamp()) {
|
||||
$this->status = 'Ïåðñîíàæ óæå ïîä ïîäîçðåíèåì.';
|
||||
$this->status = 'Персонаж уже под подозрением.';
|
||||
return;
|
||||
}
|
||||
$this->time->modify("+ $days day");
|
||||
$this->moderation->depersonalize($this->time, $this->reason);
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin ïîä ïîäîçðåíèåì äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
|
||||
$this->status = "Персонаж $this->targetLogin под подозрением до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
|
||||
$this->msg->setText("[img[items/cui.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -105,11 +105,11 @@ class ModFactory
|
||||
public function undepersonalize(): void
|
||||
{
|
||||
if ($this->targetUser['info_delete'] <= $this->time->getTimestamp()) {
|
||||
$this->status = 'Ïåðñîíàæ íå ïîä ïîäîçðåíèåì.';
|
||||
$this->status = 'Персонаж не под подозрением.';
|
||||
return;
|
||||
}
|
||||
$this->moderation->undepersonalize();
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin áîëüøå íå ïîä ïîäîçðåíèåì";
|
||||
$this->status = "Персонаж $this->targetLogin больше не под подозрением";
|
||||
$this->msg->setText("[img[items/uncui.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -119,15 +119,15 @@ class ModFactory
|
||||
$this->moderation->ban($this->reason);
|
||||
Db::sql('delete from chat where login = ?', [$this->targetLogin]);
|
||||
Db::sql('insert into ban_email (email, uid, nick_name) values (?,?,?)', [$this->targetUser['mail'], $this->targetUser['id'], $this->targetLogin]);
|
||||
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè íà áîé.
|
||||
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
|
||||
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Удаляем заявки на бой.
|
||||
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
|
||||
if (!empty($this->targetUser['battle'])) {
|
||||
Db::sql(
|
||||
'update users left join stats on users.id = stats.id set battle = default, regHP = unix_timestamp(), team = 0, battle_yron = 0, battle_exp = 0 where users.id = ?',
|
||||
[$this->targetUser['id']]
|
||||
);
|
||||
}
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin çàáëîêèðîâàí";
|
||||
$this->status = "Персонаж $this->targetLogin заблокирован";
|
||||
$this->msg->setText("[img[items/pal_button6.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
@@ -135,12 +135,12 @@ class ModFactory
|
||||
public function unban(): void
|
||||
{
|
||||
if (empty($this->targetUser['banned'])) {
|
||||
$this->status = 'Ïåðñîíàæ íå â áëîêå.';
|
||||
$this->status = 'Персонаж не в блоке.';
|
||||
return;
|
||||
}
|
||||
$this->moderation->unban();
|
||||
Db::sql('delete from ban_email where email = ?', [$this->targetUser['mail']]);
|
||||
$this->status = "Ïåðñîíàæ $this->targetLogin ðàçáëîêèðîâàí";
|
||||
$this->status = "Персонаж $this->targetLogin разблокирован";
|
||||
$this->msg->setText("[img[items/pal_button7.gif]] $this->status");
|
||||
$this->chat->sendMsg($this->msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user