Убрал send в чат из user::class. Убрал лишние вызовы.
This commit is contained in:
+63
-115
@@ -11198,61 +11198,6 @@ LIMIT 1'
|
||||
return $rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Уродец, дублирующий Chat то тут то там.
|
||||
* Сидишь, никого не трогаешь, правишь и вдруг класс User тебя с размаху мордой в грязь!
|
||||
* Привет пачка вызовов буквально отовсюду, потому что класс User это же так удобно, класс User он же везде...
|
||||
* @param string $color
|
||||
* @param int $room
|
||||
* @param string $city
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param string $text
|
||||
* @param int $time
|
||||
* @param int $type
|
||||
* @param int $toChat
|
||||
* @param int $spam
|
||||
* @param int $sound
|
||||
* @param int $new
|
||||
* @param int $typeTime
|
||||
* @param int $global
|
||||
* @deprecated
|
||||
* @todo убрать нахуй заменив нативными вызовами.
|
||||
*/
|
||||
public function send(
|
||||
string $color,
|
||||
int $room,
|
||||
string $city,
|
||||
string $from,
|
||||
string $to,
|
||||
string $text,
|
||||
int $time,
|
||||
int $type,
|
||||
int $toChat,
|
||||
int $spam,
|
||||
int $sound,
|
||||
int $new = 1,
|
||||
int $typeTime = 0,
|
||||
int $global = 0
|
||||
) {
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setColor($color);
|
||||
$cmsg->setCity($city);
|
||||
$cmsg->setRoom($room);
|
||||
$cmsg->setLogin($from);
|
||||
$cmsg->setTo($to);
|
||||
$cmsg->setText($text);
|
||||
$cmsg->setTime($time);
|
||||
$cmsg->setType($type);
|
||||
$cmsg->setToChat($toChat);
|
||||
$cmsg->setSpam($spam);
|
||||
$cmsg->setSound($sound);
|
||||
$cmsg->setNew($new);
|
||||
$cmsg->setTypeTime($typeTime);
|
||||
$cmsg->setGlobal($global);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
}
|
||||
|
||||
//получаем уровень
|
||||
public function testLevel()
|
||||
{
|
||||
@@ -11322,6 +11267,12 @@ LIMIT 1'
|
||||
}
|
||||
$i = 0;
|
||||
$ult = 0;
|
||||
|
||||
$sex1 = '';
|
||||
if ($this->info['sex'] == 1) {
|
||||
$sex1 = 'ла';
|
||||
}
|
||||
|
||||
while ($i != 1) {
|
||||
if (Config::get('nolevel') && $this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) {
|
||||
$tlus = mysql_fetch_array(
|
||||
@@ -11338,7 +11289,9 @@ LIMIT 1'
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) {
|
||||
if ($this->info['exp'] < $lvl['exp'] || !isset($lvln['upLevel'])) {
|
||||
$i = 1;
|
||||
} else {
|
||||
if ($lvl['nextLevel'] > $this->info['level']) {
|
||||
//повышаем выносливость
|
||||
$a4 = 1;
|
||||
@@ -11353,11 +11306,6 @@ LIMIT 1'
|
||||
}
|
||||
|
||||
$this->stats['s4'] += $a4;
|
||||
$sex1 = '';
|
||||
if ($this->info['sex'] == 1) {
|
||||
$sex1 = 'ла';
|
||||
}
|
||||
|
||||
$ult = 1;
|
||||
|
||||
//Рефералы
|
||||
@@ -11404,6 +11352,12 @@ LIMIT 1'
|
||||
}
|
||||
}
|
||||
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setRoom($this->info['room']);
|
||||
$cmsg->setCity($this->info['city']);
|
||||
$cmsg->setTo($rlog['login']);
|
||||
$cmsg->setType(6);
|
||||
|
||||
if (($rtg || !isset($mtest['id'])) && isset($rlog['id'])) {
|
||||
$rfs['data'] = explode('|', $rlogs['ref_data']);
|
||||
$ekr = '0.00';
|
||||
@@ -11420,23 +11374,22 @@ LIMIT 1'
|
||||
$rlog['id']
|
||||
) . '" LIMIT 1'
|
||||
);
|
||||
|
||||
if ($up) {
|
||||
//Реферал 1-го уровня
|
||||
$krtxt = '';
|
||||
if ($kr > 0) {
|
||||
$krtxt .= '' . $kr . ' КР';
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= ', ';
|
||||
}
|
||||
$krtxt .= "$kr КР";
|
||||
}
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= '' . $ekr . ' ЕКР';
|
||||
$krtxt .= ", $ekr ЕКР";
|
||||
}
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', $rlog['login'],
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt,
|
||||
-1, 6, 0, 0, 0, 1
|
||||
|
||||
$cmsg->setText(
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
|
||||
);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
|
||||
$rlog['catch'] += $bn['add_bank'];
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
|
||||
@@ -11455,20 +11408,17 @@ LIMIT 1'
|
||||
if (isset($rlog['id'])) {
|
||||
$krtxt = '';
|
||||
if ($kr > 0) {
|
||||
$krtxt .= '' . $kr . ' КР';
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= ', ';
|
||||
}
|
||||
$krtxt .= "$kr КР";
|
||||
}
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= '' . $ekr . ' ЕКР';
|
||||
$krtxt .= ", $ekr ЕКР";
|
||||
}
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '',
|
||||
$rlog['login'],
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (2-го уровня от "' . $llogin . '" ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt,
|
||||
-1, 6, 0, 0, 0, 1
|
||||
|
||||
$cmsg->setText(
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (2-го уровня от "' . $llogin . '" ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
|
||||
);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
|
||||
$rlog['catch'] += $bn['add_bank'];
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
|
||||
@@ -11487,20 +11437,17 @@ LIMIT 1'
|
||||
if (isset($rlog['id'])) {
|
||||
$krtxt = '';
|
||||
if ($kr > 0) {
|
||||
$krtxt .= '' . $kr . ' КР';
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= ', ';
|
||||
}
|
||||
$krtxt .= "$kr КР";
|
||||
}
|
||||
if ($ekr > 0) {
|
||||
$krtxt .= '' . $ekr . ' ЕКР';
|
||||
$krtxt .= ", $ekr ЕКР";
|
||||
}
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '',
|
||||
$rlog['login'],
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (3-го уровня от "' . $llogin2 . '" (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt,
|
||||
-1, 6, 0, 0, 0, 1
|
||||
|
||||
$cmsg->setText(
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (3-го уровня от "' . $llogin2 . '" (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
|
||||
);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
|
||||
$rlog['catch'] += $bn['add_bank'];
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
|
||||
@@ -11512,11 +11459,10 @@ LIMIT 1'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', $rlog['login'],
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.',
|
||||
-1, 6, 0, 0, 0, 1
|
||||
$cmsg->setText(
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.'
|
||||
);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -11527,11 +11473,10 @@ LIMIT 1'
|
||||
);
|
||||
//
|
||||
} elseif (isset($rlog['id'])) {
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', $rlog['login'],
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! <small><font color=red>(Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)</font></small>',
|
||||
-1, 6, 0, 0, 0, 1
|
||||
$cmsg->setText(
|
||||
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! <small style="color: red">(Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)</small>'
|
||||
);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11559,27 +11504,28 @@ LIMIT 1'
|
||||
);
|
||||
$this->info['upLevel'] += 1;
|
||||
$rt++;
|
||||
} else {
|
||||
$i = 1;
|
||||
}
|
||||
}
|
||||
if ($ult == 1) {
|
||||
$chat = new Chat();
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setRoom($this->info['room']);
|
||||
$cmsg->setCity($this->info['city']);
|
||||
$cmsg->setType(6);
|
||||
|
||||
if ($this->info['level'] == 4 || $this->info['level'] == 8) {
|
||||
//Убрать задержки на пещеры
|
||||
mysql_query(
|
||||
'DELETE FROM `actions` WHERE `uid` = "' . $this->info['id'] . '" AND `vars` LIKE "psh%"'
|
||||
);
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', $this->info['login'],
|
||||
'Обязательно используйте свитки и эликсиры в своем инвентаре!!!!!!!!!!!!!!!.', -1, 6, 0, 0,
|
||||
0, 1
|
||||
);
|
||||
$cmsg->setTo($this->info['login']);
|
||||
$cmsg->setText('Обязательно используйте свитки и эликсиры в своем инвентаре!!!!!!!!!!!!!!!.');
|
||||
$chat->sendMsg($cmsg);
|
||||
}
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', '',
|
||||
'<strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!',
|
||||
time(), 6, 0, 0, 0, 1, 2
|
||||
); // Наверно тут
|
||||
|
||||
$cmsg->setTypeTime(2);
|
||||
$cmsg->setText('<strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!');
|
||||
$chat->sendMsg($cmsg);
|
||||
}
|
||||
if ($rt > 0) {
|
||||
$this->info['stopexp'] = 0;
|
||||
@@ -11650,11 +11596,13 @@ LIMIT 1'
|
||||
)
|
||||
);
|
||||
$a['stats'] = $a['stats']['stats'];
|
||||
$this->send(
|
||||
'', $this->info['room'], $this->info['city'], '', $this->info['login'],
|
||||
'<strong>' . $a['name'] . '</strong> достиг ' . $a['level'] . ' уровня!', time(), 6, 0,
|
||||
0, 0, 1
|
||||
);
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setRoom($this->info['room']);
|
||||
$cmsg->setCity($this->info['city']);
|
||||
$cmsg->setTo($this->info['login']);
|
||||
$cmsg->setText('<strong>' . $a['name'] . '</strong> достиг ' . $a['level'] . ' уровня!');
|
||||
$cmsg->setType(6);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
mysql_query(
|
||||
'UPDATE `users_animal` SET `stats` = "' . $a['stats'] . '",`level`="' . $a['level'] . '",`max_exp`="' . $a['max_exp'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user