diff --git a/_incl_data/class/Dungeon.php b/_incl_data/class/Dungeon.php index 6b656185..7cd9383a 100644 --- a/_incl_data/class/Dungeon.php +++ b/_incl_data/class/Dungeon.php @@ -1,29 +1,43 @@ 558, 1 => 722, 2 => 718, 3 => 700, 4 => 291, 5 => 545, 6 => 533, 7 => 536, 8 => 628, 9 => 710, 10 => 654, 11 => 684, 12 => 689, 13 => 552, 14 => 552, 15 => 716, + 16 => 320, 17 => 290, 18 => 543, 19 => 528, 20 => 540, 21 => 627, 22 => 709, 23 => 653, 24 => 681, 25 => 687, 26 => 523, 27 => 523, 28 => 712, 29 => 1151, 30 => 544, + 31 => 541, 32 => 525, 33 => 539, 34 => 633, 35 => 707, 36 => 647, 37 => 680, 38 => 685, 39 => 567, 40 => 717, 41 => 706, 42 => 527, 43 => 537, 44 => 626, 45 => 708, + 46 => 723, 47 => 651, 48 => 683, 49 => 686, 50 => 2862, 51 => 2863, 52 => 2864, + ]; private $bs; - private $map = [0 => []]; //карта - private $cord = ['x' => 0]; - private $sg = [ + private array $map = [0 => []]; + private array $cord = ['x' => 0]; + private array $sg = [ 1 => [1 => 1, 2 => 2, 3 => 3, 4 => 4], 2 => [1 => 2, 2 => 3, 3 => 4, 4 => 1], 3 => [1 => 3, 2 => 4, 3 => 1, 4 => 2], 4 => [1 => 4, 2 => 1, 3 => 2, 4 => 3], ]; - public $info; - public $error; - public $gs = 1; - public $information; - public $id_dng; - public $see; - public function start() + public function __construct(User $user = null) { - global $u, $c, $code; - $this->info = mysql_fetch_assoc( - mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1') - ); + if (!$user) { + $user = User::start(); + } + + global $u; + $this->info = Db::getRow('select * from dungeon_now where id = ?', [$user->info['dnow']]); + + $this->id_dng = $this->info['id2']; $this->gs = $u->info['s']; if ($this->gs < 1 || $this->gs > 4) { @@ -106,241 +120,196 @@ class Dungeon $this->lookDungeon(); } - public function pickitem($obj, int $itm, $for, $data = '', $dn_delete = false, $chat = 0): bool + public function itm_luck($id) { global $u; - $itm = mysql_fetch_assoc( - mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1') - ); - if (!isset($itm['id'])) { - return false; - } - $tou = 0; //какому юзеру предназначено - /* выделяем случайного юзера из команды */ - $itmnm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1')); - $itmnm = $itmnm['name']; - $asex = ''; - if ($u->info['sex'] == 1) { - $asex = 'а'; - } - - if ($for > 0) { - $tou = $for; - $rtxt = '' . $u->info['login'] . ' обнаружил' . $asex . ' предмет "' . $itm['name'] . '" в "' . $obj['name'] . '"'; - } else { - $rtxt = '' . $u->info['login'] . ' обнаружил' . $asex . ' предмет "' . $itm['name'] . '" в "' . $obj['name'] . '", и вы решили разыграть его'; - } - $dn_delete = $dn_delete ? 1 : 0; - - if ($chat == 0) { - $this->sys_chat($rtxt); - } - mysql_query( - 'INSERT INTO `dungeon_items` (`dn_delete`,`data`,`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $dn_delete . '", - "' . mysql_real_escape_string($data) . '", - "' . $u->info['dnow'] . '", - "' . $tou . '", - "' . $itm['id'] . '", - "' . time() . '", - "' . $u->info['x'] . '", - "' . $u->info['y'] . '")' - ); - - return true; - } - - public function n_lead($who, $lead) - { - global $u, $c, $code; - - $to = mysql_fetch_assoc( + $fxv = ['itm' => mysql_fetch_assoc( mysql_query( - 'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string( - $who + 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( + $id + ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' + ) + ), 'luck' => mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id ) . '" LIMIT 1' ) - ); - - if ($this->info['uid'] != $lead) { - $this->error = 'Вы не лидер...'; - } elseif (!isset($to['id'])) { - $this->error = 'Персонаж не найден...'; - } elseif ($to['id'] == $this->info['uid']) { - $this->error = 'Вы и так лидер...'; - } elseif ($to['dnow'] != $this->info['id']) { - $this->error = 'Персонаж не найден в вашей команде...'; - } else { + ), 'luck2' => mysql_fetch_assoc( mysql_query( - 'UPDATE `dungeon_now` SET `uid` = "' . $to['id'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' + 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) + )]; + if ($u->stats['silver'] >= 3) { //дополнительный бросок + $fxv['luck2'][0]--; + } + if ($fxv['itm']['user'] > 0) { + $this->error = 'Розыгрыш предмет уже завершился...'; + } elseif (!isset($fxv['itm']['id'])) { + $this->error .= '
Предмет не найден
'; + } elseif ($fxv['luck2'][0] > 0) { + $this->error .= '
Вы уже учавствуете в розыгрыше "' . $fxv['itm']['name'] . '", ожидаем других участников еще ' . $u->timeOut( + $fxv['itm']['time'] - time() + 300 + ) . '
'; + } else { + $luck_users = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) + ); + $luck_users = $luck_users[0]; + if ($luck_users < 1) { + mysql_query( + 'UPDATE `dungeon_items` SET `time` = "' . time() . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' + ); + } + $rndl = rand(1, 100); + mysql_query( + 'INSERT INTO `dungeon_actions` (`uid`,`dn`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $u->info['id'] . '","' . $u->info['dnow'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time() . '", + "luck_itm' . mysql_real_escape_string($id) . '","' . $rndl . '" + )' ); if ($u->info['sex'] == 0) { - $this->sys_chat( - '' . $u->info['login'] . ' передал лидерство в группе персонажу ' . $to['login'] . '' - ); + $fxv['text'] = '' . $u->info['login'] . ' выбросил *' . $rndl . '* в споре за предмет "' . $fxv['itm']['name'] . '"'; } else { - $this->sys_chat( - '' . $u->info['login'] . ' передала лидерство в группе персонажу ' . $to['login'] . '' - ); + $fxv['text'] = '' . $u->info['login'] . ' выбросила *' . $rndl . '* в споре за предмет "' . $fxv['itm']['name'] . '"'; } - //header('Location: main.php'); - die(''); + $this->sys_chat($fxv['text']); + $this->error .= '
Вы выбросили ' . $rndl . ' в споре за "' . $fxv['itm']['name'] . '"
'; } + $this->test_luck($id); + unset($fxv); } - public function go_to_hell($who, $lead) + public function sys_chat($rtxt) { - global $u, $c, $code; + global $u; + $cmsg = new ChatMessage(); + $cmsg->setDn($u->info['dnow']); + $cmsg->setCity($u->info['city']); + $cmsg->setRoom($u->info['room']); + $cmsg->setText($rtxt); + $cmsg->setType(6); + $cmsg->setTypeTime(1); + (new Chat())->sendMsg($cmsg); + } - $to = mysql_fetch_assoc( + public function test_luck($id) + { + global $u; + $fxv = ['itm' => mysql_fetch_assoc( mysql_query( - 'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string( - $who + 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( + $id + ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' + ) + ), 'luck_count' => mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id ) . '" LIMIT 1' ) - ); + ), 'user_count' => mysql_fetch_assoc( + mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" LIMIT 1') + )]; + $fxv['luck_count'] = $fxv['luck_count'][0]; + $fxv['user_count'] = $fxv['user_count'][0]; - if ($this->info['uid'] != $lead) { - $this->error = 'Вы не лидер...'; - } elseif (!isset($to['id'])) { - $this->error = 'Персонаж не найден...'; - } elseif ($to['id'] == $this->info['uid']) { - $this->error = 'Лидера нельзя выгнать...'; - } elseif ($to['dnow'] != $this->info['id']) { - $this->error = 'Персонаж не найден в вашей команде...'; - } else { - $rb = 321; // Магический портал - if ($u->info['room'] == 304) { - $rb = 209; // Вход в ледяную пещеру - } elseif ($u->info['room'] == 396) { - $rb = 395; // Канализация (Ангелс) - } elseif ($u->info['room'] == 398) { - $rb = 321; // Все пещеры - } elseif ($this->info['id2'] == 3) { - $rb = 293; // Вход в Катакомбы - } elseif ($this->info['id2'] == 1) { - $rb = 188; // Вход в Канализацию - } elseif ($this->info['id2'] == 13) { - $rb = 275; // Гора Легиона - } elseif ($this->info['id2'] == 12) { - $rb = 372; // Вход в Пещеру Тысячи Проклятий - } elseif ($this->info['id2'] == 444) { - $rb = 321; // Вход в пещеру инкв - } elseif ($this->info['id2'] == 31) { - $rb = 321; // Вход в пещеру инкв - } elseif ($this->info['id2'] == 101) { - $rb = 321; // Вход в Бездну - - } - - $sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50'); - while ($pl = mysql_fetch_assoc($sp)) { - $cn = mysql_fetch_assoc( - mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1') - ); - if (!isset($cn['id'])) { - mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"'); + if (($fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time'] + 300 < time()) && !empty($fxv['itm']['user'])) { + $fxv['sp'] = mysql_query( + 'SELECT * FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" ORDER BY `vals` DESC LIMIT ' . $fxv['luck_count'] . '' + ); + $fxv['winner'] = []; + $fxv['win_val'] = 0; + unset($fxv['pl'], $fxv['sp']); + if (count($fxv['winner']) > 1) { + //Розыгрыш еще раз между победителями + $this->error .= '
Розыгрыш завершен!
'; + } elseif (count($fxv['winner']) == 1) { + $fxv['user_win'] = mysql_fetch_assoc( mysql_query( - 'UPDATE `dungeon_now` SET `time_finish` = "' . time( - ) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' - ); - } - } - - $city = mysql_fetch_assoc( - mysql_query('SELECT `id`, `city` FROM `room` WHERE `id` = "' . $rb . '" LIMIT 1') - ); - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query( - 'UPDATE `users` SET `room` = "' . $rb . '", `city`="' . $city['city'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - //удаляем все предметы которые пропадают после выхода из пещеры - mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time( - ) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `dn_delete` = "1" LIMIT 1000' - ); - - mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time( - ) . '" WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000' - ); - - if ($u->info['sex'] == 0) { - $this->sys_chat( - '' . $u->info['login'] . ' выгнал из похода персонажа ' . $to['login'] . '' + 'SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $fxv['winner'][0] . '" LIMIT 1' + ) ); - } else { - $this->sys_chat( - '' . $u->info['login'] . ' выгнала из похода персонажа ' . $to['login'] . '' + $fxv['text'] = '' . $fxv['user_win']['login'] . ' выигрывает в споре за предмет "' . $fxv['itm']['name'] . '"'; + $this->sys_chat($fxv['text']); + mysql_query( + 'UPDATE `dungeon_items` SET `time` = "' . time() . '",`user` = "' . $fxv['user_win']['id'] . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' ); + $this->error .= '
Розыгрыш завершен! Победитель ' . $fxv['user_win']['login'] . '!
'; } - header('Location: /main.php'); + } else { + $this->error .= '
У остальных участников осталось ' . $u->timeOut( + $fxv['itm']['time'] + 300 - time() + ) . ' мин. до конца розыгрыша
'; } + unset($fxv); } - public function usersDng($laba = false) + public function itm_unluck($id) { - global $u, $c; - $r = ''; - $stt = []; - if ($laba == false) { - $sp = mysql_query( - 'SELECT `u`.`id`,`st`.`id` FROM `stats` AS `u` LEFT JOIN `users` AS `st` ON (`st`.`id` = `u`.`id`) WHERE `u`.`dnow` = "' . $this->info['id'] . '" LIMIT 10' - ); + global $u; + $fxv = ['itm' => mysql_fetch_assoc( + mysql_query( + 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( + $id + ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' + ) + ), 'luck' => mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) + )]; + if ($fxv['itm']['user'] > 0) { + $this->error = 'Розыгрыш предмет уже завершился...'; + } elseif (!isset($fxv['itm']['id'])) { + $this->error .= '
Предмет не найден
'; + } elseif (isset($fxv['luck']['id'])) { + if ($fxv['luck']['vals'] == 0) { + $this->error .= '
Вы уже отказались от участия в розыгрыше "' . $fxv['itm']['name'] . '"
'; + } else { + $this->error .= '
Вы уже учавствуете в розыгрыше "' . $fxv['itm']['name'] . '", ожидаем других участников еще ' . $u->timeOut( + $fxv['itm']['time'] - time() + 300 + ) . '
'; + } } else { - $sp = mysql_query( - 'SELECT `u`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`st`.`id` = `u`.`id`) WHERE `u`.`room` = 370 AND `st`.`dnow` = "' . $laba . '" AND `st`.`bot` = 0 LIMIT 6' + $luck_users = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) ); + $luck_users = $luck_users[0]; + if ($luck_users < 1) { + mysql_query( + 'UPDATE `dungeon_items` SET `time` = "' . time() . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' + ); + } + if ($u->info['sex'] == 0) { + $fxv['text'] = '' . $u->info['login'] . ' отказался от спора за предмет "' . $fxv['itm']['name'] . '"'; + } else { + $fxv['text'] = '' . $u->info['login'] . ' отказалась от спора за предмет "' . $fxv['itm']['name'] . '"'; + } + $this->sys_chat($fxv['text']); + mysql_query( + 'INSERT INTO `dungeon_actions` (`uid`,`dn`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $u->info['id'] . '","' . $u->info['dnow'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time() . '", + "luck_itm' . mysql_real_escape_string($id) . '","0" + )' + ); + $this->error .= '
Вы отказались от участия в розыгрыше "' . $fxv['itm']['name'] . '"
'; } - while ($pl = mysql_fetch_assoc($sp)) { - $stt = $u->getStats($pl['id'], 0); - if ($stt['mpAll'] > 0) { - $pm = $stt['mpNow'] / $stt['mpAll'] * 100; - } - $ph = $stt['hpNow'] / $stt['hpAll'] * 100; - $r .= ' - -
  ' . $u->microLogin($pl['id'], 1) . '   ' . floor( - $stt['hpNow'] - ) . '/' . $stt['hpAll'] . ' -
-
-
-'; - if ($stt['mpAll'] > 0) { - $r .= '
' . floor( - $stt['mpNow'] - ) . '/' . $stt['mpAll'] . '
-
-
-
'; - } - $r .= '
'; - if ($this->info['uid'] == $pl['id']) { - $r .= ''; - } - if ($this->info['uid'] == $u->info['id'] && $pl['id'] == $u->info['id'] && $this->info['id2'] != 15) { - $r .= ' '; - $r .= ' '; - } - $r .= '

'; - $r .= ''; - } - unset($stt, $ph, $pm); - return $r; + unset($fxv); } public function atack($id) @@ -535,8 +504,7 @@ class Dungeon //Добавляем в лог БС mysql_query( 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time( - ) . '", "' . $this->bs['id'] . '", "' . $this->bs['count'] . '", "' . $this->bs['city'] . '", + "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $this->bs['id'] . '", "' . $this->bs['count'] . '", "' . $this->bs['city'] . '", "' . round($this->bs['money'] * 0.85, 2) . '","' . $i . '" )' ); @@ -665,8 +633,7 @@ class Dungeon //Добавляем в лог БС mysql_query( 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time( - ) . '", "' . $this->bs['id'] . '", "' . $this->bs['count'] . '", "' . $this->bs['city'] . '", + "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $this->bs['id'] . '", "' . $this->bs['count'] . '", "' . $this->bs['city'] . '", "' . round($this->bs['money'] * 0.85, 2) . '","' . $i . '" )' ); @@ -687,81 +654,142 @@ class Dungeon } } - public function testDie() + public function testLike($x1, $y1, $x2, $y2) { - global $u, $c, $code; - $dies = mysql_fetch_assoc( + //из $x1,$y1 в $x2,$y2 + //доступна-ли эта клетка для действий + $r = 0; + $c1 = mysql_fetch_assoc( mysql_query( - 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "die" LIMIT 1' + 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $x1 . '" AND `y` = "' . $y1 . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' ) ); - $dies = $dies[0]; + $c2 = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $x2 . '" AND `y` = "' . $y2 . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' + ) + ); + if (isset($c1['id']) && isset($c2['id'])) { + if ($x1 == $x2 && $y1 == $y2) { + $r = 1; + } elseif ($x1 == $x2 - 1 && $c1['go_1'] == 1) //право + { + $r = 1; + } elseif ($x1 == $x2 + 1 && $c1['go_2'] == 1) //лево + { + $r = 1; + } elseif ($y1 == $y2 - 1 && $c1['go_3'] == 1) //верх + { + $r = 1; + } elseif ($y1 == $y2 + 1 && $c1['go_4'] == 1) //низ + { + $r = 1; + } + } + return $r; + } + //Предметы для БС - if ($u->stats['hpNow'] < 1 || $dies > 2) { - if ($dies < 2) { + public function takeinv($id) + { + global $u, $c, $code; + $obj = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_items` WHERE `id` = "' . $id . '" AND `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" LIMIT 1' + ) + ); + if (isset($obj['id'])) { + $this->test_luck($id); + $fxv = ['luck_count' => mysql_fetch_assoc( mysql_query( - 'INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $u->info['dnow'] . '","' . $u->info['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time( - ) . '","die","" - )' - ); - //21:50 Ярополк трагически погиб и находится в комнате "Этаж 2 - Водосток" - $dnow = mysql_fetch_assoc( - mysql_query('SELECT id2 FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1') - ); - $room = mysql_fetch_assoc( - mysql_query( - 'SELECT name FROM `dungeon_map_info` WHERE `x` = "' . $u->info['res_x'] . '" AND `y` = "' . $u->info['res_y'] . '" AND `id_dng` = "' . $dnow['id2'] . '" LIMIT 1' - ) - ); - - if ($u->info['sex'] == 0) { - $this->sys_chat( - '' . $u->info['login'] . ' трагически погиб и находится в комнате "' . $room['name'] . '"' + 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $id + ) . '" LIMIT 1' + ) + ), 'user_count' => mysql_fetch_assoc( + mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" LIMIT 1') + )]; + if ($obj['user'] == 0 && $fxv['user_count'][0] > $fxv['luck_count'][0] && $fxv['user_count'][0] > 1 && $this->info['bsid'] == 0) { + $this->error = 'Вы не можете сейчас поднять этот предмет, дождитесь завершения розыгрыша. Осталось ' . $u->timeOut( + $obj['time'] - time() + 300 ); - } else { - $this->sys_chat( - '' . $u->info['login'] . ' трагически погибла и находится в комнате "' . $room['name'] . '"' - ); - } - mysql_query( - 'UPDATE `stats` SET `hpNow` = "1",`x` = "' . $u->info['res_x'] . '",`y` = "' . $u->info['res_y'] . '",`s` = "' . $u->info['res_s'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' - ); - //header('location: main.php'); - die(''); + } elseif ($u->info['x'] != $obj['x'] || $obj['y'] != $u->info['y']) { + $this->error = 'Предмет не найден ...'; } else { - mysql_query( - 'INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $u->info['dnow'] . '","' . $u->info['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time( - ) . '","die","" - )' - ); - //21:50 Ярополк трагически погиб и находится в комнате "Этаж 2 - Водосток" - if ($u->info['sex'] == 0) { - $this->sys_chat('' . $u->info['login'] . ' трагически погиб без права на воскрешение'); + if ($obj['take'] > 0) { + $this->error = 'Кто-то опередил вас ...'; } else { - $this->sys_chat('' . $u->info['login'] . ' трагически погибла без права на воскрешение'); + if ($obj['user'] > 0 && $obj['user'] != $u->info['id'] && $obj['time'] > time() - 300) { + $uo = mysql_fetch_assoc( + mysql_query( + 'SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $obj['user'] . '" LIMIT 1' + ) + ); + } + if (isset($uo['id'])) { + $this->error = 'Предмет предназначен для "' . $uo['login'] . '". Вы сможете забрать этот предмет, если '; + if ($uo['sex'] == 1) { + $this->error .= 'она '; + } else { + $this->error .= 'он '; + } + $this->error .= ' не поднимет его в течении ' . ceil( + 5 - (time() - $obj['time']) / 60 + ) . ' мин.'; + unset($uo); + } else { + $upd = mysql_query( + 'UPDATE `dungeon_items` SET `take` = "' . $u->info['id'] . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1' + ); + if ($upd) { + $it = mysql_fetch_assoc( + mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $obj['item_id'] . '" LIMIT 1') + ); + if (isset($it['id'])) { + $data = '|noremont=1|frompisher=' . $this->info['id2']; + if ($it['ts'] != 0) { + $data .= '|sudba=' . $u->info['login']; + } + if ($obj['data'] != '') { + $data .= $obj['data']; + } + $data = str_replace('|sudba=-1', '|sudba=' . $u->info['login'] . '', $data); + + $idl = ItemsModel::addItem($obj['item_id'], $u->info['id'], $data, $obj); + if ($obj['del'] > 0) { + mysql_query( + 'UPDATE `items_users` SET `dn_delete` = 1 WHERE `id` = "' . $idl . '" LIMIT 1' + ); + } + unset($idl); + + if ($this->info['bsid'] == 0) { + $rtxt = '' . $u->info['login'] . ' поднял предмет "' . $it['name'] . '"'; + if ($obj['quest'] > 0) { + $rtxt .= ' (Квест)'; + } + $this->sys_chat($rtxt); + } + $this->error = 'Вы подняли "' . $it['name'] . '"'; + } else { + $this->error = 'Не удалось найти предмет ...'; + } + } else { + $this->error = 'Не удалось добавить предмет в инвентарь ...'; + } + } } - $_GET['exitd'] = true; } } } - //Предметы для БС - public array $itbs = [0 => 558, 1 => 722, 2 => 718, 3 => 700, 4 => 291, 5 => 545, 6 => 533, 7 => 536, 8 => 628, 9 => 710, 10 => 654, 11 => 684, 12 => 689, 13 => 552, 14 => 552, 15 => 716, 16 => 320, 17 => 290, 18 => 543, 19 => 528, 20 => 540, 21 => 627, 22 => 709, 23 => 653, 24 => 681, 25 => 687, 26 => 523, 27 => 523, 28 => 712, 29 => 1151, 30 => 544, 31 => 541, 32 => 525, 33 => 539, 34 => 633, 35 => 707, 36 => 647, 37 => 680, 38 => 685, 39 => 567, 40 => 717, 41 => 706, 42 => 527, 43 => 537, 44 => 626, 45 => 708, 46 => 723, 47 => 651, 48 => 683, 49 => 686, 50 => 2862, 51 => 2863, 52 => 2864]; - - public function sys_chat($rtxt) + public function addItem($i) { - global $u; - $cmsg = new ChatMessage(); - $cmsg->setDn($u->info['dnow']); - $cmsg->setCity($u->info['city']); - $cmsg->setRoom($u->info['room']); - $cmsg->setText($rtxt); - $cmsg->setType(6); - $cmsg->setTypeTime(1); - (new Chat())->sendMsg($cmsg); + //добавляем предмет в пещеру (возможно выпал из бота или из сундука) + return mysql_query( + 'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`bot`,`del`) VALUES ("' . $this->info['id'] . '","' . $i['uid'] . '","' . $i['iid'] . '","' . $i['time'] . '","' . $i['x'] . '","' . $i['y'] . '","' . $i['bid'] . '","' . ((int)$i['del']) . '")' + ); } public function takeit($id) @@ -891,8 +919,7 @@ class Dungeon mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itm[0] . '" LIMIT 1') ); mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time( - ) . '" WHERE `item_id` = "' . $itm[0] . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 100) AND `inShop` = 0 AND `inTransfer` = 0 AND `inOdet` = 0 LIMIT ' . $itm[1] + 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `item_id` = "' . $itm[0] . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 0 OR `delete` = 100) AND `inShop` = 0 AND `inTransfer` = 0 AND `inOdet` = 0 LIMIT ' . $itm[1] ); $r .= 'Предмет "' . $uitm['name'] . '" (x' . $itm[1] . ') был утрачен...
'; $j++; @@ -1107,8 +1134,7 @@ class Dungeon if (isset($it['id'])) { $r .= 'Вы обнаружили предмет "' . $it['name'] . '".
'; $this->addItem( - ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time( - ), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] + ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time(), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] ); } } else { @@ -1157,8 +1183,7 @@ class Dungeon time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city'] ); $this->addItem( - ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time( - ), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] + ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time(), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] ); $nj++; } @@ -1206,8 +1231,7 @@ class Dungeon time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $u->info['city'] ); $this->addItem( - ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time( - ), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] + ['uid' => $u->info['id'], 'iid' => $it['id'], 'time' => time(), 'x' => $u->info['x'], 'y' => $u->info['y'], 'bid' => 0, 'del' => (int)$itm[4]] ); $nj++; } @@ -1236,466 +1260,6 @@ class Dungeon } } - public function addItem($i) - { - //добавляем предмет в пещеру (возможно выпал из бота или из сундука) - return mysql_query( - 'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`bot`,`del`) VALUES ("' . $this->info['id'] . '","' . $i['uid'] . '","' . $i['iid'] . '","' . $i['time'] . '","' . $i['x'] . '","' . $i['y'] . '","' . $i['bid'] . '","' . ((int)$i['del']) . '")' - ); - } - - public function takeinv($id) - { - global $u, $c, $code; - $obj = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_items` WHERE `id` = "' . $id . '" AND `for_dn` = "0" AND `dn` = "' . $this->info['id'] . '" LIMIT 1' - ) - ); - if (isset($obj['id'])) { - $this->test_luck($id); - $fxv = ['luck_count' => mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - ), 'user_count' => mysql_fetch_assoc( - mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" LIMIT 1') - )]; - if ($obj['user'] == 0 && $fxv['user_count'][0] > $fxv['luck_count'][0] && $fxv['user_count'][0] > 1 && $this->info['bsid'] == 0) { - $this->error = 'Вы не можете сейчас поднять этот предмет, дождитесь завершения розыгрыша. Осталось ' . $u->timeOut( - $obj['time'] - time() + 300 - ); - } elseif ($u->info['x'] != $obj['x'] || $obj['y'] != $u->info['y']) { - $this->error = 'Предмет не найден ...'; - } else { - if ($obj['take'] > 0) { - $this->error = 'Кто-то опередил вас ...'; - } else { - if ($obj['user'] > 0 && $obj['user'] != $u->info['id'] && $obj['time'] > time() - 300) { - $uo = mysql_fetch_assoc( - mysql_query( - 'SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $obj['user'] . '" LIMIT 1' - ) - ); - } - if (isset($uo['id'])) { - $this->error = 'Предмет предназначен для "' . $uo['login'] . '". Вы сможете забрать этот предмет, если '; - if ($uo['sex'] == 1) { - $this->error .= 'она '; - } else { - $this->error .= 'он '; - } - $this->error .= ' не поднимет его в течении ' . ceil( - 5 - (time() - $obj['time']) / 60 - ) . ' мин.'; - unset($uo); - } else { - $upd = mysql_query( - 'UPDATE `dungeon_items` SET `take` = "' . $u->info['id'] . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1' - ); - if ($upd) { - $it = mysql_fetch_assoc( - mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $obj['item_id'] . '" LIMIT 1') - ); - if (isset($it['id'])) { - $data = '|noremont=1|frompisher=' . $this->info['id2']; - if ($it['ts'] != 0) { - $data .= '|sudba=' . $u->info['login']; - } - if ($obj['data'] != '') { - $data .= $obj['data']; - } - $data = str_replace('|sudba=-1', '|sudba=' . $u->info['login'] . '', $data); - - $idl = \User\ItemsModel::addItem($obj['item_id'], $u->info['id'], $data, $obj); - if ($obj['del'] > 0) { - mysql_query( - 'UPDATE `items_users` SET `dn_delete` = 1 WHERE `id` = "' . $idl . '" LIMIT 1' - ); - } - unset($idl); - - if ($this->info['bsid'] == 0) { - $rtxt = '' . $u->info['login'] . ' поднял предмет "' . $it['name'] . '"'; - if ($obj['quest'] > 0) { - $rtxt .= ' (Квест)'; - } - $this->sys_chat($rtxt); - } - $this->error = 'Вы подняли "' . $it['name'] . '"'; - } else { - $this->error = 'Не удалось найти предмет ...'; - } - } else { - $this->error = 'Не удалось добавить предмет в инвентарь ...'; - } - } - } - } - } - } - - - //Розыгрыш предмета - public function test_luck($id) - { - global $u; - $fxv = ['itm' => mysql_fetch_assoc( - mysql_query( - 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( - $id - ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' - ) - ), 'luck_count' => mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - ), 'user_count' => mysql_fetch_assoc( - mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" LIMIT 1') - )]; - $fxv['luck_count'] = $fxv['luck_count'][0]; - $fxv['user_count'] = $fxv['user_count'][0]; - - if (($fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time'] + 300 < time( - )) && !empty($fxv['itm']['user'])) { - $fxv['sp'] = mysql_query( - 'SELECT * FROM `dungeon_actions` WHERE `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" ORDER BY `vals` DESC LIMIT ' . $fxv['luck_count'] . '' - ); - $fxv['winner'] = []; - $fxv['win_val'] = 0; - unset($fxv['pl'], $fxv['sp']); - if (count($fxv['winner']) > 1) { - //Розыгрыш еще раз между победителями - $this->error .= '
Розыгрыш завершен!
'; - } elseif (count($fxv['winner']) == 1) { - $fxv['user_win'] = mysql_fetch_assoc( - mysql_query( - 'SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $fxv['winner'][0] . '" LIMIT 1' - ) - ); - $fxv['text'] = '' . $fxv['user_win']['login'] . ' выигрывает в споре за предмет "' . $fxv['itm']['name'] . '"'; - $this->sys_chat($fxv['text']); - mysql_query( - 'UPDATE `dungeon_items` SET `time` = "' . time( - ) . '",`user` = "' . $fxv['user_win']['id'] . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' - ); - $this->error .= '
Розыгрыш завершен! Победитель ' . $fxv['user_win']['login'] . '!
'; - } - } else { - $this->error .= '
У остальных участников осталось ' . $u->timeOut( - $fxv['itm']['time'] + 300 - time() - ) . ' мин. до конца розыгрыша
'; - } - unset($fxv); - } - - public function itm_luck($id) - { - global $u; - $fxv = ['itm' => mysql_fetch_assoc( - mysql_query( - 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( - $id - ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' - ) - ), 'luck' => mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - ), 'luck2' => mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(*) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - )]; - if ($u->stats['silver'] >= 3) { //дополнительный бросок - $fxv['luck2'][0]--; - } - if ($fxv['itm']['user'] > 0) { - $this->error = 'Розыгрыш предмет уже завершился...'; - } elseif (!isset($fxv['itm']['id'])) { - $this->error .= '
Предмет не найден
'; - } elseif ($fxv['luck2'][0] > 0) { - $this->error .= '
Вы уже учавствуете в розыгрыше "' . $fxv['itm']['name'] . '", ожидаем других участников еще ' . $u->timeOut( - $fxv['itm']['time'] - time() + 300 - ) . '
'; - } else { - $luck_users = mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - ); - $luck_users = $luck_users[0]; - if ($luck_users < 1) { - mysql_query( - 'UPDATE `dungeon_items` SET `time` = "' . time( - ) . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' - ); - } - $rndl = rand(1, 100); - mysql_query( - 'INSERT INTO `dungeon_actions` (`uid`,`dn`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $u->info['id'] . '","' . $u->info['dnow'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time( - ) . '", - "luck_itm' . mysql_real_escape_string($id) . '","' . $rndl . '" - )' - ); - if ($u->info['sex'] == 0) { - $fxv['text'] = '' . $u->info['login'] . ' выбросил *' . $rndl . '* в споре за предмет "' . $fxv['itm']['name'] . '"'; - } else { - $fxv['text'] = '' . $u->info['login'] . ' выбросила *' . $rndl . '* в споре за предмет "' . $fxv['itm']['name'] . '"'; - } - $this->sys_chat($fxv['text']); - $this->error .= '
Вы выбросили ' . $rndl . ' в споре за "' . $fxv['itm']['name'] . '"
'; - } - $this->test_luck($id); - unset($fxv); - } - - public function itm_unluck($id) - { - global $u; - $fxv = ['itm' => mysql_fetch_assoc( - mysql_query( - 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`id` = "' . mysql_real_escape_string( - $id - ) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1' - ) - ), 'luck' => mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - )]; - if ($fxv['itm']['user'] > 0) { - $this->error = 'Розыгрыш предмет уже завершился...'; - } elseif (!isset($fxv['itm']['id'])) { - $this->error .= '
Предмет не найден
'; - } elseif (isset($fxv['luck']['id'])) { - if ($fxv['luck']['vals'] == 0) { - $this->error .= '
Вы уже отказались от участия в розыгрыше "' . $fxv['itm']['name'] . '"
'; - } else { - $this->error .= '
Вы уже учавствуете в розыгрыше "' . $fxv['itm']['name'] . '", ожидаем других участников еще ' . $u->timeOut( - $fxv['itm']['time'] - time() + 300 - ) . '
'; - } - } else { - $luck_users = mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $id - ) . '" LIMIT 1' - ) - ); - $luck_users = $luck_users[0]; - if ($luck_users < 1) { - mysql_query( - 'UPDATE `dungeon_items` SET `time` = "' . time( - ) . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1' - ); - } - if ($u->info['sex'] == 0) { - $fxv['text'] = '' . $u->info['login'] . ' отказался от спора за предмет "' . $fxv['itm']['name'] . '"'; - } else { - $fxv['text'] = '' . $u->info['login'] . ' отказалась от спора за предмет "' . $fxv['itm']['name'] . '"'; - } - $this->sys_chat($fxv['text']); - mysql_query( - 'INSERT INTO `dungeon_actions` (`uid`,`dn`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $u->info['id'] . '","' . $u->info['dnow'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time( - ) . '", - "luck_itm' . mysql_real_escape_string($id) . '","0" - )' - ); - $this->error .= '
Вы отказались от участия в розыгрыше "' . $fxv['itm']['name'] . '"
'; - } - unset($fxv); - } - - public function itemsMap() - { - global $u, $c, $code; - $r = ''; - $live_users = mysql_fetch_assoc( - mysql_query('SELECT COUNT(`id`) FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" LIMIT 1') - ); - $live_users = $live_users[0]; - $sp = mysql_query( - 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND ( `ish`.`onlyfor` = "0" OR `ish`.`onlyfor` = "' . $u->info['id'] . '" ) AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 100' - ); - while ($pl = mysql_fetch_assoc($sp)) { - $action = 'main.php?take=' . $pl['id'] . ''; - $tk = 0; - $luck_users = mysql_fetch_assoc( - mysql_query( - 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( - $pl['id'] - ) . '" LIMIT 1' - ) - ); - $luck_users = $luck_users[0]; - if ($pl['user'] == 0 && $live_users > 1 && ($pl['time'] + 300 > time() || $luck_users < 1)) { - $fxv = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . $pl['id'] . '" LIMIT 1' - ) - ); - //Розыгрыш - if (!isset($fxv['id']) && $this->info['bsid'] == 0) { - $action = "javascript: top.fartgame('{$pl['id']}', '{$pl['img']}', '{$pl['name']}')"; - $tk = 1; - } - } - if ($tk == 0) { - $r .= ''; - } elseif ($tk == 1) { - $r .= ''; - } - } - if ($r != '') { - $r = '

В комнате разбросаны вещи:

' . $r; //
Подобрать все
- } - return $r; - } - - public function testLike($x1, $y1, $x2, $y2) - { - //из $x1,$y1 в $x2,$y2 - //доступна-ли эта клетка для действий - $r = 0; - $c1 = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $x1 . '" AND `y` = "' . $y1 . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' - ) - ); - $c2 = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $x2 . '" AND `y` = "' . $y2 . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' - ) - ); - if (isset($c1['id']) && isset($c2['id'])) { - if ($x1 == $x2 && $y1 == $y2) { - $r = 1; - } elseif ($x1 == $x2 - 1 && $c1['go_1'] == 1) //право - { - $r = 1; - } elseif ($x1 == $x2 + 1 && $c1['go_2'] == 1) //лево - { - $r = 1; - } elseif ($y1 == $y2 - 1 && $c1['go_3'] == 1) //верх - { - $r = 1; - } elseif ($y1 == $y2 + 1 && $c1['go_4'] == 1) //низ - { - $r = 1; - } - } - return $r; - } - - public function genObjects() - { - global $u, $c, $code; - ////i:{id,name,mapPoint,action,img,type}, - //'count':1,0:{0:1234,1:'Сундук',2:5,3:'',4:'test.gif',5:0,6:position,7:width,8:heigh,9:left,10:top}, - //psition 0 - по центру , 1- сверху, 2- слева, 3- снизу, 4- справа - $r = ''; - $whr = [1 => ' (((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` >= ' . ($u->info['y'] + 1) . ' && `u`.`y` <= ' . ($u->info['y'] + 4) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //прямо - 3 => ' (((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` <= ' . ($u->info['y'] - 1) . ' && `u`.`y` >= ' . ($u->info['y'] - 4) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //вниз - 2 => ' (((`u`.`x` <= ' . ($u->info['x'] - 1) . ' && `u`.`x` >= ' . ($u->info['x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . '))OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //лево - 4 => ' (((`u`.`x` >= ' . ($u->info['x'] + 1) . ' && `u`.`x` <= ' . ($u->info['x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //право - ]; - $sp = mysql_query( - 'SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND `u`.`for_dn` = "0" AND ((`u`.`s` = "0" OR `u`.`s` = "' . $this->gs . '") OR `u`.`s2` = "' . $this->gs . '") AND ' . $whr[$this->gs] . ' LIMIT 150' - ); - $i = 0; - $pos = []; - while ($pl = mysql_fetch_assoc($sp)) { - if ($pl['fix_x_y'] == 0 || ($pl['fix_x_y'] == 1 && $pl['x'] == $u->info['x']) || ($pl['fix_x_y'] == 2 && $pl['y'] == $u->info['y']) || ($pl['fix_x_y'] == 3 && $pl['x'] == $u->info['x'] && $pl['y'] == $u->info['y'])) { - if (($pl['os1'] == 0 && $pl['os2'] == 0 && $pl['os3'] == 0 && $pl['os4'] == 0) || ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'])) { - $i++; - if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; - } - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; - $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'action\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; - } elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] - 1) { - $dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{')); - $da = []; - $is = 0; - while ($is < count($dt2)) { - $dt2[$is] = explode(':', $dt2[$is]); - $da[$dt2[$is][0]] = $dt2[$is][1]; - $is++; - } - if (isset($da['use'])) { - unset($da['use']); - } // Справа - if (isset($da['rl2'])) { - $da['rl2'] = -round((int)$da['rl2'] * 1.55); - } // Слева - if (isset($da['rl3'])) { - $da['rl3'] = round((int)$da['rl3'] + 160); - } - if (isset($da['rl4'])) { - $da['rl4'] = round((int)$da['rl4'] - 120); - } - $pl['date'] = str_replace('"', '', json_encode($da)); - - - $i++; - if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; - } - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; - $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; - } elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] + 1) { - - $dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{')); - $da = []; - $is = 0; - while ($is < count($dt2)) { - $dt2[$is] = explode(':', $dt2[$is]); - $da[$dt2[$is][0]] = $dt2[$is][1]; - $is++; - } - if (isset($da['use'])) { - unset($da['use']); - } // Справа - if (isset($da['rl2'])) { - $da['rl2'] = 355 - round((int)$da['rl2'] * 0.30); - } // Справа - if (isset($da['rl3'])) { - $da['rl3'] = round((int)$da['rl3'] - 160); - } - if (isset($da['rl4'])) { - $da['rl4'] = round((int)$da['rl4'] + 120); - } - $pl['date'] = str_replace('"', '', json_encode($da)); - $i++; - if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; - } - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; - $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; - } - } - } - return 'count:' . $i . $r; - } - public function botAtack($bot, $uid, $bs) { global $u, $c, $code; @@ -1717,8 +1281,7 @@ class Dungeon $btl = ['players' => '', 'timeout' => 120, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; mysql_query( - 'INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ("' . $this->info['id2'] . '", "' . $this->info['id'] . '", "' . $bot['x'] . '", "' . $bot['y'] . '", "' . $u->info['city'] . '", "' . time( - ) . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", "' . $btl['type'] . '", "' . $btl['invis'] . '", "' . $btl['noinc'] . '", "' . $btl['travmChance'] . '", "' . $btl['typeBattle'] . '", "' . $btl['addExp'] . '", "' . $btl['money'] . '")' + 'INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES ("' . $this->info['id2'] . '", "' . $this->info['id'] . '", "' . $bot['x'] . '", "' . $bot['y'] . '", "' . $u->info['city'] . '", "' . time() . '", "' . $btl['players'] . '", "' . $btl['timeout'] . '", "' . $btl['type'] . '", "' . $btl['invis'] . '", "' . $btl['noinc'] . '", "' . $btl['travmChance'] . '", "' . $btl['typeBattle'] . '", "' . $btl['addExp'] . '", "' . $btl['money'] . '")' ); $btl_id = mysql_insert_id(); @@ -1805,8 +1368,7 @@ class Dungeon ); if ($battle_log['id_hod'] > 0) { mysql_query( - 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( - ) . '","' . $btl_id . '","' . ($battle_log['id_hod'] + 1) . '","' . $logins_bot_text . '","' . $logins_bot_vars . '","","","","",1)' + 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $btl_id . '","' . ($battle_log['id_hod'] + 1) . '","' . $logins_bot_text . '","' . $logins_bot_vars . '","","","","",1)' ); } } @@ -1821,141 +1383,6 @@ class Dungeon } } - public function genUsers() - { - global $u, $c, $code; - ////i:{id,login,mapPoint,sex,obraz,type,users_p}, - //'count':1,0:{0:1015,1:'Test1',2:5,3:0,4:'1',5:'user',6:1}, - $r = ''; - $whr = [1 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` >= ' . $u->info['y'] . ' && `u`.`y` <= ' . ($u->info['y'] + 4) . ')) ', //прямо - 3 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` <= ' . $u->info['y'] . ' && `u`.`y` >= ' . ($u->info['y'] - 4) . ')) ', //вниз - 2 => ' ((`u`.`x` <= ' . $u->info['x'] . ' && `u`.`x` >= ' . ($u->info['x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //лево - 4 => ' ((`u`.`x` >= ' . $u->info['x'] . ' && `u`.`x` <= ' . ($u->info['x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //право - ]; - // - $tmsu = mysql_fetch_assoc( - mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1') - ); - // - $sp = mysql_query( - 'SELECT `u`.*,`st`.* FROM `stats` AS `u` LEFT JOIN `users` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`dnow` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`id` != "' . $u->info['id'] . '" LIMIT 100' - ); - $i = 0; - $pos = []; - while ($pl = mysql_fetch_assoc($sp)) { - $i++; - if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; - } - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; - $noat = 0; - if ($this->info['bsid'] > 0) { - $noat = 1; - } - if ($this->info['id2'] == 15) { - //Хоккей - $r .= ',' . ($i - 1) . ':{8:' . $noat . ',0:' . $pl['id'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( - '.gif', '', $pl['obraz'] - ) . '\',5:\'user\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . ''; - // - $tms = mysql_fetch_assoc( - mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $pl['id'] . '" LIMIT 1') - ); - if ($tms['team'] == $tmsu['team']) { - $r .= ',9:1'; - } else { - $r .= ',9:2'; - } - $r .= ''; - // - $r .= '}'; - } else { - $r .= ',' . ($i - 1) . ':{9:0,8:' . $noat . ',0:' . $pl['id'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( - '.gif', '', $pl['obraz'] - ) . '\',5:\'user\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . '}'; - } - } - - //отображаем ботов - // - //$sp = mysql_query('SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "'.$u->info['dnow'].'" AND `u`.`atack` = "0" AND `u`.`delete` = "0" AND `u`.`inBattle` = "0" AND `u`.`go_bot` > 0 ORDER BY `u`.`go_bot` ASC LIMIT 35'); - - // Выбираем Ботов в подземельи, которые Не в бою, Живые, и не дальше чем -\+30 по X и -\+35 по Y (дабы не гонять всех ботов, меньше выборка). - - $sp = mysql_query( - 'SELECT `db`.*, `tb`.* FROM `dungeon_bots` AS `db` LEFT JOIN `test_bot` AS `tb` ON (`db`.`id_bot` = `tb`.`id`) LEFT JOIN `stats` as `st` ON (`st`.`dnow` = `db`.`dn`) WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`x` > `st`.`x`-30 AND `db`.`x` < `st`.`x`+30 AND `db`.`y` > `st`.`y`-35 AND `db`.`y` < `st`.`y`+35 AND `db`.`atack` = "0" AND `db`.`delete` = "0" AND `db`.`inBattle` = "0" AND `db`.`go_bot` > 0 GROUP BY `db`.`id2` ORDER BY `db`.`go_bot` ASC LIMIT 100' - ); - while ($pl = mysql_fetch_assoc($sp)) { - //перемещение бота, каждые 3-10 сек. - if ($pl['go_bot'] > 0 && $pl['go_bot'] <= time()) { - $tgx = rand(-1, 1); - $tgy = rand(-1, 1); - if ($tgx != 0 && $tgy != 0) { - if (rand(0, 1) == 1) { - $tgy = 0; - } else { - $tgx = 0; - } - } - $vlb = $this->testLike($pl['x'], $pl['y'], $pl['x'] + $tgx, $pl['y'] + $tgy); - //Кто-то рядом - $tuz = mysql_fetch_assoc( - mysql_query( - 'SELECT `x`,`y`,`id`,`hpNow` FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" AND ( (`x` = ' . ($pl['x'] + 1) . ' AND `y` = ' . ($pl['y']) . ') OR (`x` = ' . ($pl['x'] - 1) . ' AND `y` = ' . ($pl['y']) . ') OR (`x` = ' . ($pl['x']) . ' AND `y` = ' . ($pl['y'] + 1) . ') OR (`x` = ' . ($pl['x']) . ' AND `y` = ' . ($pl['y'] - 1) . ') ) LIMIT 1' - ) - ); - - if (isset($tuz['id']) && $this->testLike($pl['x'], $pl['y'], $tuz['x'], $tuz['y']) == 1) { - $tuz['x'] = $pl['x']; - $tuz['y'] = $pl['y']; - mysql_query( - 'UPDATE `stats` SET `x` = "' . $tuz['x'] . '" , `y` = "' . $tuz['y'] . '" WHERE `id` = "' . $tuz['id'] . '" LIMIT 1' - ); - $this->botAtack($pl, $tuz, 1);//Тут - $sps = mysql_query( - 'SELECT `db`.*, `tb`.* FROM `dungeon_bots` AS `db` LEFT JOIN `test_bot` AS `tb` ON (`db`.`id_bot` = `tb`.`id`) LEFT JOIN `stats` as `st` ON (`st`.`dnow` = `db`.`dn`) WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`x` ="' . $tuz['x'] . '" AND `db`.`y` ="' . $tuz['y'] . '" AND `db`.`atack` = "0" AND `db`.`delete` = "0" AND `db`.`inBattle` = "0" GROUP BY `db`.`id2` ORDER BY `db`.`go_bot` ASC LIMIT 50' - ); - while ($pll = mysql_fetch_assoc($sps)) { - $this->botAtack($pll, $tuz, 1); - } - - } elseif ($vlb == 1) { // Передвижение ботов. - $pl['go_bot'] = time() + 10 + rand(1, 5); - $pl['x'] += $tgx; - $pl['y'] += $tgy; - mysql_query( - 'UPDATE `dungeon_bots` SET `x` = "' . $pl['x'] . '",`y` = "' . $pl['y'] . '",`go_bot` = "' . $pl['go_bot'] . '" WHERE `id2` = "' . $pl['id2'] . '" LIMIT 1' - ); - } - unset($tgx, $tgy, $vlb, $tuz); - } - } - - $sp = mysql_query( - 'SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`delete` = "0" LIMIT 50' - ); - while ($pl = mysql_fetch_assoc($sp)) { - $i++; - if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; - } - $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; - $dlg = 0; - if ($pl['dialog'] > 0) { - $dlg = $pl['dialog']; - } - $noat = 1; - if ($pl['noatack'] == 1 && $this->info['bsid'] == 0) { - $noat = 0; - } - $r .= ',' . ($i - 1) . ':{9:0,0:' . $pl['id2'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( - '.gif', '', $pl['obraz'] - ) . '\',5:\'bot\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . ',7:' . $dlg . ',8:' . $noat . '}'; - } - - return 'count:' . $i . $r; - } - public function testGo($id) { global $u, $c, $code; @@ -2092,66 +1519,109 @@ class Dungeon } } - public function testGone($id) + + //Розыгрыш предмета + + public function genMatix() { - global $u, $c, $code; - $go = 0; - if ($id == 1) { - //вперед - $go = $this->sg[$this->gs][1]; - } elseif ($id == 2) { - //назад - $go = $this->sg[$this->gs][3]; - } elseif ($id == 3) { - //на право - $go = $this->sg[$this->gs][4]; - } elseif ($id == 4) { - //на лево - $go = $this->sg[$this->gs][2]; - } - $thp = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' - ) - ); - $ng = [4 => 1, 2 => 2, 1 => 3, 3 => 4]; - if (isset($thp['id']) && $thp['go_' . $ng[$go]] == 0) { - $go = 0; - } - $tgo = [0 => 0, 1 => 0]; - if ($go == 1) { - $tgo[1] += 1; - } elseif ($go == 2) { - $tgo[0] -= 1; - } elseif ($go == 3) { - $tgo[1] -= 1; - } elseif ($go == 4) { - $tgo[0] += 1; - } + $r = []; + if ($this->gs == 1) { + //1; //смотрим прямо + $r[1] = $this->getMatrix(0, -1); # слева от меня + $r[2] = $this->getMatrix(0, 0); # подомной + $r[3] = $this->getMatrix(0, 1); # справа от меня + $r[4] = $this->getMatrix(1, -1); # слева +1 вперед + $r[5] = $this->getMatrix(1, 0); # передомной +1 + $r[6] = $this->getMatrix(1, 1); # справа +1 вперед + $r[7] = $this->getMatrix(2, 1); # справа +2 вперед + $r[8] = $this->getMatrix(2, 0); # передомной +2 + $r[9] = $this->getMatrix(2, -1); # слева +2 вперед + $r[10] = $this->getMatrix(3, -2); # слева через одну, +3 вперед + $r[11] = $this->getMatrix(3, -1); # слева +3 вперед + $r[12] = $this->getMatrix(3, 0); # передомной +3 + $r[13] = $this->getMatrix(3, 1); # справа +3 вперед + $r[14] = $this->getMatrix(3, 2); # справа через одну, +3 вперед + $r[15] = $this->getMatrix(4, 0); # передомной +4 + $r[16] = $this->getMatrix(4, -1); # слева +4 вперед + $r[17] = $this->getMatrix(4, 1); # справа +4 вперед + $r[18] = $this->getMatrix(4, 2); # справа через одну, +4 вперед + $r[19] = $this->getMatrix(4, -2); # слева через одну, +4 вперед - $tbot = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `dungeon_bots` WHERE `x` = "' . ($u->info['x'] + (int)$tgo[0]) . '" AND `y` = "' . ($u->info['y'] + (int)$tgo[1]) . '" AND `dn` = "' . $this->info['id'] . '" AND `for_dn` = "0" AND `delete` = "0" LIMIT 1' - ) - ); - if (isset($tbot['id2']) && $u->info['admin'] == 0) { - $go = 0; - } - - return $go; - } - - public function testSt($id, $s) - { - $r = 0; - //заменяем отображение стен в зависимости от угла обзора - $s = $this->sg[$this->gs][$s]; - if (isset($this->map[1][$id]['id'])) { - $r = $this->map[1][$id]['st'][($s - 1)]; + } elseif ($this->gs == 2) { + //2; //смотрим лево + $r[1] = $this->getMatrix(-1, 0); + $r[2] = $this->getMatrix(0, 0); + $r[3] = $this->getMatrix(1, 0); + $r[4] = $this->getMatrix(-1, -1); + $r[5] = $this->getMatrix(0, -1); + $r[6] = $this->getMatrix(1, -1); + $r[7] = $this->getMatrix(1, -2); + $r[8] = $this->getMatrix(0, -2); + $r[9] = $this->getMatrix(-1, -2); + $r[10] = $this->getMatrix(-2, -3); + $r[11] = $this->getMatrix(-1, -3); + $r[12] = $this->getMatrix(0, -3); + $r[13] = $this->getMatrix(1, -3); + $r[14] = $this->getMatrix(2, -3); + $r[15] = $this->getMatrix(0, -4); + $r[16] = $this->getMatrix(-1, -4); + $r[17] = $this->getMatrix(1, -4); + $r[18] = $this->getMatrix(2, -4); + $r[19] = $this->getMatrix(-2, -4); + } elseif ($this->gs == 3) { + //3; //смотрим вниз + $r[1] = $this->getMatrix(0, 1); + $r[2] = $this->getMatrix(0, 0); + $r[3] = $this->getMatrix(0, -1); + $r[4] = $this->getMatrix(-1, 1); + $r[5] = $this->getMatrix(-1, 0); + $r[6] = $this->getMatrix(-1, -1); + $r[7] = $this->getMatrix(-2, -1); + $r[8] = $this->getMatrix(-2, 0); + $r[9] = $this->getMatrix(-2, 1); + $r[10] = $this->getMatrix(-3, 2); + $r[11] = $this->getMatrix(-3, 1); + $r[12] = $this->getMatrix(-3, 0); + $r[13] = $this->getMatrix(-3, -1); + $r[14] = $this->getMatrix(-3, -2); + $r[15] = $this->getMatrix(-4, 0); + $r[16] = $this->getMatrix(-4, 1); + $r[17] = $this->getMatrix(-4, -1); + $r[18] = $this->getMatrix(-4, -2); + $r[19] = $this->getMatrix(-4, 2); + } elseif ($this->gs == 4) { + //4; //смотрим право + $r[1] = $this->getMatrix(1, 0); + $r[2] = $this->getMatrix(0, 0); + $r[3] = $this->getMatrix(-1, 0); + $r[4] = $this->getMatrix(1, 1); + $r[5] = $this->getMatrix(0, 1); + $r[6] = $this->getMatrix(-1, 1); + $r[7] = $this->getMatrix(-1, 2); + $r[8] = $this->getMatrix(0, 2); + $r[9] = $this->getMatrix(1, 2); + $r[10] = $this->getMatrix(2, 3); + $r[11] = $this->getMatrix(1, 3); + $r[12] = $this->getMatrix(0, 3); + $r[13] = $this->getMatrix(-1, 3); + $r[14] = $this->getMatrix(-2, 3); + $r[15] = $this->getMatrix(0, 4); + $r[16] = $this->getMatrix(1, 4); + $r[17] = $this->getMatrix(-1, 4); + $r[18] = $this->getMatrix(-2, 4); + $r[19] = $this->getMatrix(2, 4); } return $r; } + public function getMatrix($y, $x) + { + global $u; + $this->cord['x']++; + $this->cord[($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)] = $this->cord['x']; + return $this->map[0][($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)]; + } + public function lookDungeon() { global $u, $c, $code, $pd; @@ -2243,103 +1713,630 @@ class Dungeon } - public function getMatrix($y, $x) + public function testSt($id, $s) { - global $u; - $this->cord['x']++; - $this->cord[($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)] = $this->cord['x']; - return $this->map[0][($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)]; - } - - public function genMatix() - { - $r = []; - if ($this->gs == 1) { - //1; //смотрим прямо - $r[1] = $this->getMatrix(0, -1); # слева от меня - $r[2] = $this->getMatrix(0, 0); # подомной - $r[3] = $this->getMatrix(0, 1); # справа от меня - $r[4] = $this->getMatrix(1, -1); # слева +1 вперед - $r[5] = $this->getMatrix(1, 0); # передомной +1 - $r[6] = $this->getMatrix(1, 1); # справа +1 вперед - $r[7] = $this->getMatrix(2, 1); # справа +2 вперед - $r[8] = $this->getMatrix(2, 0); # передомной +2 - $r[9] = $this->getMatrix(2, -1); # слева +2 вперед - $r[10] = $this->getMatrix(3, -2); # слева через одну, +3 вперед - $r[11] = $this->getMatrix(3, -1); # слева +3 вперед - $r[12] = $this->getMatrix(3, 0); # передомной +3 - $r[13] = $this->getMatrix(3, 1); # справа +3 вперед - $r[14] = $this->getMatrix(3, 2); # справа через одну, +3 вперед - $r[15] = $this->getMatrix(4, 0); # передомной +4 - $r[16] = $this->getMatrix(4, -1); # слева +4 вперед - $r[17] = $this->getMatrix(4, 1); # справа +4 вперед - $r[18] = $this->getMatrix(4, 2); # справа через одну, +4 вперед - $r[19] = $this->getMatrix(4, -2); # слева через одну, +4 вперед - - } elseif ($this->gs == 2) { - //2; //смотрим лево - $r[1] = $this->getMatrix(-1, 0); - $r[2] = $this->getMatrix(0, 0); - $r[3] = $this->getMatrix(1, 0); - $r[4] = $this->getMatrix(-1, -1); - $r[5] = $this->getMatrix(0, -1); - $r[6] = $this->getMatrix(1, -1); - $r[7] = $this->getMatrix(1, -2); - $r[8] = $this->getMatrix(0, -2); - $r[9] = $this->getMatrix(-1, -2); - $r[10] = $this->getMatrix(-2, -3); - $r[11] = $this->getMatrix(-1, -3); - $r[12] = $this->getMatrix(0, -3); - $r[13] = $this->getMatrix(1, -3); - $r[14] = $this->getMatrix(2, -3); - $r[15] = $this->getMatrix(0, -4); - $r[16] = $this->getMatrix(-1, -4); - $r[17] = $this->getMatrix(1, -4); - $r[18] = $this->getMatrix(2, -4); - $r[19] = $this->getMatrix(-2, -4); - } elseif ($this->gs == 3) { - //3; //смотрим вниз - $r[1] = $this->getMatrix(0, 1); - $r[2] = $this->getMatrix(0, 0); - $r[3] = $this->getMatrix(0, -1); - $r[4] = $this->getMatrix(-1, 1); - $r[5] = $this->getMatrix(-1, 0); - $r[6] = $this->getMatrix(-1, -1); - $r[7] = $this->getMatrix(-2, -1); - $r[8] = $this->getMatrix(-2, 0); - $r[9] = $this->getMatrix(-2, 1); - $r[10] = $this->getMatrix(-3, 2); - $r[11] = $this->getMatrix(-3, 1); - $r[12] = $this->getMatrix(-3, 0); - $r[13] = $this->getMatrix(-3, -1); - $r[14] = $this->getMatrix(-3, -2); - $r[15] = $this->getMatrix(-4, 0); - $r[16] = $this->getMatrix(-4, 1); - $r[17] = $this->getMatrix(-4, -1); - $r[18] = $this->getMatrix(-4, -2); - $r[19] = $this->getMatrix(-4, 2); - } elseif ($this->gs == 4) { - //4; //смотрим право - $r[1] = $this->getMatrix(1, 0); - $r[2] = $this->getMatrix(0, 0); - $r[3] = $this->getMatrix(-1, 0); - $r[4] = $this->getMatrix(1, 1); - $r[5] = $this->getMatrix(0, 1); - $r[6] = $this->getMatrix(-1, 1); - $r[7] = $this->getMatrix(-1, 2); - $r[8] = $this->getMatrix(0, 2); - $r[9] = $this->getMatrix(1, 2); - $r[10] = $this->getMatrix(2, 3); - $r[11] = $this->getMatrix(1, 3); - $r[12] = $this->getMatrix(0, 3); - $r[13] = $this->getMatrix(-1, 3); - $r[14] = $this->getMatrix(-2, 3); - $r[15] = $this->getMatrix(0, 4); - $r[16] = $this->getMatrix(1, 4); - $r[17] = $this->getMatrix(-1, 4); - $r[18] = $this->getMatrix(-2, 4); - $r[19] = $this->getMatrix(2, 4); + $r = 0; + //заменяем отображение стен в зависимости от угла обзора + $s = $this->sg[$this->gs][$s]; + if (isset($this->map[1][$id]['id'])) { + $r = $this->map[1][$id]['st'][($s - 1)]; } return $r; } + + public function initPoint(int $x, int $y): void + { + $this->point = Db::getRow('select * from dungeon_map where id_dng = ? and x = ? and y = ? limit 1', [$this->info['id2'], $x, $y]); + } + + public function pickitem($obj, int $itm, $for, $data = '', $dn_delete = false, $chat = 0): bool + { + global $u; + $itm = mysql_fetch_assoc( + mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1') + ); + if (!isset($itm['id'])) { + return false; + } + $tou = 0; //какому юзеру предназначено + /* выделяем случайного юзера из команды */ + $itmnm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1')); + $itmnm = $itmnm['name']; + $asex = ''; + if ($u->info['sex'] == 1) { + $asex = 'а'; + } + + if ($for > 0) { + $tou = $for; + $rtxt = '' . $u->info['login'] . ' обнаружил' . $asex . ' предмет "' . $itm['name'] . '" в "' . $obj['name'] . '"'; + } else { + $rtxt = '' . $u->info['login'] . ' обнаружил' . $asex . ' предмет "' . $itm['name'] . '" в "' . $obj['name'] . '", и вы решили разыграть его'; + } + $dn_delete = $dn_delete ? 1 : 0; + + if ($chat == 0) { + $this->sys_chat($rtxt); + } + mysql_query( + 'INSERT INTO `dungeon_items` (`dn_delete`,`data`,`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( + "' . $dn_delete . '", + "' . mysql_real_escape_string($data) . '", + "' . $u->info['dnow'] . '", + "' . $tou . '", + "' . $itm['id'] . '", + "' . time() . '", + "' . $u->info['x'] . '", + "' . $u->info['y'] . '")' + ); + + return true; + } + + public function n_lead($who, $lead) + { + global $u, $c, $code; + + $to = mysql_fetch_assoc( + mysql_query( + 'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string( + $who + ) . '" LIMIT 1' + ) + ); + + if ($this->info['uid'] != $lead) { + $this->error = 'Вы не лидер...'; + } elseif (!isset($to['id'])) { + $this->error = 'Персонаж не найден...'; + } elseif ($to['id'] == $this->info['uid']) { + $this->error = 'Вы и так лидер...'; + } elseif ($to['dnow'] != $this->info['id']) { + $this->error = 'Персонаж не найден в вашей команде...'; + } else { + mysql_query( + 'UPDATE `dungeon_now` SET `uid` = "' . $to['id'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' + ); + if ($u->info['sex'] == 0) { + $this->sys_chat( + '' . $u->info['login'] . ' передал лидерство в группе персонажу ' . $to['login'] . '' + ); + } else { + $this->sys_chat( + '' . $u->info['login'] . ' передала лидерство в группе персонажу ' . $to['login'] . '' + ); + } + //header('Location: main.php'); + die(''); + } + } + + public function go_to_hell($who, $lead) + { + global $u, $c, $code; + + $to = mysql_fetch_assoc( + mysql_query( + 'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string( + $who + ) . '" LIMIT 1' + ) + ); + + if ($this->info['uid'] != $lead) { + $this->error = 'Вы не лидер...'; + } elseif (!isset($to['id'])) { + $this->error = 'Персонаж не найден...'; + } elseif ($to['id'] == $this->info['uid']) { + $this->error = 'Лидера нельзя выгнать...'; + } elseif ($to['dnow'] != $this->info['id']) { + $this->error = 'Персонаж не найден в вашей команде...'; + } else { + $rb = 321; // Магический портал + if ($u->info['room'] == 304) { + $rb = 209; // Вход в ледяную пещеру + } elseif ($u->info['room'] == 396) { + $rb = 395; // Канализация (Ангелс) + } elseif ($u->info['room'] == 398) { + $rb = 321; // Все пещеры + } elseif ($this->info['id2'] == 3) { + $rb = 293; // Вход в Катакомбы + } elseif ($this->info['id2'] == 1) { + $rb = 188; // Вход в Канализацию + } elseif ($this->info['id2'] == 13) { + $rb = 275; // Гора Легиона + } elseif ($this->info['id2'] == 12) { + $rb = 372; // Вход в Пещеру Тысячи Проклятий + } elseif ($this->info['id2'] == 444) { + $rb = 321; // Вход в пещеру инкв + } elseif ($this->info['id2'] == 31) { + $rb = 321; // Вход в пещеру инкв + } elseif ($this->info['id2'] == 101) { + $rb = 321; // Вход в Бездну + + } + + $sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50'); + while ($pl = mysql_fetch_assoc($sp)) { + $cn = mysql_fetch_assoc( + mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1') + ); + if (!isset($cn['id'])) { + mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"'); + mysql_query( + 'UPDATE `dungeon_now` SET `time_finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' + ); + } + } + + $city = mysql_fetch_assoc( + mysql_query('SELECT `id`, `city` FROM `room` WHERE `id` = "' . $rb . '" LIMIT 1') + ); + mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + mysql_query( + 'UPDATE `users` SET `room` = "' . $rb . '", `city`="' . $city['city'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + //удаляем все предметы которые пропадают после выхода из пещеры + mysql_query( + 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `dn_delete` = "1" LIMIT 1000' + ); + + mysql_query( + 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000' + ); + + if ($u->info['sex'] == 0) { + $this->sys_chat( + '' . $u->info['login'] . ' выгнал из похода персонажа ' . $to['login'] . '' + ); + } else { + $this->sys_chat( + '' . $u->info['login'] . ' выгнала из похода персонажа ' . $to['login'] . '' + ); + } + header('Location: /main.php'); + } + } + + public function usersDng($laba = false) + { + global $u, $c; + $r = ''; + $stt = []; + if ($laba == false) { + $sp = mysql_query( + 'SELECT `u`.`id`,`st`.`id` FROM `stats` AS `u` LEFT JOIN `users` AS `st` ON (`st`.`id` = `u`.`id`) WHERE `u`.`dnow` = "' . $this->info['id'] . '" LIMIT 10' + ); + } else { + $sp = mysql_query( + 'SELECT `u`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`st`.`id` = `u`.`id`) WHERE `u`.`room` = 370 AND `st`.`dnow` = "' . $laba . '" AND `st`.`bot` = 0 LIMIT 6' + ); + } + while ($pl = mysql_fetch_assoc($sp)) { + $stt = $u->getStats($pl['id'], 0); + if ($stt['mpAll'] > 0) { + $pm = $stt['mpNow'] / $stt['mpAll'] * 100; + } + $ph = $stt['hpNow'] / $stt['hpAll'] * 100; + $r .= ' + +
  ' . $u->microLogin($pl['id'], 1) . '   ' . floor( + $stt['hpNow'] + ) . '/' . $stt['hpAll'] . ' +
+
+
+'; + if ($stt['mpAll'] > 0) { + $r .= '
' . floor( + $stt['mpNow'] + ) . '/' . $stt['mpAll'] . '
+
+
+
'; + } + $r .= '
'; + if ($this->info['uid'] == $pl['id']) { + $r .= ''; + } + if ($this->info['uid'] == $u->info['id'] && $pl['id'] == $u->info['id'] && $this->info['id2'] != 15) { + $r .= ' '; + $r .= ' '; + } + $r .= '

'; + $r .= ''; + } + unset($stt, $ph, $pm); + return $r; + } + + public function testDie() + { + global $u, $c, $code; + $dies = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "die" LIMIT 1' + ) + ); + $dies = $dies[0]; + + + if ($u->stats['hpNow'] < 1 || $dies > 2) { + if ($dies < 2) { + mysql_query( + 'INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $u->info['dnow'] . '","' . $u->info['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time() . '","die","" + )' + ); + //21:50 Ярополк трагически погиб и находится в комнате "Этаж 2 - Водосток" + $dnow = mysql_fetch_assoc( + mysql_query('SELECT id2 FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1') + ); + $room = mysql_fetch_assoc( + mysql_query( + 'SELECT name FROM `dungeon_map_info` WHERE `x` = "' . $u->info['res_x'] . '" AND `y` = "' . $u->info['res_y'] . '" AND `id_dng` = "' . $dnow['id2'] . '" LIMIT 1' + ) + ); + + if ($u->info['sex'] == 0) { + $this->sys_chat( + '' . $u->info['login'] . ' трагически погиб и находится в комнате "' . $room['name'] . '"' + ); + } else { + $this->sys_chat( + '' . $u->info['login'] . ' трагически погибла и находится в комнате "' . $room['name'] . '"' + ); + } + mysql_query( + 'UPDATE `stats` SET `hpNow` = "1",`x` = "' . $u->info['res_x'] . '",`y` = "' . $u->info['res_y'] . '",`s` = "' . $u->info['res_s'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + //header('location: main.php'); + die(''); + } else { + mysql_query( + 'INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( + "' . $u->info['dnow'] . '","' . $u->info['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","' . time() . '","die","" + )' + ); + //21:50 Ярополк трагически погиб и находится в комнате "Этаж 2 - Водосток" + if ($u->info['sex'] == 0) { + $this->sys_chat('' . $u->info['login'] . ' трагически погиб без права на воскрешение'); + } else { + $this->sys_chat('' . $u->info['login'] . ' трагически погибла без права на воскрешение'); + } + $_GET['exitd'] = true; + } + } + } + + public function itemsMap() + { + global $u, $c, $code; + $r = ''; + $liveUsers = Db::getValue('select count(*) from stats where dnow = ?', [$this->info['id']]); + $sp = mysql_query( + 'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`dn` = "' . $this->info['id'] . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND ( `ish`.`onlyfor` = "0" OR `ish`.`onlyfor` = "' . $u->info['id'] . '" ) AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 100' + ); + while ($pl = mysql_fetch_assoc($sp)) { + $action = 'main.php?take=' . $pl['id'] . ''; + $tk = 0; + $luck_users = mysql_fetch_assoc( + mysql_query( + 'SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string( + $pl['id'] + ) . '" LIMIT 1' + ) + ); + $luck_users = $luck_users[0]; + if ($pl['user'] == 0 && $liveUsers > 1 && ($pl['time'] + 300 > time() || $luck_users < 1)) { + $fxv = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $this->info['id'] . '" AND `vars` = "luck_itm' . $pl['id'] . '" LIMIT 1' + ) + ); + //Розыгрыш + if (!isset($fxv['id']) && $this->info['bsid'] == 0) { + $action = "javascript: top.fartgame('{$pl['id']}', '{$pl['img']}', '{$pl['name']}')"; + $tk = 1; + } + } + if ($tk == 0) { + $r .= ''; + } elseif ($tk == 1) { + $r .= ''; + } + } + if ($r != '') { + $r = '

В комнате разбросаны вещи:

' . $r; //
Подобрать все
+ } + return $r; + } + + public function genObjects() + { + global $u, $c, $code; + ////i:{id,name,mapPoint,action,img,type}, + //'count':1,0:{0:1234,1:'Сундук',2:5,3:'',4:'test.gif',5:0,6:position,7:width,8:heigh,9:left,10:top}, + //psition 0 - по центру , 1- сверху, 2- слева, 3- снизу, 4- справа + $r = ''; + $whr = [1 => ' (((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` >= ' . ($u->info['y'] + 1) . ' && `u`.`y` <= ' . ($u->info['y'] + 4) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //прямо + 3 => ' (((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` <= ' . ($u->info['y'] - 1) . ' && `u`.`y` >= ' . ($u->info['y'] - 4) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //вниз + 2 => ' (((`u`.`x` <= ' . ($u->info['x'] - 1) . ' && `u`.`x` >= ' . ($u->info['x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . '))OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //лево + 4 => ' (((`u`.`x` >= ' . ($u->info['x'] + 1) . ' && `u`.`x` <= ' . ($u->info['x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) OR (`u`.`y` = ' . $u->info['y'] . ' && `u`.`x` = ' . $u->info['x'] . ')) ', //право + ]; + $sp = mysql_query( + 'SELECT `u`.* FROM `dungeon_obj` AS `u` WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND `u`.`for_dn` = "0" AND ((`u`.`s` = "0" OR `u`.`s` = "' . $this->gs . '") OR `u`.`s2` = "' . $this->gs . '") AND ' . $whr[$this->gs] . ' LIMIT 150' + ); + $i = 0; + $pos = []; + while ($pl = mysql_fetch_assoc($sp)) { + if ($pl['fix_x_y'] == 0 || ($pl['fix_x_y'] == 1 && $pl['x'] == $u->info['x']) || ($pl['fix_x_y'] == 2 && $pl['y'] == $u->info['y']) || ($pl['fix_x_y'] == 3 && $pl['x'] == $u->info['x'] && $pl['y'] == $u->info['y'])) { + if (($pl['os1'] == 0 && $pl['os2'] == 0 && $pl['os3'] == 0 && $pl['os4'] == 0) || ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'])) { + $i++; + if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; + } + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; + $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'action\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; + } elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] - 1) { + $dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{')); + $da = []; + $is = 0; + while ($is < count($dt2)) { + $dt2[$is] = explode(':', $dt2[$is]); + $da[$dt2[$is][0]] = $dt2[$is][1]; + $is++; + } + if (isset($da['use'])) { + unset($da['use']); + } // Справа + if (isset($da['rl2'])) { + $da['rl2'] = -round((int)$da['rl2'] * 1.55); + } // Слева + if (isset($da['rl3'])) { + $da['rl3'] = round((int)$da['rl3'] + 160); + } + if (isset($da['rl4'])) { + $da['rl4'] = round((int)$da['rl4'] - 120); + } + $pl['date'] = str_replace('"', '', json_encode($da)); + + + $i++; + if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; + } + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; + $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; + } elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] + 1) { + + $dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{')); + $da = []; + $is = 0; + while ($is < count($dt2)) { + $dt2[$is] = explode(':', $dt2[$is]); + $da[$dt2[$is][0]] = $dt2[$is][1]; + $is++; + } + if (isset($da['use'])) { + unset($da['use']); + } // Справа + if (isset($da['rl2'])) { + $da['rl2'] = 355 - round((int)$da['rl2'] * 0.30); + } // Справа + if (isset($da['rl3'])) { + $da['rl3'] = round((int)$da['rl3'] - 160); + } + if (isset($da['rl4'])) { + $da['rl4'] = round((int)$da['rl4'] + 120); + } + $pl['date'] = str_replace('"', '', json_encode($da)); + $i++; + if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; + } + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; + $r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}'; + } + } + } + return 'count:' . $i . $r; + } + + public function genUsers() + { + global $u, $c, $code; + ////i:{id,login,mapPoint,sex,obraz,type,users_p}, + //'count':1,0:{0:1015,1:'Test1',2:5,3:0,4:'1',5:'user',6:1}, + $r = ''; + $whr = [1 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` >= ' . $u->info['y'] . ' && `u`.`y` <= ' . ($u->info['y'] + 4) . ')) ', //прямо + 3 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` <= ' . $u->info['y'] . ' && `u`.`y` >= ' . ($u->info['y'] - 4) . ')) ', //вниз + 2 => ' ((`u`.`x` <= ' . $u->info['x'] . ' && `u`.`x` >= ' . ($u->info['x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //лево + 4 => ' ((`u`.`x` >= ' . $u->info['x'] . ' && `u`.`x` <= ' . ($u->info['x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //право + ]; + // + $tmsu = mysql_fetch_assoc( + mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1') + ); + // + $sp = mysql_query( + 'SELECT `u`.*,`st`.* FROM `stats` AS `u` LEFT JOIN `users` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`dnow` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`id` != "' . $u->info['id'] . '" LIMIT 100' + ); + $i = 0; + $pos = []; + while ($pl = mysql_fetch_assoc($sp)) { + $i++; + if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; + } + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; + $noat = 0; + if ($this->info['bsid'] > 0) { + $noat = 1; + } + if ($this->info['id2'] == 15) { + //Хоккей + $r .= ',' . ($i - 1) . ':{8:' . $noat . ',0:' . $pl['id'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( + '.gif', '', $pl['obraz'] + ) . '\',5:\'user\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . ''; + // + $tms = mysql_fetch_assoc( + mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $pl['id'] . '" LIMIT 1') + ); + if ($tms['team'] == $tmsu['team']) { + $r .= ',9:1'; + } else { + $r .= ',9:2'; + } + $r .= ''; + // + $r .= '}'; + } else { + $r .= ',' . ($i - 1) . ':{9:0,8:' . $noat . ',0:' . $pl['id'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( + '.gif', '', $pl['obraz'] + ) . '\',5:\'user\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . '}'; + } + } + + //отображаем ботов + // + //$sp = mysql_query('SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "'.$u->info['dnow'].'" AND `u`.`atack` = "0" AND `u`.`delete` = "0" AND `u`.`inBattle` = "0" AND `u`.`go_bot` > 0 ORDER BY `u`.`go_bot` ASC LIMIT 35'); + + // Выбираем Ботов в подземельи, которые Не в бою, Живые, и не дальше чем -\+30 по X и -\+35 по Y (дабы не гонять всех ботов, меньше выборка). + + $sp = mysql_query( + 'SELECT `db`.*, `tb`.* FROM `dungeon_bots` AS `db` LEFT JOIN `test_bot` AS `tb` ON (`db`.`id_bot` = `tb`.`id`) LEFT JOIN `stats` as `st` ON (`st`.`dnow` = `db`.`dn`) WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`x` > `st`.`x`-30 AND `db`.`x` < `st`.`x`+30 AND `db`.`y` > `st`.`y`-35 AND `db`.`y` < `st`.`y`+35 AND `db`.`atack` = "0" AND `db`.`delete` = "0" AND `db`.`inBattle` = "0" AND `db`.`go_bot` > 0 GROUP BY `db`.`id2` ORDER BY `db`.`go_bot` ASC LIMIT 100' + ); + while ($pl = mysql_fetch_assoc($sp)) { + //перемещение бота, каждые 3-10 сек. + if ($pl['go_bot'] > 0 && $pl['go_bot'] <= time()) { + $tgx = rand(-1, 1); + $tgy = rand(-1, 1); + if ($tgx != 0 && $tgy != 0) { + if (rand(0, 1) == 1) { + $tgy = 0; + } else { + $tgx = 0; + } + } + $vlb = $this->testLike($pl['x'], $pl['y'], $pl['x'] + $tgx, $pl['y'] + $tgy); + //Кто-то рядом + $tuz = mysql_fetch_assoc( + mysql_query( + 'SELECT `x`,`y`,`id`,`hpNow` FROM `stats` WHERE `dnow` = "' . $this->info['id'] . '" AND ( (`x` = ' . ($pl['x'] + 1) . ' AND `y` = ' . ($pl['y']) . ') OR (`x` = ' . ($pl['x'] - 1) . ' AND `y` = ' . ($pl['y']) . ') OR (`x` = ' . ($pl['x']) . ' AND `y` = ' . ($pl['y'] + 1) . ') OR (`x` = ' . ($pl['x']) . ' AND `y` = ' . ($pl['y'] - 1) . ') ) LIMIT 1' + ) + ); + + if (isset($tuz['id']) && $this->testLike($pl['x'], $pl['y'], $tuz['x'], $tuz['y']) == 1) { + $tuz['x'] = $pl['x']; + $tuz['y'] = $pl['y']; + mysql_query( + 'UPDATE `stats` SET `x` = "' . $tuz['x'] . '" , `y` = "' . $tuz['y'] . '" WHERE `id` = "' . $tuz['id'] . '" LIMIT 1' + ); + $this->botAtack($pl, $tuz, 1);//Тут + $sps = mysql_query( + 'SELECT `db`.*, `tb`.* FROM `dungeon_bots` AS `db` LEFT JOIN `test_bot` AS `tb` ON (`db`.`id_bot` = `tb`.`id`) LEFT JOIN `stats` as `st` ON (`st`.`dnow` = `db`.`dn`) WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`x` ="' . $tuz['x'] . '" AND `db`.`y` ="' . $tuz['y'] . '" AND `db`.`atack` = "0" AND `db`.`delete` = "0" AND `db`.`inBattle` = "0" GROUP BY `db`.`id2` ORDER BY `db`.`go_bot` ASC LIMIT 50' + ); + while ($pll = mysql_fetch_assoc($sps)) { + $this->botAtack($pll, $tuz, 1); + } + + } elseif ($vlb == 1) { // Передвижение ботов. + $pl['go_bot'] = time() + 10 + rand(1, 5); + $pl['x'] += $tgx; + $pl['y'] += $tgy; + mysql_query( + 'UPDATE `dungeon_bots` SET `x` = "' . $pl['x'] . '",`y` = "' . $pl['y'] . '",`go_bot` = "' . $pl['go_bot'] . '" WHERE `id2` = "' . $pl['id2'] . '" LIMIT 1' + ); + } + unset($tgx, $tgy, $vlb, $tuz); + } + } + + $sp = mysql_query( + 'SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`delete` = "0" LIMIT 50' + ); + while ($pl = mysql_fetch_assoc($sp)) { + $i++; + if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) { + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0; + } + $pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++; + $dlg = 0; + if ($pl['dialog'] > 0) { + $dlg = $pl['dialog']; + } + $noat = 1; + if ($pl['noatack'] == 1 && $this->info['bsid'] == 0) { + $noat = 0; + } + $r .= ',' . ($i - 1) . ':{9:0,0:' . $pl['id2'] . ',1:\'' . $pl['login'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:' . $pl['sex'] . ',4:\'' . str_replace( + '.gif', '', $pl['obraz'] + ) . '\',5:\'bot\',6:' . $pos[$this->cord[$pl['y'] . '_' . $pl['x']]] . ',7:' . $dlg . ',8:' . $noat . '}'; + } + + return 'count:' . $i . $r; + } + + public function testGone($id) + { + global $u, $c, $code; + $go = 0; + if ($id == 1) { + //вперед + $go = $this->sg[$this->gs][1]; + } elseif ($id == 2) { + //назад + $go = $this->sg[$this->gs][3]; + } elseif ($id == 3) { + //на право + $go = $this->sg[$this->gs][4]; + } elseif ($id == 4) { + //на лево + $go = $this->sg[$this->gs][2]; + } + $thp = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_map` WHERE `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" AND `id_dng` = "' . $this->info['id2'] . '" LIMIT 1' + ) + ); + $ng = [4 => 1, 2 => 2, 1 => 3, 3 => 4]; + if (isset($thp['id']) && $thp['go_' . $ng[$go]] == 0) { + $go = 0; + } + $tgo = [0 => 0, 1 => 0]; + if ($go == 1) { + $tgo[1] += 1; + } elseif ($go == 2) { + $tgo[0] -= 1; + } elseif ($go == 3) { + $tgo[1] -= 1; + } elseif ($go == 4) { + $tgo[0] += 1; + } + + $tbot = mysql_fetch_assoc( + mysql_query( + 'SELECT * FROM `dungeon_bots` WHERE `x` = "' . ($u->info['x'] + (int)$tgo[0]) . '" AND `y` = "' . ($u->info['y'] + (int)$tgo[1]) . '" AND `dn` = "' . $this->info['id'] . '" AND `for_dn` = "0" AND `delete` = "0" LIMIT 1' + ) + ); + if (isset($tbot['id2']) && $u->info['admin'] == 0) { + $go = 0; + } + + return $go; + } } diff --git a/modules_data/location/dungeon.php b/modules_data/location/dungeon.php index acb9588f..57855f34 100644 --- a/modules_data/location/dungeon.php +++ b/modules_data/location/dungeon.php @@ -1,7 +1,10 @@ - var elem = document.getElementById('se-pre-con'); + "; @@ -10,1278 +13,1117 @@ if (!defined('GAME')) { } -if ($u->room['file'] == 'dungeon') { - $pd = [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, //передняя стенка, в 2-х шагах - 10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 0, 16 => 0, 17 => 0, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, /* Растояние: 1 шаг */ - 24 => 0, //стена прямо слева от персонажа (1) - 25 => 0, //стена прямо справа от персонажа (1) - 26 => 0, //стена прямо перед персонажем (1) - 27 => 0, //стена слева от персонажа (1) - 28 => 0 //стена справа от персонажа (1) - ]; +if ($u->room['file'] != 'dungeon') { + return; +} +$pd = [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, //передняя стенка, в 2-х шагах + 10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 0, 16 => 0, 17 => 0, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, /* Растояние: 1 шаг */ + 24 => 0, //стена прямо слева от персонажа (1) + 25 => 0, //стена прямо справа от персонажа (1) + 26 => 0, //стена прямо перед персонажем (1) + 27 => 0, //стена слева от персонажа (1) + 28 => 0, //стена справа от персонажа (1) +]; - if (isset($_POST['go_to_admin']) && $u->info['admin'] == 1 && $u->info['login'] == 'Crowley') { - mysql_query('UPDATE `stats` SET `x` = "' . round((int)$_POST['g__x']) . '", `y` = "' . round((int)$_POST['g__y']) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - if ($_POST['g__restorebot']) { - mysql_query('UPDATE `dungeon_bots` SET `delete` = "0" WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = 1 LIMIT 50'); - } - header('Location: /main.php'); +if (isset($_POST['go_to_admin']) && $u->info['admin'] == 1 && $u->info['login'] == 'Crowley') { + mysql_query('UPDATE `stats` SET `x` = "' . round((int)$_POST['g__x']) . '", `y` = "' . round((int)$_POST['g__y']) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + if ($_POST['g__restorebot']) { + mysql_query('UPDATE `dungeon_bots` SET `delete` = "0" WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = 1 LIMIT 50'); } + header('Location: /main.php'); +} - if (isset($_GET['back'])) { - $dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1')); - $dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dp['id2'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` ="' . $u->info['y'] . '" LIMIT 1')); - if ($dp['file'] != '0') { - $file = explode('=', $dp['file']); - if (isset($file[1])) { - if ($file[3] < 1 || $file[3] > 4) { - $file[3] = 1; - } - mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->info['x'] = $file[1]; - $u->info['y'] = $file[2]; - $u->info['s'] = $file[3]; +if (isset($_GET['back'])) { + $dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1')); + $dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dp['id2'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` ="' . $u->info['y'] . '" LIMIT 1')); + if ($dp['file'] != '0') { + $file = explode('=', $dp['file']); + if (isset($file[1])) { + if ($file[3] < 1 || $file[3] > 4) { + $file[3] = 1; + } + mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); + $u->info['x'] = $file[1]; + $u->info['y'] = $file[2]; + $u->info['s'] = $file[3]; + } + } + unset($dp); +} + +$d = new Dungeon; + +if (!isset($d->info['id'])) { + $_GET['exitd'] = true; +} + +$dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "die" LIMIT 1')); +$dies = $dies[0]; + +if ($dies >= 3) { + $_GET['exitd'] = true; +} + +$d->initPoint($u->info['x'], $u->info['y']); + +if (!isset($d->point['id'])) { + $d->point['css'] = 'css'; +} + +if (isset($_GET['new_leader'])) { + echo $d->n_lead($_GET['new_leader'], $u->info['id']); +} + +if (isset($_GET['go_from_psh'])) { + echo $d->go_to_hell($_GET['go_from_psh'], $u->info['id']); +} + + +if ($u->info['dnow'] == 0) { + //выкидываем из пещеры + die('Ошибки инициализации'); +} else { + + if ($d->info['bsid'] == 0 && $d->info['id2'] != 106 && isset($_GET['exitd'])) { + //Удаляем обьекты и т.д. из старых пещер + $rb = 321; // Магический портал + + $sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50'); + while ($pl = mysql_fetch_array($sp)) { + $cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1')); + if (!isset($cn['id'])) { + mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); + mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"'); + mysql_query('UPDATE `dungeon_now` SET `time_finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); } } - unset($dp); - } - - $d = new Dungeon; - $d->start(); - - if (!isset($d->info['id'])) { - $_GET['exitd'] = true; - } - - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "die" LIMIT 1')); - $dies = $dies[0]; - - if ($dies >= 3) { - $_GET['exitd'] = true; - } - - $d->point = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $d->info['id2'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` ="' . $u->info['y'] . '" LIMIT 1')); - - if (!isset($d->point['id'])) { - $d->point['css'] = 'css'; - } - - if (isset($_GET['new_leader'])) { - echo $d->n_lead($_GET['new_leader'], $u->info['id']); - } - - if (isset($_GET['go_from_psh'])) { - echo $d->go_to_hell($_GET['go_from_psh'], $u->info['id']); - } - - - if ($u->info['dnow'] == 0) { - //выкидываем из пещеры - die('Ошибки инициализации'); - } else { - - if ($d->info['id2'] == 15) { - // - $sb = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 AND `item_id` = 4910 LIMIT 1')); - // - if (isset($_GET['atackpuck'])) { - //Атакуем! - $shbtu = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`battle` FROM `users` WHERE `id` = "' . mysql_real_escape_string($_GET['atackpuck']) . '" LIMIT 1')); - if (isset($shbtu['id'])) { - $shbts = mysql_fetch_array(mysql_query('SELECT `id`,`x`,`y`,`dnow` FROM `stats` WHERE `id` = "' . $shbtu['id'] . '" LIMIT 1')); - if ($shbts['dnow'] == $u->info['dnow']) { - $tm11 = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1')); - $tm22 = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $shbtu['id'] . '" LIMIT 1')); - if ($tm11['team'] == $tm22['team']) { - $d->error = 'Вы не можете атаковать игрока из своей команды!'; - } elseif ($shbts['x'] == $u->info['x'] || $shbts['x'] == $u->info['x'] - 1 || $shbts['x'] == $u->info['x'] + 1) { - if ($shbts['x'] == $u->info['x'] || $shbts['x'] == $u->info['x'] - 1 || $shbts['x'] == $u->info['x'] + 1) { - // - if ($shbtu['battle'] > 0) { - $d->error = 'Вмешиваемся в бой против "' . $shbtu['login'] . '"!'; - } else { - $d->error = 'Атакуем "' . $shbtu['login'] . '" прямо сейчас!'; - } - // - } else { - $d->error = '"' . $shbtu['login'] . '" находится далеко от вас для паса!'; - } - } else { - $d->error = '"' . $shbtu['login'] . '" находится далеко от вас для паса!'; - } + $cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $d->info['id'] . '" AND `id` != "' . $u->info['id'] . '" ORDER BY `exp` DESC LIMIT 1')); + if (isset($cn['id'])) { + if ($d->info['uid'] == $u->info['id']) { + $cn = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $cn['id'] . '" LIMIT 1')); + mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $cn['id'] . '" WHERE `id` = "' . $d->info['id'] . '" LIMIT 1'); + if ($cn['sex'] == 0) { + if ($u->info['sex'] == 0) { + $d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стал ' . $cn['login'] . ''); } else { - $d->error = 'Игрок не найден на хоккейном поле...'; - } - } else { - $d->error = 'Игрок не найден на хоккейном поле!'; - } - } elseif (isset($_GET['addpuck']) && isset($sb['id'])) { - //Передаем шайбу - $shbtu = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`battle` FROM `users` WHERE `id` = "' . mysql_real_escape_string($_GET['addpuck']) . '" LIMIT 1')); - if (isset($shbtu['id'])) { - $shbts = mysql_fetch_array(mysql_query('SELECT `id`,`x`,`y`,`dnow` FROM `stats` WHERE `id` = "' . $shbtu['id'] . '" LIMIT 1')); - if ($shbts['dnow'] == $u->info['dnow']) { - $tm11 = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1')); - $tm22 = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $shbtu['id'] . '" LIMIT 1')); - if ($tm11['team'] != $tm22['team']) { - $d->error = 'Вы не можете дать пас сопернику!'; - } elseif ($shbts['x'] == $u->info['x'] || $shbts['x'] == $u->info['x'] - 1 || $shbts['x'] == $u->info['x'] + 1) { - if ($shbts['x'] == $u->info['x'] || $shbts['x'] == $u->info['x'] - 1 || $shbts['x'] == $u->info['x'] + 1) { - // - if ($shbtu['battle'] > 0) { - $d->error = '"' . $shbtu['login'] . '" находится в конфликте с соперником!'; - } else { - mysql_query('UPDATE `items_users` SET `uid` = "' . $shbtu['id'] . '" WHERE `id` = "' . $sb['id'] . '" LIMIT 1'); - unset($sb); - $d->error = '"' . $shbtu['login'] . '" получает пас и ведёт шайбу!'; - $d->sys_chat('' . $u->info['login'] . ' передаем пас игроку ' . $shbtu['login'] . '!'); - } - // - } else { - $d->error = '"' . $shbtu['login'] . '" находится далеко от вас для паса!'; - } - } else { - $d->error = '"' . $shbtu['login'] . '" находится далеко от вас для паса!'; - } - } else { - $d->error = 'Игрок не найден на хоккейном поле...'; - } - } else { - $d->error = 'Игрок не найден на хоккейном поле!'; - } - } - //Каток - $tm1win = mysql_fetch_array(mysql_query('SELECT SUM(`win`) FROM `katok_now` WHERE `team` = 1')); - $tm2win = mysql_fetch_array(mysql_query('SELECT SUM(`win`) FROM `katok_now` WHERE `team` = 2')); - $tm1win = 0 + $tm1win[0]; - $tm2win = 0 + $tm2win[0]; - $tmwin = 0; - if ($tm1win >= 2) { - $tmwin = 1; - } elseif ($tm2win >= 2) { - $tmwin = 2; - } - if ($tmwin > 0) { - $sp = mysql_query('SELECT * FROM `katok_now`'); - while ($pl = mysql_fetch_array($sp)) { - //Портируем персонажа обратно - mysql_query('UPDATE `users` SET `inUser` = 0, `room` = 409 WHERE `inUser` = "' . $pl['clone'] . '" LIMIT 1'); - - //Удаляем текущего бота и инвентарь - mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['clone'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['clone'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['clone'] . '"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['clone'] . '"'); - - // - mysql_query('DELETE FROM `katok_now` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - // - } - header('location: /main.php'); - die('Матч закончился! Победила команда №' . $tmwin . ''); - } - } - - if ($d->info['bsid'] == 0 && $d->info['id2'] != 106 && isset($_GET['exitd'])) { - //Удаляем обьекты и т.д. из старых пещер - $rb = 321; // Магический портал - if ($u->info['room'] == 304) { - $rb = 209; // Вход в ледяную пещеру - } elseif ($u->info['room'] == 396) { - $rb = 321; // Канализация (Ангелс) - } elseif ($u->info['room'] == 398) { - $rb = 321; // Все пещеры - } elseif ($d->info['id2'] == 3) { - $rb = 321; // Вход в Катакомбы - } elseif ($d->info['id2'] == 1) { - $rb = 321; // Вход в Канализацию - } elseif ($d->info['id2'] == 13) { - $rb = 321; // Гора Легиона - } elseif ($d->info['id2'] == 12) { - $rb = 321; // Вход в Пещеру Тысячи Проклятий - } elseif ($d->info['id2'] == 101) { - $rb = 321; // Вход в Бездну - } elseif ($d->info['id2'] == 444) { - $rb = 321; // Вход в Бездну - } elseif ($d->info['id2'] == 104) { - $rb = 2; // Вход в Шахты (зал воинов) - } - $sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50'); - while ($pl = mysql_fetch_array($sp)) { - $cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1')); - if (!isset($cn['id'])) { - mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); - mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"'); - mysql_query('UPDATE `dungeon_now` SET `time_finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - } - $cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $d->info['id'] . '" AND `id` != "' . $u->info['id'] . '" ORDER BY `exp` DESC LIMIT 1')); - if (isset($cn['id'])) { - if ($d->info['uid'] == $u->info['id']) { - $cn = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $cn['id'] . '" LIMIT 1')); - mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $cn['id'] . '" WHERE `id` = "' . $d->info['id'] . '" LIMIT 1'); - if ($cn['sex'] == 0) { - if ($u->info['sex'] == 0) { - $d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стал ' . $cn['login'] . ''); - } else { - $d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стал ' . $cn['login'] . ''); - } - } else { - if ($u->info['sex'] == 0) { - $d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стала ' . $cn['login'] . ''); - } else { - $d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стала ' . $cn['login'] . ''); - } + $d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стал ' . $cn['login'] . ''); } } else { if ($u->info['sex'] == 0) { - $d->sys_chat('' . $u->info['login'] . ' покинул подземелье!'); + $d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стала ' . $cn['login'] . ''); } else { - $d->sys_chat('' . $u->info['login'] . ' покинула подземелье!'); + $d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стала ' . $cn['login'] . ''); } } - } - - $city = mysql_fetch_assoc(mysql_query('SELECT `id`, `city` FROM `room` WHERE `id` = "' . $rb . '" LIMIT 1')); - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "' . $rb . '", `city`="' . $city['city'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - //удаляем все предметы которые пропадают после выхода из пещеры - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `dn_delete` = "1" LIMIT 1000'); - - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000'); - - //header("Location: main.php"); - echo ''; - die(); - } - } - - if ($d->point['fileadd'] == 1 && $d->point['file'] != '0' && $d->point['file'] != '') { - $file = explode('=', $d->point['file']); - if (file_exists('modules_data/location/' . $file[0])) { - $information = ''; - include_once('modules_data/location/' . $file[0]); - #header('Location: /main.php'); - } else { - if ($file[3] < 1 || $file[3] > 4) { - $file[3] = 1; - } - echo '

Локация "' . str_replace('.php', '', $file[0]) . '" не определена, вернуться назад
'; - mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - } - } - - if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] != '') { - $file = explode('=', $d->point['file']); - if (file_exists('modules_data/location/' . $file[0])) { - require_once('modules_data/location/' . $file[0]); - } else { - if ($file[3] < 1 || $file[3] > 4) { - $file[3] = 1; - } - echo '

Локация "' . str_replace('.php', '', $file[0]) . '" не определена, вернуться назад
'; - mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - } - } else { - ?> - - '; + die(); } - });*/ - location.href = "/main.php?take_obj=" + objId + "&rnd="; - } +} - function takeItem(itemId) { - /*$.ajax({ - url: "main.php?take="+itemId+"&rnd=&ajax=1", - cache: false, - success: function(html) { - $("body").html(html); +if ($d->point['fileadd'] == 1 && $d->point['file'] != '0' && $d->point['file'] != '') { + $file = explode('=', $d->point['file']); + if (file_exists('modules_data/location/' . $file[0])) { + $information = ''; + include_once('modules_data/location/' . $file[0]); + #header('Location: /main.php'); + } else { + if ($file[3] < 1 || $file[3] > 4) { + $file[3] = 1; + } + echo '

Локация "' . str_replace('.php', '', $file[0]) . '" не определена, вернуться назад
'; + mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); } - });*/ - location.href = "/main.php?take=" + itemId + "&rnd="; - } +} - function Fast(look) { - /*$.ajax({ - url: "main.php?look="+look+"&rnd=&ajax=1", - cache: false, - success: function(html) { - $("body").html(html); +if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] != '') { + $file = explode('=', $d->point['file']); + if (file_exists('modules_data/location/' . $file[0])) { + require_once('modules_data/location/' . $file[0]); + } else { + if ($file[3] < 1 || $file[3] > 4) { + $file[3] = 1; + } + echo '

Локация "' . str_replace('.php', '', $file[0]) . '" не определена, вернуться назад
'; + mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); } - });*/ - location.href = "/main.php?look=" + look + "&rnd="; - } +} else { + ?> + + - - - -
- - - - - -
-

 error)) { - echo '' . $d->error . '
'; - } ?>

- info['bsid'] == 0 && $d->info['id2'] != 106) { ?>

Выйти

-
- - -
- - -
-
-
info['bsid'] == 0) { + return r; + } + + function addUser(v, mz) { + var r = ''; + var rz = 0; //растояние до пользователя + if (v[2] >= 1 && v[2] <= 3) { + rz = 1; + } + if (v[2] >= 4 && v[2] <= 6) { + rz = 2; + } + if (v[2] >= 7 && v[2] <= 9) { + rz = 3; + } + if (v[2] >= 10 && v[2] <= 14) { + rz = 4; + } + if (v[2] >= 15 && v[2] <= 19) { + rz = 5; + } + if (dConfig[rz] != undefined && dConfig[rz][v[6]] != undefined) { + new_w = dConfig[rz][v[6]]['w']; + new_h = dConfig[rz][v[6]]['h']; + new_left = dConfig[rz][v[6]]['left']; + new_top = dConfig[rz][v[6]]['top']; + if (v[2] == 6) { + new_left += 215; + new_top -= 5; + } + if (v[2] == 4) { + new_left -= 215; + new_top -= 5; + } + if (v[2] == 9) { + new_left -= 155; + new_top -= 2; + } + if (v[2] == 7) { + new_left += 155; + new_top -= 2; + } + if (v[2] == 13) { + new_left += 115; + new_top -= 1; + } + if (v[2] == 11) { + new_left -= 115; + new_top -= 1; + } + if (v[2] >= 11 && v[2] <= 13) { + new_top += 5; + } + if (rz >= 1 && rz <= 2) { + action = ''; + if (v[5] == 'bot' || info['bsid'];?> > 0) { + action = 'dialogMenu(' + v[0] + ',' + v[8] + ',' + v[7] + ',0,0,event,' + v[9] + ');'; + } + zfloor0[rz] += ''; + } else { + zfloor0[rz] += ''; + } + r = ''; + } + return r; + } + + var speedLoc = 0, sLoc1 = 0, sLoc2 = 0, tgo = 0, tgol = 0, gotoup777 = 0, gotext777 = ''; + + function cancelgoto() { + document.getElementById('gotext777').innerHTML = ''; + gotoup777 = 0; + gotext777 = ''; + } + + function goToLoca(id, ttl) { + if (tgo < 1) { + location.href = `/main.php?go=${id}&rnd=`; + } else { + // здесь тогда, когда нажал повторно на кнопку вперед/назад во время загрузки + gotoup777 = id; + gotext777 = ttl; + } + } + + function takeObj(objId) { + location.href = "/main.php?take_obj=" + objId + "&rnd="; + } + + function takeItem(itemId) { + location.href = "/main.php?take=" + itemId + "&rnd="; + } + + function Fast(look) { + location.href = "/main.php?look=" + look + "&rnd="; + } + + function locGoLineDng() { + var line = document.getElementById('pline1'); + if (line != undefined) { + prc = 100 - Math.floor(tgo / tgol * 100); + sLoc1 = 108 / 100 * prc; + if (sLoc1 < 1) { + sLoc1 = 1; + } + + if (sLoc1 > 108) { + sLoc1 = 108; + } + + line.style.width = `${sLoc1}px`; + + if (tgo > 0) { + tgo -= 1; + setTimeout('locGoLineDng()', 100); + } else { + if (gotoup777 > 0) { + // нажал на кнопку, идёт загрузка, нажал ещё раз и начнется другая + // именно в момент перехода на второй круг появляется этот код + location.href = `/main.php?go=${gotoup777}&rnd=`; + } + } + + var $DomGotext777 = document.getElementById('gotext777') + + if (gotoup777 > 0 && gotext777 != '' && $DomGotext777.innerHTML != `Вы перейдете ${gotext777} (отмена)`) { + $DomGotext777.innerHTML = `Вы перейдете ${gotext777} (отмена)`; + } else if ($DomGotext777.innerHTML != '' && gotoup777 == 0 && gotext777 == '') { + $DomGotext777.innerHTML = ''; + } + } + } + info['timeGo'] - time(); //сколько секунд осталось + $tmGol = $u->info['timeGo'] - $u->info['timeGoL']; //сколько секунд идти всего + echo 'var tgo = ' . ($tmGo * 10) . '; var tgol = ' . ($tmGol * 10) . ';'; ?> + + + + +
+ + + + + + - -
+

 error)) { + echo '' . $d->error . '
'; + } ?>

+ info['bsid'] == 0 && $d->info['id2'] != 106) { ?>

Выйти

+
+ + + - -
+ + + + - - -
+
+
info['bsid'] == 0) { + echo $d->usersDng(); + if ($dies > 0) { + echo '

Кол-во смертей: ' . $dies . '

'; + } + } else { + if ($d->info['id2'] != 15) { + //Живые участники и архивариусы + echo '

Живые участники:

'; echo $d->usersDng(); + } else { + echo '

Игровой счет. Красные: ' . (0 + $tm1win) . ' - Синие: ' . (0 + $tm2win) . '

'; if ($dies > 0) { echo '

Кол-во смертей: ' . $dies . '

'; } - /*if($dies > 3) { - mysql_query('UPDATE `users` set `room` = "321" WHERE `id` = "'.$u->info['id'].'" LIMIT1 '); - }*/ - } else { - if ($d->info['id2'] != 15) { - //Живые участники и архивариусы - echo '

Живые участники:

'; - echo $d->usersDng(); - } else { - echo '

Игровой счет. Красные: ' . (0 + $tm1win) . ' - Синие: ' . (0 + $tm2win) . '

'; - if ($dies > 0) { - echo '

Кол-во смертей: ' . $dies . '

'; - } - if (isset($sb['id'])) { - echo '

Шайба у вас, забейте её в ворота противника!

'; - } + if (isset($sb['id'])) { + echo '

Шайба у вас, забейте её в ворота противника!

'; } } - //Генерируем список текущих квестов - $qsee = ''; + } + //Генерируем список текущих квестов + $qsee = ''; - $dungeon_enter = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_room` WHERE `dungeon_room` = "' . $u->info['room'] . '" LIMIT 1')); - $sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 1000'); - while ($pl = mysql_fetch_array($sp)) { - $pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $pl['vars']) . '" AND (`tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '" OR `tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '|%" OR `tr_date` NOT LIKE "%tr_dn:=:%") LIMIT 1')); - if (isset($pq['id'])) { - $qsee .= 'Задание:   ' . $pq['name'] . ' ' . $q->infoDng($pq) . '
'; - $qx++; - } + $dungeon_enter = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_room` WHERE `dungeon_room` = "' . $u->info['room'] . '" LIMIT 1')); + $sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 1000'); + while ($pl = mysql_fetch_array($sp)) { + $pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $pl['vars']) . '" AND (`tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '" OR `tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '|%" OR `tr_date` NOT LIKE "%tr_dn:=:%") LIMIT 1')); + if (isset($pq['id'])) { + $qsee .= 'Задание:   ' . $pq['name'] . ' ' . $q->infoDng($pq) . '
'; + $qx++; } - $sp = mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `val` = 0 AND `info` != ""'); - while ($pl = mysql_fetch_array($sp)) { - $xrz = $pl['now']; - $r = $pl['max']; - if ($xrz > $r) { - $xrz = $r; - } - $r = '
-
' . $xrz . '/' . $r . '
-
-
-
-

'; + } + $sp = mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `val` = 0 AND `info` != ""'); + while ($pl = mysql_fetch_array($sp)) { + $xrz = $pl['now']; + $r = $pl['max']; + if ($xrz > $r) { + $xrz = $r; + } + $r = '
+
' . $xrz . '/' . $r . '
+
+
+
+

'; - $qsee .= 'Задание:   ' . $pl['info'] . ' ' . $r . '
'; - } - if ($qsee != '') { - echo '

' . $qsee; - } - ?>
-
itemsMap(); ?>
-
information)) { - echo $d->information; - } ?>
+ $qsee .= 'Задание:   ' . $pl['info'] . ' ' . $r . '
'; + } + if ($qsee != '') { + echo '

' . $qsee; + } + ?>
+
itemsMap(); ?>
+
information)) { + echo $d->information; + } ?>
+ +
+
+ +
+
- info['admin'] > 0) { - #echo $d->genObjects(); - } - ?> -
-
- -
-
-
-
- -
-
- - '; - $j = 1; - $htmlv2 = ''; - while ($j <= 9) { - $htmlv2 = '' . $htmlv2; - $j++; - } - $htmlv .= $htmlv2 . ''; - $i++; - } - echo $htmlv; - unset($htmlv, $htmlv2); - ?> - -
- -
-
- -
- - testGone(3) > 0) { ?> - - testGone(4) > 0) { ?> - - testGone(2) > 0) { ?> - - testGone(1) > 0) { ?> - - - - -
- -
-
-
_").html("
' src='//img.new-combats.tech/chars//'>
"); + + +
+
+ +
+ + testGone(3) > 0) { ?> + + testGone(4) > 0) { ?> + + testGone(2) > 0) { ?> + + testGone(1) > 0) { ?> + + + + +
+ +
+
+
+
-
-
-
-
+
-
-
"> +
-
-
+
-
-
-
-
"> +
+
-
-
-
-
-
"> +
+
-
-
-
-
-
"> +
+
-
-
-
-
-
- info['admin'] == 0){ ?> -
- -
+
+
+ info['admin'] == 0){ ?> +
+
@@ -1312,71 +1154,70 @@ if ($u->room['file'] == 'dungeon') {
- - - -
-
-
-
 
-
-
-
- -

- info['admin'] == 1) { - echo '
X - Y -

- S:' . $u->info['s'] . ''; - } - ?> - + + $('#g6').click(function () { + /* $.ajax({ + url: "main.php?look=1&rnd=&ajax=1", + cache: false, + success: function(html) { + $("body").html(html); + } +});*/ + location.href = "/main.php?look=1&rnd="; + }); + + $('#g7').click(function () { + /*$.ajax({ + url: "main.php?look=2&rnd=&ajax=1", + cache: false, + success: function(html) { + $("body").html(html); + } +});*/ + location.href = "/main.php?look=2&rnd="; + }); + + }); + +

+ info['admin'] == 1) { + echo '
X - Y -

+S:' . $u->info['s']; + } +}