From 00c76de9d5c85fdd1ef28206b71693e6b3a4de54 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Wed, 1 Feb 2023 12:14:21 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9E=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F=20time(-1)=20=3D=20time().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/ChatMessage.php | 5 +++-- _incl_data/class/GameDealer.php | 1 - _incl_data/class/Quests.php | 2 -- _incl_data/class/magic/off_hpVinos.php | 1 - interrpaykassa.php | 2 -- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/_incl_data/class/ChatMessage.php b/_incl_data/class/ChatMessage.php index f912d33e..d1214b0f 100644 --- a/_incl_data/class/ChatMessage.php +++ b/_incl_data/class/ChatMessage.php @@ -395,8 +395,9 @@ class ChatMessage { $params = json_decode($json, true); foreach ($params as $param => $value) { - if (property_exists($this, $param)) { - $this->$param = $value; + $method = 'set' . ucfirst($param); + if (method_exists(self::class, $method)) { + $this->$method($value); } } } diff --git a/_incl_data/class/GameDealer.php b/_incl_data/class/GameDealer.php index 97bd3765..b1363db6 100644 --- a/_incl_data/class/GameDealer.php +++ b/_incl_data/class/GameDealer.php @@ -211,7 +211,6 @@ class GameDealer $chatDto->setTo($user['login']); $chatDto->setText($r); $chatDto->setType(5); - $chatDto->setTime(-1); (new Chat())->sendMsg($chatDto); } else { $this->BACK = [['gdanswer', [['status', '-1'], ['desc', 'У пользователя отсутствует банк'], ['id', $this->c['id']]]]]; diff --git a/_incl_data/class/Quests.php b/_incl_data/class/Quests.php index 221876f8..a101fcb2 100644 --- a/_incl_data/class/Quests.php +++ b/_incl_data/class/Quests.php @@ -880,7 +880,6 @@ class Quests $chatDto->setTo($u->info['login']); $chatDto->setText($r); $chatDto->setType(5); - $chatDto->setTime(-1); (new Chat())->sendMsg($chatDto); return $r; @@ -1003,7 +1002,6 @@ class Quests $chatDto->setTo($u->info['login']); $chatDto->setText($r); $chatDto->setType(5); - $chatDto->setTime(-1); (new Chat())->sendMsg($chatDto); } } diff --git a/_incl_data/class/magic/off_hpVinos.php b/_incl_data/class/magic/off_hpVinos.php index 253b57f4..68dba5d8 100644 --- a/_incl_data/class/magic/off_hpVinos.php +++ b/_incl_data/class/magic/off_hpVinos.php @@ -41,7 +41,6 @@ if ($u->info['login'] == $usr['login']) { $chatDto->setTo($usr['login']); $chatDto->setText("Персонаж {$u->info['login']} украл у вас эффект {$eff['name']}."); $chatDto->setType(6); - $chatDto->setTime(-1); (new Chat())->sendMsg($chatDto); $chatDto = new ChatMessage(); diff --git a/interrpaykassa.php b/interrpaykassa.php index a2b9bbad..dbee3665 100644 --- a/interrpaykassa.php +++ b/interrpaykassa.php @@ -76,7 +76,6 @@ if ($needle == $sign) { $chatDto->setRoom($user['room']); $chatDto->setTo($user['login']); $chatDto->setText($r); - $chatDto->setTime(-1); $chatDto->setType(5); (new Chat())->sendMsg($chatDto); @@ -103,7 +102,6 @@ if ($needle == $sign) { $chatDto->setRoom($referal['room']); $chatDto->setTo($referal['login']); $chatDto->setText($r); - $chatDto->setTime(-1); $chatDto->setType(5); (new Chat())->sendMsg($chatDto); } From a9dc9af61e1021edc2e7470dab2fb31b72ca11a0 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Wed, 1 Feb 2023 12:21:36 +0200 Subject: [PATCH 2/3] =?UTF-8?q?$nosee=20=D0=B2=D1=81=D0=B5=D0=B3=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=B5=D1=84=D0=BE=D0=BB=D1=82=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/Chat.php | 2 -- _incl_data/class/ChatMessage.php | 29 ++++++----------------------- online.php | 15 +-------------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/_incl_data/class/Chat.php b/_incl_data/class/Chat.php index bc76e54f..97b021da 100644 --- a/_incl_data/class/Chat.php +++ b/_incl_data/class/Chat.php @@ -115,7 +115,6 @@ class Chat `delete`, global, molch, - nosee, typeTime, dn, frv @@ -138,7 +137,6 @@ class Chat $chatMessage->getDelete(), $chatMessage->getGlobal(), $chatMessage->getMolch(), - $chatMessage->getNosee(), $chatMessage->getTypeTime(), $chatMessage->getDn(), $chatMessage->getFireworks(), diff --git a/_incl_data/class/ChatMessage.php b/_incl_data/class/ChatMessage.php index d1214b0f..ebd52b86 100644 --- a/_incl_data/class/ChatMessage.php +++ b/_incl_data/class/ChatMessage.php @@ -1,7 +1,7 @@ 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 */ @@ -224,7 +207,7 @@ class ChatMessage public function getText(): string { if ($this->isAlert) { - return '! ' . $this->text; + return 'Внимание! ' . $this->text; } return $this->text; } @@ -362,7 +345,7 @@ class ChatMessage } /** - * "!". + * Добавляет к сообщению красный префикс "Внимание!". * @param bool $isAlert */ public function setIsAlert(bool $isAlert): void @@ -387,7 +370,7 @@ class ChatMessage } /** - * . + * Заглушка для опциональной передачи параметров. * @param string $json * @return void */ diff --git a/online.php b/online.php index cd49a18a..7e6336ff 100644 --- a/online.php +++ b/online.php @@ -415,10 +415,8 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { ); } } - unset($admq); - } else { - unset($admq); } + unset($admq); } $qix = mysql_fetch_array( @@ -509,19 +507,8 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $i++; } - $msg['nosee'] = 0; - - if ($u->info['level'] < 1) { - $msg['nosee'] = round($u->info['host_reg']); - if ($msg['nosee'] == 0) { - $msg['nosee'] = -1; - $r['js'] .= 'chat.sendMsg(["new","' . time( - ) . '","6","","' . $u->info['login'] . '","В целях борьбы против рекламы, общение в чате доступно с 8-го уровня. ","red","1","1","0"]);'; - } - } //todo: внимательно перебрать логику, возможно есть ненужные\дефолтные поля. $cmsg = new ChatMessage(); - $cmsg->setNosee($msg['nosee']); $cmsg->setInvis($u->info['invis']); $cmsg->setDa($msg['da']); $cmsg->setDelete($msg['delete']); From 253a8dca6355e295fbb13c0b46e499d056e60ab3 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Thu, 2 Feb 2023 17:39:42 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20send=20?= =?UTF-8?q?=D0=B2=20=D1=87=D0=B0=D1=82=20=D0=B8=D0=B7=20user::class.=20?= =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/Battle.php | 12 +- _incl_data/class/Chat.php | 6 +- _incl_data/class/ChatMessage.php | 53 --- _incl_data/class/Magic.php | 11 +- _incl_data/class/User.php | 178 +++----- _incl_data/class/dnaction/106/door3.php | 114 ++--- modules_data/_alhp.php | 12 +- modules_data/location/an/bk.php | 459 ++++++++++++-------- modules_data/location/dungeons/building.php | 339 +++++++++------ online.php | 24 +- 10 files changed, 622 insertions(+), 586 deletions(-) diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index b32e7f55..9177972a 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -3728,11 +3728,13 @@ class Battle ); if (isset($a['id'])) { if ($a['eda'] < 1) { - $u->send( - '', $this->users[$i]['room'], $this->users[$i]['city'], '', - $this->users[$i]['login'], '' . $a['name'] . ' нуждается в еде...', - time(), 6, 0, 0, 0, 1 - ); + $cmsg = new ChatMessage(); + $cmsg->setRoom($this->users[$i]['room']); + $cmsg->setCity($this->users[$i]['city']); + $cmsg->setTo($this->users[$i]['login']); + $cmsg->setText('' . $a['name'] . ' нуждается в еде...'); + $cmsg->setType(6); + $chat->sendMsg($cmsg); } } } diff --git a/_incl_data/class/Chat.php b/_incl_data/class/Chat.php index 97b021da..7fc2a41e 100644 --- a/_incl_data/class/Chat.php +++ b/_incl_data/class/Chat.php @@ -108,19 +108,17 @@ class Chat text, time, type, - toChat, spam, invis, da, `delete`, - global, molch, typeTime, dn, frv ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; $args = [ - $chatMessage->getNew(), + 1, $chatMessage->getSound(), $chatMessage->getColor(), $chatMessage->getCity(), @@ -130,12 +128,10 @@ class Chat $chatMessage->getText(), $chatMessage->getTime(), $chatMessage->getType(), - $chatMessage->getToChat(), $chatMessage->getSpam(), $chatMessage->getInvis(), $chatMessage->getDa(), $chatMessage->getDelete(), - $chatMessage->getGlobal(), $chatMessage->getMolch(), $chatMessage->getTypeTime(), $chatMessage->getDn(), diff --git a/_incl_data/class/ChatMessage.php b/_incl_data/class/ChatMessage.php index ebd52b86..28db9079 100644 --- a/_incl_data/class/ChatMessage.php +++ b/_incl_data/class/ChatMessage.php @@ -5,7 +5,6 @@ class ChatMessage { - private int $new = 1; private string $city = 'capitalcity'; private int $room = 0; private string $login = ''; @@ -13,7 +12,6 @@ class ChatMessage 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; @@ -23,7 +21,6 @@ class ChatMessage private int $da = 0; private int $delete = 0; private int $molch = 0; - private int $global = 0; private int $dn = 0; /** * Феерверки, чёрт подери! @@ -48,22 +45,6 @@ class ChatMessage $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 */ @@ -161,14 +142,6 @@ class ChatMessage $this->sound = $sound; } - /** - * @return int - */ - public function getNew(): int - { - return $this->new; - } - /** * @return string */ @@ -231,14 +204,6 @@ class ChatMessage return $this->type; } - /** - * @return int - */ - public function getToChat(): int - { - return $this->toChat; - } - /** * @return int */ @@ -254,16 +219,6 @@ class ChatMessage return $this->color; } - /** - * @param int $new - */ - public function setNew(int $new): void - { - if ($new !== 1) { - $this->new = $new; - } - } - /** * @param string $city */ @@ -320,14 +275,6 @@ class ChatMessage $this->type = $type; } - /** - * @param int $toChat - */ - public function setToChat(int $toChat): void - { - $this->toChat = $toChat; - } - /** * @param int $typeTime */ diff --git a/_incl_data/class/Magic.php b/_incl_data/class/Magic.php index 9dab5045..f619a885 100644 --- a/_incl_data/class/Magic.php +++ b/_incl_data/class/Magic.php @@ -2506,10 +2506,13 @@ class Magic } } else { - $u->send( - '', $u->info['room'], $u->info['city'], '', $u->info['login'], - '' . $a['name'] . ' нуждается в еде...', time(), 6, 0, 0, 0, 1 - ); + $cmsg = new ChatMessage(); + $cmsg->setRoom($u->info['room']); + $cmsg->setCity($u->info['city']); + $cmsg->setTo($u->info['login']); + $cmsg->setText('' . $a['name'] . ' нуждается в еде...'); + $cmsg->setType(6); + (new Chat())->sendMsg($cmsg); } } } diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index 98f05886..45fcb7f5 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -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'], - 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, - -1, 6, 0, 0, 0, 1 + + $cmsg->setText( + 'Ваш реферал ' . $this->info['login'] . ' достиг' . $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'], - 'Ваш реферал ' . $this->info['login'] . ' (2-го уровня от "' . $llogin . '" ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, - -1, 6, 0, 0, 0, 1 + + $cmsg->setText( + 'Ваш реферал ' . $this->info['login'] . ' (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'], - 'Ваш реферал ' . $this->info['login'] . ' (3-го уровня от "' . $llogin2 . '" (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt, - -1, 6, 0, 0, 0, 1 + + $cmsg->setText( + 'Ваш реферал ' . $this->info['login'] . ' (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'], - 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.', - -1, 6, 0, 0, 0, 1 + $cmsg->setText( + 'Ваш реферал ' . $this->info['login'] . ' достиг' . $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'], - 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)', - -1, 6, 0, 0, 0, 1 + $cmsg->setText( + 'Ваш реферал ' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)' ); + (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'], '', '', - '' . $this->info['login'] . ' достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!', - time(), 6, 0, 0, 0, 1, 2 - ); // Наверно тут + + $cmsg->setTypeTime(2); + $cmsg->setText('' . $this->info['login'] . ' достиг' . $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'], - '' . $a['name'] . ' достиг ' . $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('' . $a['name'] . ' достиг ' . $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' ); diff --git a/_incl_data/class/dnaction/106/door3.php b/_incl_data/class/dnaction/106/door3.php index 82b508fd..9cf24c48 100644 --- a/_incl_data/class/dnaction/106/door3.php +++ b/_incl_data/class/dnaction/106/door3.php @@ -1,51 +1,65 @@ - true - ); - - if( $vad['go'] == true ) { - mysql_query('INSERT INTO `dungeon_actions` (`dn`,`time`,`x`,`y`,`uid`,`vars`,`vals`) VALUES ( - "'.$u->info['dnow'].'","'.time().'","'.$obj['x'].'","'.$obj['y'].'","'.$u->info['id'].'","obj_act'.$obj['id'].'","'.$vad['bad'].'" - )'); - $vad['qst'] = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "'.$u->info['id'].'" AND `var` = "noobqst1" AND `val` = 1 LIMIT 1')); - - $vad['itm'] = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = 724 OR `item_id` = 4704) LIMIT 1')); - - if(!isset($vad['qst']['id']) || !isset($vad['itm']['id'])) { - $r = 'Дверь закрыта. Сначала выполните задания Учителя и купите Футболку с Эликсиром.'; - }else{ - //Начало обучения - $humor = array( - 0 => array( - ':maniac: Сильно не бейте ;)',':beggar: Будет попрошайничать - бейте!',':pal: Возможно светлый!', - ':vamp: Возможно темный!',':susel: Судя по здоровенному бицепсу - это мужик!',':duel: И сразу же кинулся в бой!', - ':friday: Не долго думав он начал искать собутыльника!',':doc: Лекарь: Новичок! Да, да! Ты! Если тебя сломают - у знахаря тебя соберут обратно!' - ), - 1 => array( - ':maniac: Помните! Девочек не бьем ;)',':nail: Она красит ногти, не отвлекайте все сразу ;)',':pal: Возможно светлая!', - ':vamp: Возможно темная!',':rev: Судя по красивой одежде - это женщина!',':hug: И сразу же кинулась всех целовать!', - ':angel2: Ангел сошел с небес...' - ) - ); - $humor = $humor[$u->info['sex']]; - //$u->info['fnq'] = 1; - //mysql_query('UPDATE `users` SET `fnq` = "'.$u->info['fnq'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Отправляем сообщение в чат о новичке - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = 4703'); - mysql_query('UPDATE `users` SET `room` = 4 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = 1000,`mpNow` = 1000,`dn` = 0 , `dnow` = 0 , `x` = 0 , `y` = 0 , `s` = 0 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->send('','','','','','В нашем мире появился новый игрок "' . $u->info['login'] . '"! '.$humor[rand(0,count($humor)-1)].'',time(),6,0,0,0,1,0); - //mysql_query('UPDATE `stats` SET `x` = 0,`y` = 5 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - header('location: main.php'); - die(); - } - } - - unset($vad); + true, + ]; + + mysql_query( + 'INSERT INTO `dungeon_actions` (`dn`,`time`,`x`,`y`,`uid`,`vars`,`vals`) VALUES ( + "' . $u->info['dnow'] . '","' . time( + ) . '","' . $obj['x'] . '","' . $obj['y'] . '","' . $u->info['id'] . '","obj_act' . $obj['id'] . '","' . $vad['bad'] . '" + )' + ); + $vad['qst'] = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `var` = "noobqst1" AND `val` = 1 LIMIT 1' + ) + ); + + $vad['itm'] = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = 724 OR `item_id` = 4704) LIMIT 1' + ) + ); + + if (!isset($vad['qst']['id']) || !isset($vad['itm']['id'])) { + $r = 'Дверь закрыта. Сначала выполните задания Учителя и купите Футболку с Эликсиром.'; + } else { + //Начало обучения + $humor = [ + 0 => [ + ':maniac: Сильно не бейте ;)', ':beggar: Будет попрошайничать - бейте!', ':pal: Возможно светлый!', + ':vamp: Возможно темный!', ':susel: Судя по здоровенному бицепсу - это мужик!', ':duel: И сразу же кинулся в бой!', + ':friday: Не долго думав он начал искать собутыльника!', ':doc: Лекарь: Новичок! Да, да! Ты! Если тебя сломают - у знахаря тебя соберут обратно!', + ], + 1 => [ + ':maniac: Помните! Девочек не бьем ;)', ':nail: Она красит ногти, не отвлекайте все сразу ;)', ':pal: Возможно светлая!', + ':vamp: Возможно темная!', ':rev: Судя по красивой одежде - это женщина!', ':hug: И сразу же кинулась всех целовать!', + ':angel2: Ангел сошел с небес...', + ], + ]; + $humor = $humor[$u->info['sex']]; + //Отправляем сообщение в чат о новичке + mysql_query( + 'UPDATE `items_users` SET `delete` = "' . time( + ) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = 4703' + ); + mysql_query('UPDATE `users` SET `room` = 4 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `stats` SET `hpNow` = 1000,`mpNow` = 1000,`dn` = 0 , `dnow` = 0 , `x` = 0 , `y` = 0 , `s` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + array_shift($humor); + $cmsg = new ChatMessage(); + $cmsg->setText('В нашем мире появился новый игрок "' . $u->info['login'] . '"! ' . $humor[0]); + $cmsg->setType(6); + (new Chat())->sendMsg($cmsg); + header('location: main.php'); + die(); + } + + unset($vad); } -?> \ No newline at end of file diff --git a/modules_data/_alhp.php b/modules_data/_alhp.php index 2d7a5421..a364eaf1 100644 --- a/modules_data/_alhp.php +++ b/modules_data/_alhp.php @@ -347,11 +347,13 @@ if (isset($_GET['usemod'])) { } } if (isset($_POST['tologin'], $_POST['message'])) { - $u->send( - '', 1, $infcity, '', htmlspecialchars($_POST['tologin'], null), - 'Сообщение телеграфом от ' . $u->info['login'] . ': ' . $_POST['message'] . '', - -1, 6, 0, 0, 0, 1 - ); + $cmsg = new ChatMessage(); + $cmsg->setRoom(1); + $cmsg->setCity($infcity); + $cmsg->setTo($_POST['tologin']); + $cmsg->setText('Сообщение телеграфом от ' . $u->info['login'] . ': ' . $_POST['message']); + $cmsg->setType(6); + (new Chat())->sendMsg($cmsg); } ?> diff --git a/modules_data/location/an/bk.php b/modules_data/location/an/bk.php index 47c10604..d4dde7a2 100644 --- a/modules_data/location/an/bk.php +++ b/modules_data/location/an/bk.php @@ -1,207 +1,284 @@ -room['file']=='an/bk'){ - - $tst = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "'.$u->info['id'].'" AND `var` = "noobqst1" LIMIT 1')); - if(!isset($tst['id'])) { - if(isset($_GET['noobgo'])) { - if($_GET['noobgo'] == 1) { - //Согласился (создаем пещеру и телепортируем туда - - $ins = mysql_query('INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`) - VALUES ("'.$u->info['city'].'","'.$u->info['id'].'","106","Академия Новичков","'.time().'")'); - if($ins){ - $zid = mysql_insert_id(); - //обновляем пользователей - $su = mysql_query('SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`id`="'.$u->info['id'].'"'); - $ids = ''; - - $map_locs = array(); - $spm2 = mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id_dng` = "106"'); - while( $plm2 = mysql_fetch_array( $spm2 ) ) { - $map_locs[] = array($plm2['x'],$plm2['y']); - } - unset( $spm2 , $plm2 ); - - $pxd = 0; - while( $pu = mysql_fetch_array($su) ) { - $pxd++; - $ids .= ' `id` = "'.$pu['id'].'" OR'; - } - $ids = rtrim($ids,'OR'); - $snew = 0; - $upd1 = mysql_query('UPDATE `stats` SET `s`="4",`res_s`="1",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "'.$zid.'" WHERE '.$ids.''); - if( $upd1 ){ - $upd2 = mysql_query('UPDATE `users` SET `room` = "391" WHERE '.$ids.''); - //Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id'] - //Добавляем ботов - $vls = ''; - $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "106"'); - while( $pl = mysql_fetch_array( $sp ) ) { - if( $pl['id_bot'] == 0 && $pl['bot_group'] !=''){ - $bots = explode( ',', $pl['bot_group'] ); - $pl['id_bot'] = (int)$bots[rand(0, count($bots)-1 )]; - } - if( $pl['id_bot'] > 0 )$vls .= '("'.$zid.'","'.$pl['id_bot'].'","'.$pl['colvo'].'","'.$pl['items'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['dialog'].'","'.$pl['items'].'","'.$pl['go_bot'].'","'.$pl['noatack'].'"),'; - unset($bots); - } - $vls = rtrim($vls,','); - $ins1 = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`,`noatack`) VALUES '.$vls.''); - //Добавляем обьекты - $vls = ''; - $sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "106"'); - while($pl = mysql_fetch_array($sp)) - { - $vls .= '("'.$zid.'","'.$pl['name'].'","'.$pl['img'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['action'].'","'.$pl['type'].'","'.$pl['w'].'","'.$pl['h'].'","'.$pl['s'].'","'.$pl['s2'].'","'.$pl['os1'].'","'.$pl['os2'].'","'.$pl['os3'].'","'.$pl['os4'].'","'.$pl['type2'].'","'.$pl['top'].'","'.$pl['left'].'","'.$pl['date'].'"),'; - } - // - $vls = rtrim($vls,','); - if( $vls != '' ) { - $ins2 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES '.$vls.''); - } else { - $ins2 = true; - } - if( $upd2 && $ins1 && $ins2 ){ - die(''); - } else { - $error = 'Ошибка перехода в подземелье...'; - } - } else { - $error = 'Ошибка перехода в подземелье...'; - } - } else { - $error = 'Ошибка перехода в подземелье...'; - } - // - //header('location: main.php'); - die(); - }else{ - //Отказался (добавляем квест, системку и пошел нах) - mysql_query('INSERT INTO `dialog_act` ( +if ($u->room['file'] == 'an/bk') { + + $tst = mysql_fetch_array( + mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `var` = "noobqst1" LIMIT 1') + ); + if (!isset($tst['id'])) { + if (isset($_GET['noobgo'])) { + if ($_GET['noobgo'] == 1) { + //Согласился (создаем пещеру и телепортируем туда + + $ins = mysql_query( + 'INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`) + VALUES ("' . $u->info['city'] . '","' . $u->info['id'] . '","106","Академия Новичков","' . time() . '")' + ); + if ($ins) { + $zid = mysql_insert_id(); + //обновляем пользователей + $su = mysql_query( + 'SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`id`="' . $u->info['id'] . '"' + ); + $ids = ''; + + $map_locs = []; + $spm2 = mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id_dng` = "106"'); + while ($plm2 = mysql_fetch_array($spm2)) { + $map_locs[] = [$plm2['x'], $plm2['y']]; + } + unset($spm2, $plm2); + + $pxd = 0; + while ($pu = mysql_fetch_array($su)) { + $pxd++; + $ids .= ' `id` = "' . $pu['id'] . '" OR'; + } + $ids = rtrim($ids, 'OR'); + $snew = 0; + $upd1 = mysql_query( + 'UPDATE `stats` SET `s`="4",`res_s`="1",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "' . $zid . '" WHERE ' . $ids . '' + ); + if ($upd1) { + $upd2 = mysql_query('UPDATE `users` SET `room` = "391" WHERE ' . $ids . ''); + //Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id'] + //Добавляем ботов + $vls = ''; + $sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "106"'); + while ($pl = mysql_fetch_array($sp)) { + if ($pl['id_bot'] == 0 && $pl['bot_group'] != '') { + $bots = explode(',', $pl['bot_group']); + $pl['id_bot'] = (int)$bots[rand(0, count($bots) - 1)]; + } + if ($pl['id_bot'] > 0) { + $vls .= '("' . $zid . '","' . $pl['id_bot'] . '","' . $pl['colvo'] . '","' . $pl['items'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['dialog'] . '","' . $pl['items'] . '","' . $pl['go_bot'] . '","' . $pl['noatack'] . '"),'; + } + unset($bots); + } + $vls = rtrim($vls, ','); + $ins1 = mysql_query( + 'INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`,`noatack`) VALUES ' . $vls . '' + ); + //Добавляем обьекты + $vls = ''; + $sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "106"'); + while ($pl = mysql_fetch_array($sp)) { + $vls .= '("' . $zid . '","' . $pl['name'] . '","' . $pl['img'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['action'] . '","' . $pl['type'] . '","' . $pl['w'] . '","' . $pl['h'] . '","' . $pl['s'] . '","' . $pl['s2'] . '","' . $pl['os1'] . '","' . $pl['os2'] . '","' . $pl['os3'] . '","' . $pl['os4'] . '","' . $pl['type2'] . '","' . $pl['top'] . '","' . $pl['left'] . '","' . $pl['date'] . '"),'; + } + // + $vls = rtrim($vls, ','); + if ($vls != '') { + $ins2 = mysql_query( + 'INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES ' . $vls . '' + ); + } else { + $ins2 = true; + } + if ($upd2 && $ins1 && $ins2) { + die(''); + } else { + $error = 'Ошибка перехода в подземелье...'; + } + } else { + $error = 'Ошибка перехода в подземелье...'; + } + } else { + $error = 'Ошибка перехода в подземелье...'; + } + // + //header('location: main.php'); + die(); + } else { + //Отказался (добавляем квест, системку и пошел нах) + mysql_query( + 'INSERT INTO `dialog_act` ( `uid`,`var`,`time` ) VALUES ( - "'.$u->info['id'].'","noobqst1","'.time().'" - )'); - - //Начало обучения - $humor = array( - 0 => array( - ':maniac: Сильно не бейте ;)',':beggar: Будет попрошайничать - бейте!',':pal: Возможно светлый!', - ':vamp: Возможно темный!',':susel: Судя по здоровенному бицепсу - это мужик!',':duel: И сразу же кинулся в бой!', - ':friday: Не долго думав он начал искать собутыльника!',':doc: Лекарь: Новичок! Да, да! Ты! Если тебя сломают - у знахаря тебя соберут обратно!' - ), - 1 => array( - ':maniac: Помните! Девочек не бьем ;)',':nail: Она красит ногти, не отвлекайте все сразу ;)',':pal: Возможно светлая!', - ':vamp: Возможно темная!',':rev: Судя по красивой одежде - это женщина!',':hug: И сразу же кинулась всех целовать!', - ':angel2: Ангел сошел с небес...' - ) - ); - $humor = $humor[$u->info['sex']]; - //$u->info['fnq'] = 1; - //mysql_query('UPDATE `users` SET `fnq` = "'.$u->info['fnq'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //Отправляем сообщение в чат о новичке - //mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = 4703'); - //mysql_query('UPDATE `users` SET `room` = 4 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - //mysql_query('UPDATE `stats` SET `hpNow` = 1000,`mpNow` = 1000,`dn` = 0 , `dnow` = 0 , `x` = 0 , `y` = 0 , `s` = 0 WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - $u->send('','','','','','В нашем мире появился новый игрок "' . $u->info['login'] . '"! '.$humor[rand(0,count($humor)-1)].'',time(),6,0,0,0,1,0); + "' . $u->info['id'] . '","noobqst1","' . time() . '" + )' + ); - echo '
Вы отказались от обучения, второй попытки больше не будет!
'; - } - }else{ - echo ''; - } - } + } + } - - -?> - -
- - - - '; + # Текущее состояние строительства. + foreach ($actions['resource'] as $key => $val) { + if ($count == 0) { + $current = mysql_fetch_assoc( + mysql_query( + 'SELECT im.`name`, im.`img` FROM `items_main` as im WHERE im.`id` = ' . $val['item'] . ' LIMIT 1' + ) + ); + $current['count'] = 0; + } else { + $current = mysql_fetch_assoc( + mysql_query( + 'SELECT SUM(b.`count`) as count, im.`name`, im.`img` FROM `items_main` as im LEFT JOIN `building` as `b` ON b.item_id = im.id + WHERE b.`building` = "' . $actions['ident'] . '" AND im.`id` = ' . $val['item'] . ' LIMIT 1' + ) + ); + } + if (isset($current) && $current['name'] != '') { + $actions['resource'][$key]['current'] = (int)$current['count']; + $actions['resource'][$key]['name'] = $current['name']; + $actions['resource'][$key]['img'] = $current['img']; + } else { + $actions['resource'][$key]['current'] = 0; + $actions['resource'][$key]['name'] = "Неизвестный предмет"; + $actions['resource'][$key]['img'] = ""; + } + } - -/* - *
- getInfoPers($u->info['id'],0); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } ?> -
- error!=''){ echo ''.$u->error.''; } ?> - - - - -
- '.$re.''; } ?> - - - -
-
- -
-
-
- + ?> + + + + + + + - + } else { + echo 'Возможно, вы ошиблись этажом - настоящие сражения проходят этажом выше.'; + } ?> + + + + +
+ getInfoPers($u->info['id'], 0); + if ($usee != false) { + echo $usee[0]; + } else { + echo 'information is lost.'; + } ?> + +
+ error != '') { + echo '' . $u->error . ''; + } ?> + + + + +
+ ' . $re . ''; + } ?> + + + - -
+ +
+ -
-
onClick="location='main.php?loc=2.180.0.240';" src="https://img.new-combats.com/i/images/300x225/map_klub1.gif" width="56" height="13" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.259';" src="https://img.new-combats.com/i/images/300x225/map_klub2.gif" width="58" height="49" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.229';" src="https://img.new-combats.com/i/images/300x225/map_klub3.gif" width="123" height="31" title="" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.231';" src="https://img.new-combats.com/i/images/300x225/map_klub4.gif" width="123" height="31" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.232';" src="https://img.new-combats.com/i/images/300x225/map_klub5.gif" width="123" height="30" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.233';" src="https://img.new-combats.com/i/images/300x225/map_klub6.gif" width="123" height="30" class="aFilter" />
-
onClick="location='main.php?loc=2.180.0.234';" src="https://img.new-combats.com/i/images/300x225/map_klub7.gif" width="103" height="47" class="aFilter" />
-
- -
- -
- -
«» приветствует Вас, info['login']; ?>.
- info['level']<6) - { - echo ' +
+ +
+
+
+ +
+
+ + +
+
+
+ + onClick="location='main.php?loc=2.180.0.240';" + src="https://img.new-combats.com/i/images/300x225/map_klub1.gif" + width="56" height="13" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.259';" + src="https://img.new-combats.com/i/images/300x225/map_klub2.gif" + width="58" height="49" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.229';" + src="https://img.new-combats.com/i/images/300x225/map_klub3.gif" + width="123" height="31" title="" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.231';" + src="https://img.new-combats.com/i/images/300x225/map_klub4.gif" + width="123" height="31" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.232';" + src="https://img.new-combats.com/i/images/300x225/map_klub5.gif" + width="123" height="30" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.233';" + src="https://img.new-combats.com/i/images/300x225/map_klub6.gif" + width="123" height="30" class="aFilter"/>
+
+ + onClick="location='main.php?loc=2.180.0.234';" + src="https://img.new-combats.com/i/images/300x225/map_klub7.gif" + width="103" height="47" class="aFilter"/>
+
+ +
+ +
+ +
+ «» приветствует Вас, + info['login']; ?>.
+ info['level'] < 6) { + echo ' Вам все время кажется что за вами следят? Чудится, что случайный попутчик мечтает всадить вам топор в спину? При совершении очередной покупки в гос. магазине мучает ощущение, что вас обманули? Кажется, что симпатичная девушка напротив смотрит на вас как на пищу? Успокойтесь, это не паранойя. Это реалии Capital city. Города Тьмы. '; - }else{ - echo 'Возможно, вы ошиблись этажом - настоящие сражения проходят этажом выше.'; - } ?> -
- -
+ +
+ testHome(); + if (!isset($hgo['id'])) { ?> + + +
+ Внимание! Никогда и никому не говорите пароль от своего персонажа. Не вводите + пароль на других сайтах, типа "новый город", "лотерея", "там, где все дают на халяву". Пароль не + нужен ни паладинам, ни кланам, ни администрации, только взломщикам для кражи вашего + героя.
+ Администрация.

+
+ +
+
- -
- testHome(); if(!isset($hgo['id'])){ ?> - - -
- Внимание! Никогда и никому не говорите пароль от своего персонажа. Не вводите пароль на других сайтах, типа "новый город", "лотерея", "там, где все дают на халяву". Пароль не нужен ни паладинам, ни кланам, ни администрации, только взломщикам для кражи вашего героя.
- Администрация.

-
- -
- + info['admin'] > 0 */ ) { - - $need_count = 0; - $actions = array(); - $resource = array(); - $action = explode('|',$file[1]); - foreach( $action as $value ) { - $temp = explode(':',$value); - $actions[$temp[0]]= $temp[1]; - } - if( isset($actions['resource']) ){ - $action = explode( ',',$actions['resource'] ); - foreach( $action as $value ) { - $temp = explode( 'x', $value ); - $resource[] = array( - 'item' => (int)$temp[0], - 'count' => (int)$temp[1] - ); - $need_count = $need_count+(int)$temp[1]; - } - } - $actions['resource'] = $resource; - unset($action, $temp, $value, $resource); - - # Обьекты для строительства - if(isset($_GET['buildend'])) { - //identid - $obj = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `id` = "'.mysql_real_escape_string($actions['identid']).'" LIMIT 1')); - $txt = ''; - if( !isset($obj['id']) ) { - $txt = 'Объект строительства был поврежден темной магией...'; - }else{ - if( $obj['x'] == $u->info['x'] && $obj['y'] == $u->info['y'] ) { - $txt = 'Объект уже был построен ранее! Вернитесь на клетку назад для использования объекта!'; - }else{ - mysql_query('UPDATE `dungeon_obj` SET `x` = "'.$u->info['x'].'", `y` = "'.$u->info['y'].'" WHERE `id` = "'.$obj['id'].'" LIMIT 1'); - mysql_query('UPDATE `dungeon_obj` SET `x` = "'.$u->info['x'].'", `y` = "'.$u->info['y'].'" WHERE `dn` > 0 AND `name` = "'.$obj['name'].'" AND `img` = "'.$obj['img'].'" AND `action` = "'.$obj['action'].'" AND `x` = "'.$obj['x'].'" AND `y` = "'.$obj['y'].'"'); - $txt = 'Строительство "'.$obj['name'].'" завершилось, вернитесь на клетку назад...'; - $u->send('','','','','','Игрок "' . $u->info['login'] . '" завершил строительство объекта "'.mysql_real_escape_string($actions['name']).'".',time(),6,0,0,0,1,0); - } - } - echo '
'.$txt.'
'; - } - - # пожертвование - if( isset($_POST['itemid'],$_POST['action']) ){ - $help = mysql_fetch_assoc(mysql_query('SELECT COUNT(`id`) as count, item_id FROM `items_users` WHERE `item_id` = '.$_POST['itemid'].' AND `uid` = '.$u->info['id'].' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 1')); - if($help){ - $item = mysql_fetch_assoc(mysql_query('SELECT im.`name`, im.`img` FROM `items_main` as im WHERE im.`id` = '.$help['item_id'].' LIMIT 1')); - if( isset($item) && $item['name'] != '' ) { - foreach( $actions['resource'] as $key=>$val) { - if($_POST['itemid'] == $val['item']){ - $current = mysql_fetch_assoc(mysql_query('SELECT SUM(b.`count`) as count, im.`name`, im.`img` FROM `items_main` as im LEFT JOIN `building` as `b` ON b.item_id = im.id WHERE b.`building` = "'.$actions['ident'].'" AND im.`id` = '.$val['item'].' LIMIT 1')); - if($current['count']==NULL) $current['count']=0; else $current['count']=(int)$current['count']; - if($current['count']+(int)$help['count'] <= $val['count']) { - # Если ваших ресурсов меньше чем требуется. - } else { - # Если ваших ресурсов больше чем требуется. - $help['count'] = +($val['count']-$current['count']); - } - if($help['count'] > 0) { - mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = '.$help['item_id'].' AND `uid` = '.$u->info['id'].' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" ORDER BY `delete` DESC LIMIT '.$help['count'].''); - mysql_query('INSERT INTO building (id, building, uid, clan_id, item_id, count) VALUES (NULL, "'.$actions['ident'].'", '.$u->info['id'].', '.$u->info['clan'].', '.$help['item_id'].', '.$help['count'] .')'); - $d->error = 'Вы пожертвовали на строительство ['.$item['name'].'] в количестве '.$help['count'].'шт.'; - } - } - } - # - # mysql_query('INSERT INTO `dungeon_actions` (`dn`,`time`,`x`,`y`,`uid`,`vars`,`vals`) VALUES ("'.$u->info['dnow'].'","'.time().'","'.$u->info['x'].'","'.$u->info['y'].'","'.$u->info['id'].'","building_resource","count_'.$help.'")'); - # - #("'.$u->info['dnow'].'","'.time().'","'.$u->info['x'].'","'.$u->info['y'].'","'.$u->info['id'].'","building_resource","count_'.$help.'")'); - } - } - } - unset($_POST,$help, $item); +if (isset($file) && $file[0] == 'dungeons/building.php' /* && $u->info['admin'] > 0 */) { - - # отображение - $count = mysql_fetch_array(mysql_query('SELECT SUM(count) as count FROM `building` WHERE `building` = "'.$actions['ident'].'" LIMIT 1')); - if( isset($count[0]) and $count[0]!=NULL ) $count = $count[0]; else $count = 0; - $r = ' + $need_count = 0; + $actions = []; + $resource = []; + $action = explode('|', $file[1]); + foreach ($action as $value) { + $temp = explode(':', $value); + $actions[$temp[0]] = $temp[1]; + } + if (isset($actions['resource'])) { + $action = explode(',', $actions['resource']); + foreach ($action as $value) { + $temp = explode('x', $value); + $resource[] = [ + 'item' => (int)$temp[0], + 'count' => (int)$temp[1], + ]; + $need_count = $need_count + (int)$temp[1]; + } + } + $actions['resource'] = $resource; + unset($action, $temp, $value, $resource); + + # Обьекты для строительства + if (isset($_GET['buildend'])) { + //identid + $obj = mysql_fetch_array( + mysql_query( + 'SELECT * FROM `dungeon_obj` WHERE `id` = "' . mysql_real_escape_string( + $actions['identid'] + ) . '" LIMIT 1' + ) + ); + $txt = ''; + if (!isset($obj['id'])) { + $txt = 'Объект строительства был поврежден темной магией...'; + } else { + if ($obj['x'] == $u->info['x'] && $obj['y'] == $u->info['y']) { + $txt = 'Объект уже был построен ранее! Вернитесь на клетку назад для использования объекта!'; + } else { + mysql_query( + 'UPDATE `dungeon_obj` SET `x` = "' . $u->info['x'] . '", `y` = "' . $u->info['y'] . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1' + ); + mysql_query( + 'UPDATE `dungeon_obj` SET `x` = "' . $u->info['x'] . '", `y` = "' . $u->info['y'] . '" WHERE `dn` > 0 AND `name` = "' . $obj['name'] . '" AND `img` = "' . $obj['img'] . '" AND `action` = "' . $obj['action'] . '" AND `x` = "' . $obj['x'] . '" AND `y` = "' . $obj['y'] . '"' + ); + $txt = 'Строительство "' . $obj['name'] . '" завершилось, вернитесь на клетку назад...'; + $cmsg = new ChatMessage(); + $cmsg->setText('Игрок "' . $u->info['login'] . '" завершил строительство объекта "' . mysql_real_escape_string($actions['name']) . '".'); + $cmsg->setType(6); + (new Chat())->sendMsg($cmsg); + } + } + echo '
' . $txt . '
'; + } + + # пожертвование + if (isset($_POST['itemid'], $_POST['action'])) { + $help = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) as count, item_id FROM `items_users` WHERE `item_id` = ' . $_POST['itemid'] . ' AND `uid` = ' . $u->info['id'] . ' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 1' + ) + ); + if ($help) { + $item = mysql_fetch_assoc( + mysql_query( + 'SELECT im.`name`, im.`img` FROM `items_main` as im WHERE im.`id` = ' . $help['item_id'] . ' LIMIT 1' + ) + ); + if (isset($item) && $item['name'] != '') { + foreach ($actions['resource'] as $key => $val) { + if ($_POST['itemid'] == $val['item']) { + $current = mysql_fetch_assoc( + mysql_query( + 'SELECT SUM(b.`count`) as count, im.`name`, im.`img` FROM `items_main` as im LEFT JOIN `building` as `b` ON b.item_id = im.id WHERE b.`building` = "' . $actions['ident'] . '" AND im.`id` = ' . $val['item'] . ' LIMIT 1' + ) + ); + if ($current['count'] == null) { + $current['count'] = 0; + } else { + $current['count'] = (int)$current['count']; + } + if ($current['count'] + (int)$help['count'] <= $val['count']) { + # Если ваших ресурсов меньше чем требуется. + } else { + # Если ваших ресурсов больше чем требуется. + $help['count'] = +($val['count'] - $current['count']); + } + if ($help['count'] > 0) { + mysql_query( + 'UPDATE `items_users` SET `delete` = "' . time( + ) . '" WHERE `item_id` = ' . $help['item_id'] . ' AND `uid` = ' . $u->info['id'] . ' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" ORDER BY `delete` DESC LIMIT ' . $help['count'] . '' + ); + mysql_query( + 'INSERT INTO building (id, building, uid, clan_id, item_id, count) VALUES (NULL, "' . $actions['ident'] . '", ' . $u->info['id'] . ', ' . $u->info['clan'] . ', ' . $help['item_id'] . ', ' . $help['count'] . ')' + ); + $d->error = 'Вы пожертвовали на строительство [' . $item['name'] . '] в количестве ' . $help['count'] . 'шт.'; + } + } + } + # + # mysql_query('INSERT INTO `dungeon_actions` (`dn`,`time`,`x`,`y`,`uid`,`vars`,`vals`) VALUES ("'.$u->info['dnow'].'","'.time().'","'.$u->info['x'].'","'.$u->info['y'].'","'.$u->info['id'].'","building_resource","count_'.$help.'")'); + # + #("'.$u->info['dnow'].'","'.time().'","'.$u->info['x'].'","'.$u->info['y'].'","'.$u->info['id'].'","building_resource","count_'.$help.'")'); + } + } + } + unset($_POST, $help, $item); + + + # отображение + $count = mysql_fetch_array( + mysql_query('SELECT SUM(count) as count FROM `building` WHERE `building` = "' . $actions['ident'] . '" LIMIT 1') + ); + if (isset($count[0]) and $count[0] != null) { + $count = $count[0]; + } else { + $count = 0; + } + $r = '
- '; - # Текущее состояние строительства. - foreach( $actions['resource'] as $key=>$val) { - if($count==0){ - $current = mysql_fetch_assoc(mysql_query('SELECT im.`name`, im.`img` FROM `items_main` as im WHERE im.`id` = '.$val['item'].' LIMIT 1')); - $current['count'] = 0; - } else { - $current = mysql_fetch_assoc(mysql_query('SELECT SUM(b.`count`) as count, im.`name`, im.`img` FROM `items_main` as im LEFT JOIN `building` as `b` ON b.item_id = im.id - WHERE b.`building` = "'.$actions['ident'].'" AND im.`id` = '.$val['item'].' LIMIT 1')); - } - if( isset($current) && $current['name'] != '' ) { - $actions['resource'][$key]['current'] = (int)$current['count']; - $actions['resource'][$key]['name'] = $current['name']; - $actions['resource'][$key]['img'] = $current['img']; - } else { - $actions['resource'][$key]['current'] = 0; - $actions['resource'][$key]['name'] = "Неизвестный предмет"; - $actions['resource'][$key]['img'] = ""; - } - } - - unset($key,$val,$current); - - foreach( $actions['resource'] as $row) { - $current_uid = mysql_fetch_assoc(mysql_query('SELECT COUNT(`id`) as count FROM `items_users` WHERE `item_id` = '.$row['item'].' AND `uid` = '.$u->info['id'].' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 1')); - if(isset($current_uid) && $current_uid['count'] == NULL) $current_uid['count'] = 0; // Сколько можем внести - - $r .= ''; - if($row['current'] >= $row['count']){ - $input = ''; - } else{ - $input = ''; - } - $r .= ''; - unset($input,$current_uid); - } - - if( round($count/($need_count/100)) >= 100 ) { - $r .= ''; - } - - $r .= '
Прогресс строительства %
'.round($count/($need_count/100)).'/'.(100).'

'; - $r .= '
['.$row['name'].']
'.$input.''; - $r .='
'.round($row['current']/($row['count']/100)).'/'.(100).'

'; - $r .= '

'; - unset($row); +
' . round( + $count / ($need_count / 100) + ) . '/' . (100) . '

'; + $r .= '
- - '; + if ($row['current'] >= $row['count']) { + $input = ''; + } else { + $input = ''; + } + $r .= ''; + unset($input, $current_uid); + } + + if (round($count / ($need_count / 100)) >= 100) { + $r .= ''; + } + + $r .= '
Прогресс строительства - */ - # Идет строительство "'.$actions['name'].'", но нам нехватает ресурсов, помоги добрый странник. - $d->information = '
'.$r; - - -} \ No newline at end of file + unset($key, $val, $current); + + foreach ($actions['resource'] as $row) { + $current_uid = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) as count FROM `items_users` WHERE `item_id` = ' . $row['item'] . ' AND `uid` = ' . $u->info['id'] . ' AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 1' + ) + ); + if (isset($current_uid) && $current_uid['count'] == null) { + $current_uid['count'] = 0; + } // Сколько можем внести + + $r .= '
[' . $row['name'] . ']
' . $input . ''; + $r .= '
' . round( + $row['current'] / ($row['count'] / 100) + ) . '/' . (100) . '

'; + $r .= '

'; + unset($row); + + + /* + * + +
Прогресс строительства + */ + # Идет строительство "'.$actions['name'].'", но нам нехватает ресурсов, помоги добрый странник. + $d->information = '
' . $r; + +} diff --git a/online.php b/online.php index 7e6336ff..c8201b89 100644 --- a/online.php +++ b/online.php @@ -317,21 +317,14 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { } else { //Записываем данные - $msg['time'] = time(); $msg['spam'] = 0; $msg['type'] = 1; - $msg['toChat'] = 0; - $msg['color'] = 'Black'; - $msg['typeTime'] = 0; - $msg['sound'] = 0; - $msg['global'] = 0; $msg['molch'] = 0; - $msg['login'] = $u->info['login']; + $msg['cancel'] = 0; $msg['delete'] = 0; $msg['to'] = ''; $msg['da'] = 0; - $msg['color'] = $u->info['chatColor']; //Нормируем типы сообщений if (preg_match("/private\[(.*?)\]/", $_POST['msg'], $msg['to'])) { @@ -354,11 +347,8 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $_POST['msg'] = str_replace('to [' . $msg['to'] . ']', ' ', $_POST['msg']); } if ($u->info['admin'] == 0) { //ТУТ SPAM - if ($msg['to'] != '' && !isset($admq['id'])) { + if ($msg['to'] != '' && !isset($admq['id']) && $msg['type'] == 3) { $admq = Db::getRow('select id, admin from users where login = ? and admin > 0', [$msg['to']]); - if ($msg['type'] != 3) { - unset($admq); - } } if (!isset($admq['id'])) { $msg['fspam'] = $filter->spamFiltr(str_replace('точка', '.', str_replace('ру', 'ru', $_POST['msg']))); @@ -507,25 +497,19 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') { $i++; } - //todo: внимательно перебрать логику, возможно есть ненужные\дефолтные поля. $cmsg = new ChatMessage(); $cmsg->setInvis($u->info['invis']); $cmsg->setDa($msg['da']); $cmsg->setDelete($msg['delete']); $cmsg->setMolch($msg['molch']); - $cmsg->setLogin($msg['login']); + $cmsg->setLogin($u->info['login']); $cmsg->setTo($msg['to']); $cmsg->setCity($u->info['city']); $cmsg->setRoom($u->info['room']); - $cmsg->setTime($msg['time']); $cmsg->setType($msg['type']); $cmsg->setSpam($msg['spam']); $cmsg->setText($_POST['msg']); - $cmsg->setToChat($msg['toChat']); - $cmsg->setColor($msg['color']); - $cmsg->setTypeTime($msg['typeTime']); - $cmsg->setSound($msg['sound']); - $cmsg->setGlobal($msg['global']); + $cmsg->setColor($u->info['chatColor']); $chat->sendMsg($cmsg); }